For some specific effect, I wonder how I can, inside a custom scene node's render function, draw a polygon which is completely transparent (= not changing anything visibly when drawn) but updates the zbuffer as if solid/opaque.
I think of something like the reverse of a solid opaque object with zwrite off: an invisible object but rendering to the zbuffer like with zwrite even for transparent parts.
It would be sufficient for me to use this with a triangle list, not an actual complete scene node. Also I use OpenGL if that helps.
Is there a way to do this?
Drawing to Zbuffer
How about adding a transparent texture/color to all polys in the mesh?
Also, the last post of this thread might help -- not sure. (solid inside transparent pass or transparent inside solid pass?)
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=43178
Also, the last post of this thread might help -- not sure. (solid inside transparent pass or transparent inside solid pass?)
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=43178
just use a polylist with vertex color totally transparent and use ONE_TEXTUREBLEND as material type and as blending function use what ever suits you but use the vertex color as transparent.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
-
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm
While I don't know for sure, I am pretty certain that any sort of usual color masking or transparent texture will NOT cause the polygon to fill the zbuffer (since Irrlicht checks for a 0.5 alpha treshold to do that usually).
Therefore I don't think any of the usual "just make the polygon appear transparent" approaches work, since then that would also stop them from rendering to the zbuffer. If I'm wrong with that then I'll happily use that color mask approach (will test tomorrow).
I am not sure if the vertex color approach is also prone to that 'limitation' (actually it makes sense in any normal scenario that the zbuffer is left untouched for invisible parts), but I am pretty sure both color keying and simply using a transparent texture are.
Therefore I don't think any of the usual "just make the polygon appear transparent" approaches work, since then that would also stop them from rendering to the zbuffer. If I'm wrong with that then I'll happily use that color mask approach (will test tomorrow).
I am not sure if the vertex color approach is also prone to that 'limitation' (actually it makes sense in any normal scenario that the zbuffer is left untouched for invisible parts), but I am pretty sure both color keying and simply using a transparent texture are.
-
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm
Nice, thanksJust render the node as usual (EMT_SOLID), except that you change the color mask to ECM_NONE.

Well... I will have a custom scene node and then in the render method, I will manually render (using the draw triangle list) first some solid wall surface with zwrite disabled, then a semi-transparent decals thing also with zwrite disabled, and then that ECM_NONE polygon to fill out the z-depth space afterwards.If you used the transparency approach, wouldn't the node be drawn in the transparent pass? This would draw it after the other nodes. If you try drawing the node in the solid pass before the others, I don't think it will render.
Basically I just want to draw a wall with decals on it without having any z-fight issues between the wall and the decals.
-
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm
A problem with that approach is that if a wall behind you has decals on it, the decals from the wall behind will be drawn ahead of the wall in front of you. Almost like xray vision
. You may also end up finding that without z-write, parts of the walls will be drawn over each other when they shouldn't be.
