Displaying Textures in the Hydra Viewer
Displaying textures in the Hydra Viewer is useful for producing a preview of how the textures will look once rendered. The basic principle is to create a Material node assigned with a Hydra Surface Shader and the texture you want to apply, and a GafferThree node containing a Hydra Light Shader to light the texture in the viewer.
Note: The Hydra Viewer can display RGB and RGBA image formats, such as .bmp, .png, and .jpg. Texture maps in the form of .tx and .tex files are not currently supported. If textures are not displaying as expected you can try a different file format.
Displaying Textures With Existing Materials
This video shows you how to display textures in the Hydra Viewer when you already have materials in the scene. This is achieved through the use of the advanced merge options to combine your new material with the existing material.
The Katana project used to demonstrate this is part of a tutorial series which can be found here: Katana 3.1 - Getting Started. From that page you will also be able to download the scene files and assets. To follow along with this video, download the files and open the scene named 'Tutorial_E20'.
Tip: For more information on advanced merge options, see Merge.
In the video:
- Open a scene containing geometry with a material already assigned.
- Create a new Material node next to your existing material and give it the same name.
- Select both your existing and new Material nodes and hit M on the keyboard to create a merge node.
- In the Parameters tab of your new material, select Add Shader > hydra > surface.
- From the drop down menu next to the hydraSurfaceShader parameter, select the katana_surface option.
- Expand the hydraSurfaceShader parameters and click the drop down menu next to diffuseTexture, select Browse and choose your texture file.
- Create a GafferThree node underneath your Merge node.
- Left-click anywhere in the box within the Parameters of the GafferThree node and hit L on the keyboard to create a new light.
- Select the material tab and click Add Shader > hydra > light.
- From the drop down menu next to hydraLightShader select the katana_spot option to create a spot light.
- Select the merge node you created earlier and choose Yes from the showAdvancedOptions drop down menu to view the advanced merge options.
- Expand the advanced options and select Add > New Entry from the mergeGroupAttributes parameter.
- Type "material" into the mergeGroupAttributes text field to specify the name of the group attribute that you want to be merged between the two inputs.
Note: Be sure to replace the connection from the output of your existing material with your new GafferThree node output so that it is linked to the rest of your scene.
Displaying Textures Without Existing Materials
If your geometry does not have existing materials assigned, follow the video below to achieve the same result without the need for advanced merging.
Note: This tutorial video shows the node graph, including the Material, MaterialAssign and GafferThree nodes, already set up but with default parameters.
In the video:
- Select the Material node.
- In the Parameters tab of your new material, select Add Shader > hydra > surface.
- From the dropdown menu next to the hydraSurfaceShader parameter, select the katana_surface option.
- Expand the hydraSurfaceShader parameters and click the dropdown menu next to diffuseTexture, select Browse, and choose your texture file.
- Select the MaterialAssign node and view its parameters.
- From the Scene Graph, use the middle-mouse button to drag the material over to the materialAssign text field.
- Select Add Statements > Paths to create a text field for your geometry path.
- From the Scene Graph, use the middle mouse button to drag your geometry over to the Paths text field.
- Select the GafferThree node and view its parameters.
- Right-click anywhere in the box within the Parameters of the GafferThree node and select Add > Light to create a new light.
- Select the material tab and click Add Shader > hydra > light.
- From the drop down menu next to hydraLightShader select the katana_distant option to create a distant light.
- Increase the Intensity to 10 to brighten the scene and view your material.