API Guide > Writing a Software Shading Node >

# SuperSampling within shading nodes

As explained previously, you can request specific rendering information regarding the current sample position 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.) However, it is sometimes desirable to describe a hypothetical position and force a shading network evaluation to sample this hypothetical position. Some applications of this technique are bump mapping, and filtering (antialiasing).

A shading node can mark attributes as "render sources" through the API call MFnAttribute::setRenderSource. If the shadingNode then sets the values of the one of these attributes, subsequent calls to request data from the datablock will force the shading network to reevaluate.

The devkit contains an example plug-in, shiftNode.cpp, that demonstrates modifying uvCoord and refPointCamera from within a texture plug-in. The uvCoord and refPointCamera are marked as "renderSource" attributes. The uvCoord and refPointCamera for the current sample position are requested and then subsequently shifted four times. Each time these attributes are modified, the inColor attribute is requested, and because the attributes are render sources, the request for inColor forces a shading evaluation. Thus the 2D or 3D texture connected to inColor will be evaluated four additional times for every point shaded. The inColor values are averaged which produces a blurred result.