sample_light VEX function

Returns the 3D position of a point on an area light.

Contexts: displace, fog, light, shadow, surface

See also: getlights, nextsample

  1. vector sample_light(int lightid, float sx, float sy, float time)

lightid is an integer identifying a light. You can get a list of light IDs for lights affecting the currently shaded surface with getlights.

sx and sy are random values, such as generated by nextsample. Different values of sx and sy translate into different random positions on the geometry of the area light.