Color Elimination

From Shader Forge Wiki
Jump to: navigation, search
Example of color elimination, one water-like, and one coke-like
Node tree of the shader used in the example

Color Elimination is the real-world physical effect where translucent materials, commonly fluid, tend to absorb different wavelengths at different rates, as light is passing through it.

Tropical water tends to have a cyan tint when shallow, but the deeper parts will be tinted deep blue, and finally black. This is because red wavelengths absorb quite quickly, while green wavelengths can go farther, and the blue wavelengths can go even longer without absorption.

This shader is an approximation of the effect, simplified into RGB channel color elimination, based on camera depth. Note that this requires the camera to write to the depth texture.

In the example, you can control near and far fade distances, similar to how you would control linear fog. You can also tweak the density and the falloff curve.