 |
 |
 |
Python Computer Graphics Kit |
 |
 |
 |
A material that supports the IMaterial protocol will be mapped
to a surface shader, displacement shader and interior shader. To support
the IMaterial protocol the following methods have to be implemented:
-
Returns a list of RenderPass objects necessary for this material
instance. These passes may be used to create environment maps, for example.
If no extra passes are required an empty list has to be returned.
-
This method is called before the image is rendered and can be used to
create or copy image maps or do other initializations that have to be done
before the actual rendering starts. The exporter instance is provided
as argument to the method (for example, to find out where image maps
are stored).
-
Return the color (as a 3-sequence of floats) for the RiColor()
call. If no color is required the method may return
None in which
case no Color call is made.
-
Return the opacity (as a 3-sequence of floats) for the RiOpacity()
call. If no opacity is required the method may return
None in which
case no Opacity call is made.
-
Return the name of the surface shader for this material. The exporter
may still modify this name to make it unique among all generated
shaders.
-
Return the RenderMan Shading Language source code for the surface shader.
Instead of the shader name the generated source code should contain
the variable
$SHADERNAME that will be substituted with the
actual name of the shader. The method may also return None if
no shader should be created. In this case, the name returned by
surfaceShaderName() is assumed to be the name of an existing shader.
| surfaceShaderParams( |
passes) |
-
Returns a dictionary that contains the shader parameters that should
be used for the surface shader. The key is the name of the parameter
(including inline declarations) and the value is the actual parameter
value at the current time. The passes argument contains the list
of passes as generated by createPasses(). This list can be
used to obtain the actual name of an environment map, for example.
| surfaceShaderTransform( |
) |
-
Return a mat4 containing the transformation that should be applied to
the shader.
| displacementShaderName( |
) |
-
Return the name of the displacement shader for this material. The exporter
may still modify this name to make it unique among all generated
shaders. You can also return
None if no displacement shader is required.
| displacementShaderSource( |
) |
-
Return the RenderMan Shading Language source code for the displacement shader.
Instead of the shader name the generated source code should contain
the variable
$SHADERNAME that will be substituted with the
actual name of the shader. The method may also return None if
no shader should be created. In this case, the name returned by
displacementShaderName() is assumed to be the name of an existing
shader.
| displacementShaderParams( |
passes) |
-
Returns a dictionary that contains the shader parameters that should
be used for the displacement shader. The key is the name of the parameter
(including inline declarations) and the value is the actual parameter
value at the current time. The passes argument contains the list
of passes as generated by createPasses().
| displacementShaderTransform( |
) |
-
Return a mat4 containing the transformation that should be applied to
the shader.
-
Returns a tuple (coordinate system, distance) that specifies the
maximum displacement. The distance is the maximum amount that a
surface point is displaced and is given in the specified coordinate
system.
-
Return the name of the interior shader for this material. The exporter
may still modify this name to make it unique among all generated
shaders. You can also return
None if no interior shader is required.
-
Return the RenderMan Shading Language source code for the interior shader.
Instead of the shader name the generated source code should contain
the variable
$SHADERNAME that will be substituted with the
actual name of the shader. The method may also return None if
no shader should be created. In this case, the name returned by
displacementShaderName() is assumed to be the name of an existing
shader.
| interiorShaderParams( |
passes) |
-
Returns a dictionary that contains the shader parameters that should
be used for the interior shader. The key is the name of the parameter
(including inline declarations) and the value is the actual parameter
value at the current time. The passes argument contains the list
of passes as generated by createPasses().
| interiorShaderTransform( |
) |
-
Return a mat4 containing the transformation that should be applied to
the shader.
Release 2.0.0alpha8, documentation updated on February 24, 2008.