Sample Render using the custom Voronoi 3D Texture Node.
The following package contains all the material described in this tutorial: Custom_Hypershade_Nodes.tar.xz.
Shader development in 3Delight for Maya is very easy. This tutorial explains how to create your own HyperShade node. As an example, we show how to develop a simple voronoi noise as a Maya 3D Texture.
Main Components
To create a single node only compiled OSL shader is needed. Optionally, it is possible to add icons to have a better visual representation of the node inside Hyerpshade and the Outliner.
The following table shows where each component should be installed for a Maya 2015 package.
Component | Installation Environment Variable | Default Location |
---|---|---|
Compiled OSL shader path | _3DFM_USER_OSL_PATH | decided by user |
Icons | XBMLANGPATH | C:\Program Files\3Delight\maya\2015\icons |
Creating a Custom 2D Texture Node
After correctly providing the compiled OSL shader path, you will be able to render using the new texture as with any other Maya 2D Texture. place2dTexture
node is automatically supported if the shader has attributes uv
and uvFilterSize
.
The Voronoi node viewed in the Create menu of the HyperShade
place2dTexture
node is automatically supported.
Voronoi noise connected to the
The OSL Source Code
The Voronoi texture looks like a standard Open Shading Language surface shader but with some optional metadata:
string maya_name
Specifies the script name of the attribute in Maya.
string maya_label
Specifies the disply name of the attribute in the Attribute Editor.
string maya_type
Specifies how to display the attribute in the attribute editor. For now, only "bool" is supported to display an integer parameter as a checkbox.
string maya_group
Specifies the name of the group in the Attribute Editor.
float maya_min
Sets the soft minimum value for this attribute.
float maya_max
Sets the soft maximum value for this attribute.
int maya_hidden
If 1, the attribute is hidden and not appears in the Attribute Editor.
The source code for our voronoi texture follows. To use it as Maya HyperShade node, the shader should be compiled using oslc utility from the OSL package.
Adding Icons for the Outliner and Hypershade
You can add icons to both the Outliner and Hypershade (this applies to both texture nodes and shader nodes). The table below details the convention for creating the icons for our Voronoi Noise.
Outliner | HyperShade - Node Lister | HyperShade - Work Area | |
---|---|---|---|
Icon Resolution | 20 x 20 pixels | 32 x 32 pixels | 128 x 128 pixels (up to 512 x 512 pixels) |
Format | Transparent 24 bits PNG | Transparent 24 bits PNG | Transparent 24 bits PNG |
Naming Convention | "out_" + <node_type> + ".png" | "render_" + <node_type> + ".png" | <node_type> + ".png" |
Example | Note the transparent corners of the icon matching Maya |