Hi I was wondering for a problem , in Second life I have seen that most of the alpha texture have a problem due to the alpha sorting level meaning that when two transparent textures overlap they flip somehow on the view , this I read was due to not using alpha textures that are just like 1 bit black or white but also using shades of gray that then cause the problem , tough tI have seen that in the game crysis the palm textures in dds format do use a shaded alpha of severall gray levels but do not have this weird flippering effect ingame why is that happening in SL ?
Replies
Even though it's only on vs. off, if you use a smooth grayscale alpha you get a smoother result when it's clipped. If you use an alpha that's only black vs. white you tend to get large stairsteps when it is alpha tested.
The other common method for alpha transparency is alpha blend, which gives you soft-edged transparency and translucency, but also usually has alpha sorting problems as well. The renderer has to figure out what's behind each pixel, but it usually just compares the centers of each object to figure out what's in front vs. behind, instead of each pixel.
Been meaning to get some of this into the wiki with purdy pictures to explain it. It's pretty easy to understand once someone explains it well, which I'm probably not.
CryEngine 2 (Crysis Warhead, Crysis Wars) uses a deferred renderer, which allows them to smooth out the edges after they're alpha-tested.
Here's an explanation along with lots of other cool info about their vegetation:
GPU Gems 3: Vegetation Procedural Animation and Shading in Crysis
More discussion about alpha in this thread.
Transparencies, sorting and intersecting
http://unity3d.com/support/documentation/Components/shader-TransCutDiffuse.html
The cool slider thing is the same thing as the "threshold" I mentioned. You can see what this does to your alpha if in Photoshop you go to the Image menu and choose Adjustments: Threshold and move the slider.
The cool thing about alpha test is it cuts off the edge at the screen pixel level, so the edge appears to get rounder as you get closer to it, rather than just being the same resolution as your original texture.
Edit... yeah sorting can be a pain in the ass!