Use the Light Info utility
 
 
 

For a description of the Light Info utility, see Light Info.

To view and connect Light Data attributes to Light Info attributes

  1. Once you have created lights in the scene, select Lights from the Hypershade menu bar to view the LightShape swatches in Hypershade.
  2. Select Light Info from the Create > Utilities menu.
  3. Ctrl+middle+drag the LightShape swatch over the Light Info swatch. The Connection Editor appears.
  4. In the Left Display menu, make sure Show Readable is on. In the Right Display menu, make sure Show Inputs Only is on.
  5. Click to connect the LightShape’s World Matrix [0] attribute to the World Matrix attribute of the Light Info node.

    Notice the light tab added to the top of the Light Info’s Attribute Editor. Click this tab to access the light’s information and adjust these values to translate and change the light in X, Y, and Z.

    You can also select any one of the Light Data attributes from the Connection Editor. Light Data attributes include the light direction, light intensity, light ambient, light diffuse, light specular, and light shadow fraction.

  6. Select the attribute you want to connect from the list.

Use this information as the input to other shading nodes to produce interesting effects. For example, if you connect the Sample Distance attribute to one of the color attributes of a material, the color changes depending on how far it is from the light.

Note

You can 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.