Q100269: How to set up textured Arnold mesh lights in Katana
This article explains how to apply a texture to an Arnold mesh light in Katana, and includes an example scene illustrating the working setup for reference.
More information on mesh lights can be found in the Arnold for Katana User Guide on Mesh Lights. For a simple example of an Arnold mesh light in Katana, please see this article: Q100268: How to use an object as an Arnold mesh light in Katana
In the above article describing how to use an object as an Arnold mesh light in Katana, an example scene is provided to illustrate the overall setup. The following article expands on that scene set up by showing how a texture can be applied to the light to create textured Arnold mesh lights in Katana.
Please read on for a step by step explanation of how the provided example scene was set up:
The Arnold mesh_light shader that is used in the basic mesh light setup doesn’t accept colour maps and is therefore not suitable for creating textured mesh light. If you would like to achieve this, you will need to create a shading network, bake the material out into a Katana LookFile and read this back into GafferThree as the light material. You can do this as follows:
- Create an ArnoldShadingNode, set the nodeType to image and give the node the name Image. Under parameters.filename add the path to the image file you would like to use as a texture.
NOTE: It may be helpful to specify an image file with a constant colour, for example a plain red image, as a texture at first to easily verify that it is actually being applied.
- Create another ArnoldShadingNode, call it mesh_light and set the nodeType to mesh_light.
- Connect the nodes by clicking the output arrow on the right side of the Image node and choose out from the list of available output ports.
- Then click the input arrow on the left side of the mesh_light node, find Common > color input port in the list and click on it to connect the nodes.
- Create a NetworkMaterial node and add an input port by clicking AddTerminal > arnold > light.
This will create an input port on the node in the Node Graph.
- Click the mesh_light node’s output arrow and connect out to the NetworkMaterial input you just created.
- Now you need to expose some parameters in the Material Interface to get access to them and be able to change them later when we want to use the material. Most importantly for a mesh light material, expose source.mesh on the mesh_light node:
Click the wrench icon next to the parameter > Edit Parameter Name in Material Interface.
In the Material Interface Options dialog that pops up, enter a name for the parameter such as ‘mesh’ and click OK.
- Do the same for any other parameters you would like to edit later when you use the material, such as Intensity, Exposure or Samples.
- Connect the network material to a LookFileMaterialsOut node, choose a directory to save your .klf file to, such as /tmp/MeshLight.klf and click ‘Write Look File’.
- Use the above written LookFile with the mesh light example scene created via article Q100268: How to use an object as an Arnold mesh light in Katana. Select the existing light in GafferThree node of the above scene and delete it.
- Create a new light.
- In the Material tab of the new light, tick the useLookFileMaterial checkbox.
Set asset to the path to your lookfile and choose the textured mesh light material as materialPath.
Your exposed parameters will appear under shaders.parameters, allowing you to specify which mesh you would like to use as a light source as well as modify any other parameters you exposed previously.
- Specify the scene graph path to the sphere as the source mesh for the mesh light. A Preview Render from the RenderSettings node should now show the inside of the box illuminated per the chosen texture file.
NOTE: Using an object as a mesh light doesn’t change the object’s surface shader. You will need to create a separate material that matches the light colour and apply it to the surface of the object, as described in step 9 of article Q100268: How to use an object as an Arnold mesh light in Katana
The example scene attached was created in Katana 2.5v4 with Arnold 22.214.171.124 and KtoA 1.1 by following the above steps, and can be used as a reference for working with mesh lights in Arnold and Katana.
We're sorry to hear thatPlease tell us why