Search Tips

Search is based on keyword.

`Ex: "Procedures"`

Do not search with natural language

`Ex: "How do I write a new procedure?"`

Give Feedback Support Portal

# Using and Overriding Look Files with GafferThree Lights

To use more complex shading networks to drive your light’s materials, you can define the material first, and then use a look file to apply it to lights created in GafferThree nodes.

To set up the network material, and bake it into a look file:

| 1. | Add a NetworkMaterial node. In it’s parameters tab, click add terminal, and choose dl/Light from the dropdown

| 2. | Add a DlShadingNode and change the nodeType to spotLight

# Displaying Network Material Parameter Values

To show values of parameters from the public interface of the Network Material in specific columns of the GafferThree object table, you need to set parameter meta name attributes in the material group attribute of the material location that defines the Network Material. To set these attributes, do the following:

| 1. | In the DlShadingNode, click the wrench icon to the right of the Color controls, select Edit Parameter Name in Material Interface..., and change the Name value to color.

| 2. | Using the wrench button for both Intensity and Exposure, change Name parameter to intensity and exposure respectively.

| 3. | Change the Color, Intensity, and Exposure values to non-defaults.

The parameters are displayed in the Material Interface section of the NetworkMaterial node's parameters tab.

Note: The naming of the parameters, and their related attributes, need to follow a strict syntax to be read as metadata by the gafferThree table.
Attributes must be set to read the material parameters and feed their values as metadata to the gaffer object table. These attributes need to adhere to the following syntax:

Names of the attribute`: material.meta.[parameterMetaName].[rendererName]`
For example, material.meta.exposure.dl
The values:`parameters.[parameterName]`
For example, parameters.exposure
You can set these string attributes one at a time using AttributeSet nodes, or you can set multiple attributes at once using OpScript nodes.

| 4. | Add an OpScript node and use the following script, which will populate the material.meta attributes with the names and values of the parameters declared in the network material.

    local materialInterfaceGroupAttr = Interface.GetAttr("material.interface")

    local targetName = "dl"

    for i = 0, materialInterfaceGroupAttr:getNumberOfChildren() - 1 do
        local parameterName = materialInterfaceGroupAttr:getChildName(i)
        Interface.SetAttr("material.meta." .. parameterName .. "." .. targetName,
                         StringAttribute("parameters." .. parameterName))
    end

| 5. | Bake a material lookfile, by using a LookFileMaterialsOut node. Set the saveTo location and click Write Look File and save the look file.

| 6. | In a separate branch of the NodeGraph, add a LookFileMaterialsIn node. In the lookfile section, browse to your saved lookfile from step 5.

| 7. | Add a gafferThree node.

Your node graph should now look similar to this:

| 8. | Add a 3Delight spotlight by right-clicking in the gaffer table, select Add3Delight > Spotlight, or type Q.

| 9. | Select the spotlight in the gaffer table, open the Material tab below, check useLookFileMaterial.

| 10. | In the asset field, browse to the look file that was baked in step 5.

| 11. | Middle-mouse and drag the network material that appears in the Scene Graph tab under root/materials/NetworkMaterial) into the materialPath field.

The exposed parameters from your network material will be listed as editable parameters. These parameters and their values will also be displayed correctly in the Color, Int and Exp columns of the gaffer table for ease of reference. Any overrides to the material parameters are reflected here.

The same look file can be applied to many different lights, and locally overridden in the GafferThree node.