Custom scriptable class for materials using RenderMan Shader Language (RSL) Shaders.
Inherits :
DAZ Script |
---|
DzShaderMaterial () |
DzShaderMaterial ( DzShaderMaterial mat, Boolean duplicateMissingProps=true ) |
DzShaderMaterial ( String definitionFile ) |
DAZ Script | |
---|---|
Boolean | addShader ( DzRSLShader shader ) |
String | getDefinitionFile () |
DzColorProperty | getDiffuseProperty () |
Number | getNumShaders () |
DzFloatProperty | getOpacityProperty () |
DzRSLShader | getShader ( Number index ) |
Boolean | removeShader ( DzRSLShader shader ) |
void | setDefinitionFile ( String definitionFile, Boolean doOverride=false, Boolean runScript=true ) |
void | setMaterialName ( String name ) |
void | setNeedsTangentSpaceParams ( Boolean onoff ) |
This class provides a DzMaterial derived object with creator-defined properties that will be passed to the RSL Shader at render-time. By default, the material only has two properties - Diffuse Color (Cs) and Opacity Strength (Os) - which are not passed as tokens to the shader, rather they are attributes sent directly to the renderer, via RiColor() and RiOpacity() respectively. These properties are not mappable by default, but can be made so by using DzRSLShader::addMapProperty(). All other properties for the material must be added using DzRSLShader::addShaderProperty() and DzRSLShader::addMappableProperty() in order to be used to pass values as arguments to the shader. Properties for the material that will be used by the render-time scripts to set attributes must be added via DzElement::addProperty().
Samples:
See Also:
Default Constructor.
DzShaderMaterial( DzShaderMaterial mat, Boolean duplicateMissingProps=true )
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Parameter(s):
See Also:
DzShaderMaterial( String definitionFile )
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Parameter(s):
See Also:
Boolean : addShader( DzRSLShader shader )
Adds shader to this material's internal list of shaders and sets shader 's owner to this material.
Return Value:
true
if shader is successfully added to the list (e.g. does not already exist), otherwise false
.Return Value:
DzColorProperty : getDiffuseProperty()
Return Value:
Number : getNumShaders()
Return Value:
DzFloatProperty : getOpacityProperty()
Return Value:
DzRSLShader : getShader( Number index )
Return Value:
Boolean : removeShader( DzRSLShader shader )
Removes shader from this material's internal list of shaders.
Return Value:
true
if shader is successfully removed from the list, otherwise false
.void : setDefinitionFile( String definitionFile, Boolean doOverride=false, Boolean runScript=true )
Sets the relative path of the [DAZ Script] file that defines this material.
Parameter(s):
Example:
In a nested folder [./scripts/support/DAZ/shaderDefinitions/surface]
// Set the definition file for the DzShaderMaterial (relative to the scripts folder) oMaterial.setDefinitionFile( "support/DAZ/shaderDefinitions/surface/dzglossy.dsb" );
Attention:
Material
- refering to the current DzShaderMaterial being rendered, exists for the duration of definitionFile. Referencing this variable from outside definitionFile will result in an error.void : setMaterialName( String name )
Sets the name of the material type that will be returned by getMaterialName(). By default, this is “Custom”
Parameter(s):
Example:
// Set the name of the material // (the label displayed to the user in the Surfaces pane when the surface is selected) Material.setMaterialName( "DAZ Studio Glossy Plastic" );
void : setNeedsTangentSpaceParams( Boolean onoff )
Sets whether this material needs the Tangent Space Params: varying vector dPds and varying float dPdsM. dPds is the tangent vector along the surface. dPdsM is the handedness of the bitangent vector on the surface. The bitangent can be reconstructed using:
vector B = normalize (((normalize(N) ^ normalize(dPds))*dPdsM);
This should be turned off/on in the script handed to DzRSLShader::setRenderTimeFile(). It is not persistent between sessions. It is false by default.
Parameter(s):
Example:
// Turn on the TangentSpaeParams, from within in a surface DzRSLShader's rendertime file: var Material = Shader.getOwner(); Material.setNeedsTangentSpaceParams( true );