Is it possible to control the depth fade if used as an alpha in a lerp via camera vector rather than its initial default. I have tried and failed or I am not implementing it correctly. Any advice would be muchly appreciated. My material itself looks fine from the ground stationary but moving certain ways makes the depth fade move to unwanted results. Ive tried using a scene depth and pixel depth in the material as well. Not sure if I am getting closer to the result i want.
asked Jul 14 '14 at 10:49 AM in Rendering
I think I know what you are talking about. I had this problem working on the imulsion material for gears 1. I was using depth fade as the texture coordinate of a gradient texture for where the pool intersected the ground. In order to make the gradient wider, I made the slope of geometry under the translucency fairly flat.
Initially, the thickness of the band fluctuated way too much based on viewing angle. At first I considered it an artifact but it is just due to how the ray of intersection travels much further at glancing angles when the two planes in question are parallel.
I refer to the correction below as "perspective corrected depth fade" as you will be counteracting that long ray at glancing angles.
Basically you do a dot product of the camera vector and vertex normal, and either clamp or constantbiasscale that into the 0-1 range and use it to lerp between two different depths, each a scalar parameter. You will have to fiddle with the numbers a bit as this isn't perfect.
Follow this question
Once you sign in you will be able to subscribe for any updates here