Inheritance diagram for DzShaderMaterial:
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 () |
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().
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.
definitionFile | The relative path [from the /scripts folder] to the DAZ Script that creates this material's property list. |
Boolean DzShaderMaterial::addShader | ( | DzRSLShader | shader | ) |
Adds shader to this material's internal list of shaders and sets shader 's owner to this material.
true
if shader is successfully added to the list (e.g. does not already exist), otherwise false
. String DzShaderMaterial::getDefinitionFile | ( | ) |
DzColorProperty DzShaderMaterial::getDiffuseProperty | ( | ) |
Number DzShaderMaterial::getNumShaders | ( | ) |
DzFloatProperty DzShaderMaterial::getOpacityProperty | ( | ) |
DzRSLShader DzShaderMaterial::getShader | ( | Number | index | ) |
Boolean DzShaderMaterial::needsTangentSpaceParams | ( | ) |
Boolean DzShaderMaterial::removeShader | ( | DzRSLShader | shader | ) |
Removes shader from this material's internal list of shaders.
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.
definitionFile | The relative path [from the /scripts folder] to the DAZ Script that creates this material's property list |
// Set the definition file for the DzShaderMaterial (relative to the scripts folder) oMaterial.setDefinitionFile( "support/DAZ/shaderDefinitions/surface/dzglossy.dsb" );
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"
name | The name to assign to this material |
// 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);
onoff | whether or not this material needs the Tangent Space Params |
//To Turn on the TangentSpaeParams in a surface rslshader's rendertime file: var Material = Shader.getOwner(); Material.setNeedsTangentSpaceParams( true );