Go to: Related nodes. Attributes.

Light Info is a utility node that you can use to obtain information about the position of a light relative to a texture. As each point on the texture is being shaded, the attributes of the Light Info node can tell you the precise distance from the light to the point being shaded. It also returns other information that can be useful when creating a shading network.

To make this work, you must connect the World Matrix attribute of the light to the World Matrix attribute of the Light Info node. Once that is done, the Light Info utility node is ready to use. This node provides the following information: You can use this information as the input to other shading nodes, to produce interesting effects. For example, you could connect the Sample Distance attribute to one of the color channels of a shader. That way, the color of the shader will change depending on how far it is from the light. Note: You can actually attach the World Matrix of any object (not just a light) to this node, to get information about the object's position relative to the point being shaded. In the table below, important attributes have their names listed in bold in the description column.

This node is MP safe

Node name Parents Classification MFn type Compatible function sets
lightInfo dependNode utility/general kLightInfo kBase
kNamedObject
kDependencyNode
kLightInfo

Related nodes

blendColors, clamp, gammaCorrect, surfaceLuminance, contrast, luminance, rgbToHsv, hsvToRgb, samplerInfo, setRange, resolution, renderQuality, renderGlobals, renderGlobalsList, baseShadingSwitch, singleShadingSwitch, doubleShadingSwitch, tripleShadingSwitch

Attributes (16)

lightDirection, lightDirectionOnly, lightDirectionX, lightDirectionY, lightDirectionZ, lightPosition, lightPositionX, lightPositionY, lightPositionZ, matrixEyeToWorld, pointCamera, pointCameraX, pointCameraY, pointCameraZ, sampleDistance, worldMatrix

Long name (short name) Type Default Flags
matrixEyeToWorld (e2w) fltMatrix identity inputconnectablestorablehidden
The transform to go from eye to world space
lightDirectionOnly (ldo) bool false inputconnectablestorable
Light Direction Only controls how the Sample Distance attribute is calculated. If Light Direction Only is turned off, then the Sample Distance attribute returns the world-space distance from the light to the point being sampled. If Light Direction Only is turned on, then the Sample Distance attribute returns the distance along the light direction vector, to the closest point on that vector to the point being sampled. In more mathematical terms, it returns the length of the projection of the light-to-object vector onto the light-direction vector. See the Rendering documentation for an explanatory diagram.
worldMatrix (wm) fltMatrix identity inputconnectablestorable
World Matrix. Connect the output World Matrix attribute of a light or other object to this attribute. This must be done before the output of this node is usable.
pointCamera (p) float3 0.0, 0.0, 0.0 outputinputconnectablehidden
The current sample point that has to be shaded
pointCameraX (px) float 0.0 outputinputconnectablehidden
The x component of the current sample position
pointCameraY (py) float 0.0 outputinputconnectablehidden
The y component of the current sample position
pointCameraZ (pz) float 0.0 outputinputconnectablehidden
The z component of the current sample position
lightPosition (lp) float3 0.0, 0.0, 0.0 outputconnectable
Light Position. This attribute gives the position of the connected light in world space. The "connected light" is the light (or other object) whose World Matrix attribute is connected to the World Matrix attribute of this node.
lightPositionX (lpx) float 0.0 outputconnectable
The X component of Light Position in world space
lightPositionY (lpy) float 0.0 outputconnectable
The Y component of Light Position in world space
lightPositionZ (lpz) float 0.0 outputconnectable
The Z component of Light Position in world space
lightDirection (ld) float3 0.0, 0.0, 1.0 outputconnectable
Light Direction. This attribute gives the direction in which the connected light is shining. Point lights, of course, shine in all directions.
lightDirectionX (ldx) float 0.0 outputconnectable
The X component of the Light Direction in world space
lightDirectionY (ldy) float 0.0 outputconnectable
The Y component of the Light Direction in world space
lightDirectionZ (ldz) float 0.0 outputconnectable
The Z component of the Light Direction in world space
sampleDistance (sd) float 0.001 outputconnectable
Sample Distance is the world-space disatance between the connected light and the point on the surface being shaded. This can be caculated in different ways. For details, see also the Light Direction Only attribute.