reflectlight VEX function

Computes the amount of reflected light which hits the surface.

Contexts: fog, surface

  1. vector reflectlight(float bias, float max_contrib)

  2. vector reflectlight(vector P, vector D, float bias, float max_contrib)

  3. vector reflectlight(vector P, vector N, vector I, float bias, float max_contrib)

Computes the amount of reflected light which hits the surface.

bias is typically a small number (for example 0.005) used to help eliminate self-reflection.

max_contrib tells the renderer how much the reflected light will contribute to the final color of the pixel. This is typically the maximum of the reflection component of a lighting model. This has no effect on the resultant color. This value should typically be less than 1.

There are also two “general” forms of reflectlight which take a position (P) and direction (D). There is also a form which takes a position, direction and incident ray (I) and computes the reflection vector.

See optional shading and image filter parameters.

surface mirror(vector refl_color=1; float bias=.005)
{
    Cf = refl_color * reflectlight(bias, max(refl_color));
}