TranslucentZWrite
by Ivan · in Torque Game Engine · 12/10/2007 (11:15 am) · 2 replies
Hi, I have a problem when i insert an object in TGEA. I notice that when i put an object who has a part made of pngs transparencys for its leafs(It s a palm), these pngs go crazy. Sometimes the ones that are in the back appear on front from no reason. Ive been making my research about this problem, and I noticed that the material.cs file has information about how TGEA renders the image files in the game, then i found a list of scrpts for this issue, and tried to use a script named translucentZWrite (according to the documents this scripts allows to translucency material to be written to the zbuffer). Then, my problem was resolved. But i found a new problem. Only when i use this scripts i have an halo of some kind of antialias that looks strange (Look the image). i dont understand why this is happening, it may be a problem with the configuration of TGEA because i followed all the instructions for export the palm from 3dsmax and the antialias transparency works fine when i didnt use the translucentZWrite script. Could you help me with this issue? I will aprecciate your help
Sorry for my english


crazy eh?
Sorry for my english


crazy eh?
About the author
#2
I assume that around the edges of your leaves, you've got some pixels whose alpha value isn't exactly 0, but slightly more than that, so they're written to the Z buffer even if they shouldn't.
There are a number of ways to fix it, as a quick solution I'd suggest increasing the AlphaThreshold value.
As an optimal solution, I'd suggest disabling ZWrite, and sorting your objects with translucent textures manually, but that's quite a bit of work.
01/07/2008 (3:59 am)
By looking at the pictures (sorry I dont have time to look at TGEA or at the script you're using), it looks like you have AlphaTest enabled, ZWrite enabled, and AlphaThreshold set to 0. This would mean that any pixel whose alpha isn't zero would be written to the Z buffer, therefore occluding objects behind it.I assume that around the edges of your leaves, you've got some pixels whose alpha value isn't exactly 0, but slightly more than that, so they're written to the Z buffer even if they shouldn't.
There are a number of ways to fix it, as a quick solution I'd suggest increasing the AlphaThreshold value.
As an optimal solution, I'd suggest disabling ZWrite, and sorting your objects with translucent textures manually, but that's quite a bit of work.
Tom Hobson