Native USD Lights
You can create native USD lights in Katana using the UsdLight node. This node also allows you to edit existing USD lights that have been imported.
Creating a Light
• Add a UsdLight node.
• In the Parameters, choose an action from the dropdown. To create a new light, select create.
• Choose a lightType from the dropdown. The list will include light types registered in the registry and any render specific lights.
Basic lights you will usually find shown in the list here:
Then, adjust your light in the properties section:
See properties
• Inputs: Adjust light properties such as color, intensity and exposure.
• Shadow: Adjust shadow options such as the shadow color and falloff.
• Shaping: In the Shaping API section, you can toggle to activate and apply, as well as any parameters that come with it.
• Texture: Adjust texture options where relevant.
• Extent: Extent is a three dimensional range measuring the geometric extent of the authored gprim in its own local space (i.e. its own transform not applied), without accounting for any shader-induced displacement. Here you can categorise the geometry’s purpose and visibility.
• Light: Define shader ID and specify the relationship of the Material response to the lighting response.
• Transform (xformOpOrder): Transform lights that are Xformable.
Note: This section will show different options depending on the type of light you select.
Editing a Light
You can also edit existing lights using the UsdLight node.
• Add a UsdLight node.
• In the Parameters, choose an action from the dropdown. To edit an existing light, select edit.
• Select your light’s location in the primPath field - this is the light you wish to edit.
• The light properties will then be populated and any edits you make will override it.
USD Lights in the Viewer
USD native light locators are now visible in the Viewer tab.
To view them, you can simply expand the Scene Explorer (double-click a prim path to expand all prims below) and the light created will display in the Viewer.
In this example, the Scene Explorer is expanded to the “light” prim path which will reveal it in the Viewer. Since it is a SphereLight (as described in the Type column), the relevant locators will display.
Creating USD Lights - Practical example
Creating USD lights in Katana can be done natively using the UsdLight node or by converting Katana lights to USD lights using the KatanaToUsd node. The example below showcases a simple lighting setup using a combination of the above.
1 START
Let’s start by bringing in our scene. In this case, we are using the robot from one of the native USD example projects, which can be found under Help > Example Projects > Native USD > Exporting USD Data. Bring this into your project using a UsdSubLayerAdd node.
Click to expand the image
2
Start by placing down a UsdLight node and connecting it downstream of the UsdSubLayerAdd node. To get an accurate representation of our light in the Viewer, we’ll turn off the ‘Default Lighting’ option under Display in the Viewer tab. The robot will turn pitch black as we currently don’t have any lights in our scene.
3
In our UsdLight node parameters, make sure the action is set to create and we’ll rename our primPath to /lights/light_key. You’ll see in the Scene Explorer that no light primitive is being created yet. This is because we need to define a lightType first.
4
To define a lightType, click on the lightType parameter in the UsdLight node. This will show a dropdown with all the available lightTypes. It gets dynamically populated with lights that are available in the SdrRegistry. This list can vary depending on the version of USD you are working with and/or which render delegate is plugged in.
Let’s choose a standard DiskLight. It will show up in the Scene Explorer (don’t forget to toggle your Viewer working set or expand the light to see it in the Viewer) and the parameters will get updated in the parameters tab.
Click to expand the image
5
By selecting light_key in either the Viewer or the Scene Explorer, we can press ‘W’ in the viewer to bring up the manipulators. You can also use the manipulator buttons on the left side of the Viewer. Move the light_key to a position of your choice. You’ll see we are getting a preview of our lighting in the Viewer.
Click to expand the image
6
Next, we can adjust the light to our liking. Here, the intensity has been turned up, scale has been increased. and the color has been adjusted to an orange hue.
Click to expand the image
Note:
Another method of creating USD Lights is by using the GafferThree node and converting the Geolib lights to USD lights with the KatanaToUsd node. Here, we created a simple light and assigned it a UsdLuxDiskLight material, increased the intensity, and changed the color to red. We can see both previews of our lighting regardless of it being a Geolib or a USD light.
Click to expand the image
Editing USD Lights - Practical example
We can use the UsdLight’s edit mode to edit any incoming USD light whether it is being created by another UsdLight node upstream or being imported from a USD file into your project.
In edit mode, UsdLight will read the light primitive, dynamically set the lightType, and show incoming values in the Parameters tab. Any adjustments made will be set as an ‘over’ on the light primitive. We’ll use the previous example to show this.
1 START
Start by inserting a UsdLight node, changing its mode to edit and connecting it up to the Merge node from the example above.
Click to expand the image
2
Drag and drop the light_key primitive from the Scene Explorer to the primPath parameter in the UsdLight node. This will automatically populate the parameters with the lightType, inputs, and the transforms.
Click to expand the image
3
Now we can start editing the light. Here, we are changing the color to blue, increasing the diffuse to 2, and moving it a bit further away from our robot. You’ll see the light being updated in the Viewer.
Click to expand the image
4
We can see our edits being written as ‘over’ with the help of the USD Text View and by selecting the UsdLight node.
5
The same applies for USD lights that are being brought into your scene. To show this, we’ve exported our scene to a .usda file using the UsdLayerExport node and brought it back in using a UsdSubLayerAdd node.
Click to expand the image
6
Next, we can use a UsdLight node to edit these incoming lights with the same method mentioned above. Let’s change light_fill to green and change its intensity as well as its exposure.
Click to expand the image
7
Once again, we can use the USD Text View to see our changes made to the stage.