API Guide > Writing a Software Shading Node >

# Writing a shading node plug-in

Custom dependency graph nodes include the header file:

<maya/MPxNode.h>

and then derive from the class MPxNode. To build your own shading node as a plug-in to Maya, follow the same guidelines for making a Dependency Node (see Dependency Graph (DG) nodes).

You request specific rendering information for your plug-in through pre-defined attributes provided during the rendering process. (See Appendix C: Rendering attributes for a complete list of rendering specific attributes and their corresponding names.)

There are currently five different types of shading nodes that can be created with Maya.

- Surface shaders
- Light shaders
- Texture shaders
- Displacement shaders
- Volumetric shaders

Shading nodes in Maya are connected to form shader networks. Any Maya dependency node can be part of a shader network. Instead of hard-coding many effects into each shader, texture and light, the same functionality is available in Maya through Utility nodes which can implement the same effects and more. In addition, shading nodes can contribute to more than one shading network at a time.

The following example shows Maya’s Hypergraph display of a simple Lambert shading node (highlighted) that has a texture node as an input connected to the Lambert node’s color attribute.

The illustration also shows a placement node connected to the checker texture for transforming texture coordinates. Each arrow denotes an attribute connection between two dependency nodes.

A shading network is not complete until is has been connected to a Shading Group. A Shading Group is a "Renderable Set" which contains a list of objects and/or components of objects which will all be rendered using the same shader network. In addition to its list of objects, the shading group also maintains a connection to a shading network. The shading group is the connection point between objects in the scene, and a shader network which describes how they should be rendered.

The following shows the shader network connected to a shading group (highlighted) and assigned to a default NURBS sphere. Notice the directional light in the scene used for illumination.

As you build a complex shader network with various shading nodes, you can see that the all the connections lead into the Lambert nodes inputs (highlighted) and the computed result of the Lambert shading node’s output is connected to a shading group.