DzShaderMaterial Class Reference
[Custom RSL Objects]

Custom scriptable class for materials using RenderMan® Shader Language (RSL) Shaders. More...

Inheritance diagram for DzShaderMaterial:

DzMaterial DzElement DzRefCountedItem DzBase QObject Object List of all members.

Methods

Boolean addShader (DzRSLShader shader)
String getDefinitionFile ()
DzColorProperty getDiffuseProperty ()
Number getNumShaders ()
DzFloatProperty getOpacityProperty ()
DzRSLShader getShader (Number index)
Boolean needsTangentSpaceParams ()
Boolean removeShader (DzRSLShader shader)
void setDefinitionFile (String definitionFile)
void setMaterialName (String name)
void setNeedsTangentSpaceParams (Boolean onoff)

Constructors

 DzShaderMaterial (String definitionFile)
 DzShaderMaterial ()

Detailed Description

Custom scriptable class for materials using RenderMan® Shader Language (RSL) Shaders.

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:


Constructor & Destructor Documentation

DzShaderMaterial::DzShaderMaterial (  ) 

Default Constructor.

DzShaderMaterial::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.

Parameters:
definitionFile The relative path [from the /scripts folder] to the DAZ Script that creates this material's property list.
See also:
setDefinitionFile()


Member Function Documentation

Boolean DzShaderMaterial::addShader ( DzRSLShader  shader  ) 

Adds shader to this material's internal list of shaders and sets shader 's owner to this material.

Returns:
true if shader is successfully added to the list (e.g. does not already exist), otherwise false.

String DzShaderMaterial::getDefinitionFile (  ) 

Returns:
The relative path [from the /scripts folder] to the DAZ Script that creates this material's property list.

DzColorProperty DzShaderMaterial::getDiffuseProperty (  ) 

Returns:
The Diffuse Color property of this material

Number DzShaderMaterial::getNumShaders (  ) 

Returns:
The number of DzRSLShaders on this material

DzFloatProperty DzShaderMaterial::getOpacityProperty (  ) 

Returns:
The Opacity property of this material

DzRSLShader DzShaderMaterial::getShader ( Number  index  ) 

Returns:
The DzRSLShader at index.

Boolean DzShaderMaterial::needsTangentSpaceParams (  ) 

Returns:
If this shader needs the special tangent space params when its rendered. False by default

Boolean DzShaderMaterial::removeShader ( DzRSLShader  shader  ) 

Removes shader from this material's internal list of shaders.

Returns:
true if shader is successfully removed from the list, otherwise false.

void DzShaderMaterial::setDefinitionFile ( String  definitionFile  ) 

Sets the relative path of the [DAZ Script] file that builds this material's property list.

Parameters:
definitionFile The relative path [from the /scripts folder] to the DAZ Script that creates this material's property list
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:
definitionFile is executed the moment the call to this method is made. A global transient variable named 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 DzShaderMaterial::setMaterialName ( String  name  ) 

Sets the name of the material type that will be returned by getMaterialName(). By default, this is "Custom"

Parameters:
name The name to assign to this material
Example:
        // Set the name of the material
        // (the label displayed to the user in the Surfaces tab when the surface is selected)
        Material.setMaterialName( "DAZ Studio Glossy Plastic" );

void DzShaderMaterial::setNeedsTangentSpaceParams ( Boolean  onoff  ) 

Sets that this material needs the special 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 rendertime file, it is not persistent between studio sessions. It is false by default.

Parameters:
onoff whether or not this material needs the Tangent Space Params
Example:
        //To Turn on the TangentSpaeParams in a surface rslshader's rendertime file:
        var Material = Shader.getOwner();
        Material.setNeedsTangentSpaceParams( true );


Generated on Thu Sep 24 12:21:15 2009

Copyright © 2002 - 2009 DAZ 3D, Inc.