I need a shader that will let me fade out objects from view to display objects behind them (with the same shader to allow multiple levels of alpha transitions) yet still respect the zbuffer.
So I want to see the objects behind the transparent one, but have proper z-sorting.
This has gotten me close, but causes weird clipping of full-alpha, but z-behind objects.
1 points at an object with this shader at ~15% alpha
2 is an object with a standard diffuse shader
3 is an object with the above shader, but full 100% alpha. Note how the sides have been clipped by one of the objects in collection 1 (there would be more objects in this group, but due to the current scripting I have to turn on the renderer manually to see them, I’m trying to transition from a click → visible/invisible to a click → animated alpha tween shift).
The problem is, all that opaque geometry will at some point in its own lifetime also be transparent, thus I can only use one shader.
Think Google Body and how you can turn layers on and off through a slider bar.
Except I’m not building Google Body (I’m not, really, I swear, WHY DOES IT LOOK LIKE GOOGLE BODY!? D: Thank god I’m not responsible for the design or content. Or dropping $1000 on an anatomically correct 3D model, complete with individually modeled muscles and organs.)
Hm. Might be able to swap shaders at runtime…will be kind of a bitch, but I think it might work.
It’s the VertexLitWithZ that’s over on the unitywiki, although slightly edited to get a slightly better result (I posted it in the first post).
Que? I’m afraid I don’t understand the question. I was never too good with materials and textures and 3D in general (I couldn’t model a paper bag to save my life).
OK. I think you should consider using different shaders for different parts.
In Unity, the framebuffer has color components (red, green, blue) and a depth for each pixel. Additionally, it has an alpha component. If you don’t know about it, you are probably not using it.
I thought I had an idea, but it probably is not as easy as I thought. I have to think more about it.