Inheritance diagram for DzRSLShader:
This class provides the ability to define RSL shaders for the elements that can use them (DzShaderMaterial, DzShaderLight, DzShaderCamera).
In the context of Surface shaders, the data members set by these methods are used to identify whether the shader participates during the shadow [map] pass - the pass for each contributing light in the scene that indicates the use of Deep Shadow Maps for shadows. This affords developers a couple of key benifits:
Default Material: | Default Lights: | Default Camera: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
Enumerated values for RSL shader types
DzRSLShader::DzRSLShader | ( | ) |
Default Constructor.
void DzRSLShader::Added | ( | DzProperty | prop | ) |
Signature: "propertyAdded(DzProperty*)"
Transmitted when a property is added to this element
prop | A pointer the the property just added |
Boolean DzRSLShader::addMappableProperty | ( | DzNumericProperty | prop, | |
String | token, | |||
String | mapToken | |||
) |
Adds a mappable numeric property to this shader object. DzColorProperty instances are passed as color type variables to the shader - all other DzNumericProperty derived instances are passed as float type variables. If the property is mapped, the absolute path of the image file is passed as a string type variable to the shader.
prop | The property of which the value is passed to the shader for the param argument | |
token | The name of the argument to the shader that the value of prop is passed to | |
mapToken | The name of the argument to the shader that the path of prop 's map is passed to, if prop is mapped |
true
if prop was successfully added to the list of properties used by this shader (e.g. did not already exist), otherwise false
. Boolean DzRSLShader::addMapProperty | ( | DzNumericProperty | prop, | |
String | mapToken | |||
) |
Adds a mappable numeric property to this shader object (intended for situations where the property itself is passed as an attribute via the render-time script, or simply for display purposes, but the associated map should be passed as an arg to the shader). If the property is mapped, the absolute path of the image file is passed as a string type variable to the shader.
prop | The property of which the map path is passed to the shader for the mapParam argument | |
mapToken | The name of the argument to the shader that the path of prop 's map is passed to, if prop is mapped |
true
if prop was successfully added to the list of properties used by this shader (e.g. did not already exist), otherwise false
. Boolean DzRSLShader::addShaderProperty | ( | DzProperty | prop, | |
String | token | |||
) |
Adds a standard property to the list of properties used by this shader object, and adds the property to this shader object's owner if it does not already exist. DzColorProperty instances are passed as color type variables to the shader - all other DzNumericProperty derived instances are passed as float type variables. DzImageProperty instances are passed as string type variables (the value of which is the absolute path of the image file).
prop | The property of which the value is passed to the shader for the param argument | |
token | The name of the argument to the shader that the value of prop is passed to |
true
if prop was successfully added to the list of properties used by this shader (e.g. did not already exist), otherwise false
. String DzRSLShader::findMapTokenByProperty | ( | DzNumericProperty | prop | ) |
DzProperty DzRSLShader::findProperty | ( | String | name | ) |
DzProperty DzRSLShader::findPropertyByToken | ( | String | token | ) |
String DzRSLShader::findTokenByProperty | ( | DzProperty | prop | ) |
String DzRSLShader::getDefinitionFile | ( | ) |
Number DzRSLShader::getNumProperties | ( | ) |
DzElement DzRSLShader::getOwner | ( | ) |
String DzRSLShader::getRenderTimeFile | ( | ) |
String DzRSLShader::getShaderFile | ( | ) |
ShaderType DzRSLShader::getShaderType | ( | ) |
Boolean DzRSLShader::isActiveInBakePass | ( | ) |
Boolean DzRSLShader::isActiveInBeautyPass | ( | ) |
Boolean DzRSLShader::isActiveInShadowPass | ( | ) |
Boolean DzRSLShader::isOnlyInShadowPass | ( | ) |
void DzRSLShader::ListChanged | ( | ) |
Signature: "propertyListChanged()"
Transmitted when a property is added to or removed from this element
void DzRSLShader::makeBump | ( | String | pic, | |
String | tex, | |||
String | swrap, | |||
String | twrap, | |||
DzRenderOptions::PixelFilter | filter, | |||
Number | swidth, | |||
Number | twidth, | |||
Array | tokens, | |||
Array | params | |||
) |
Convert a bump map into a map in the format required by the renderer.
pic | The path of the source image | |
tex | The path of the resultant image | |
swrap | The wrapping behavior of s coordinate; | |
twrap | The wrapping behavior of t coordinate | |
filter | The pre-defined filter to use | |
swidth | The filter width multiplier for the s direction | |
twidth | The filter width multiplier for the t direction | |
tokens | An Array of additional [String] tokens to set | |
params | An Array of the corresponding basic type to set for each token |
var oRenderMgr = App.getRenderMgr(); var oOptions = oRenderMgr.getRenderOptions(); ... oOptions.Gaussian; ...
void DzRSLShader::makeCubeFaceEnvironment | ( | String | px, | |
String | nx, | |||
String | py, | |||
String | ny, | |||
String | pz, | |||
String | nz, | |||
String | tex, | |||
Number | fov, | |||
DzRenderOptions::PixelFilter | filter, | |||
Number | swidth, | |||
Number | twidth, | |||
Array | tokens, | |||
Array | params | |||
) |
Convert six images representing six viewing directions into an environment map in the format required by the renderer.
px | The path of the image as viewed from the positive x direction | |
nx | The path of the image as viewed from the negative x direction | |
py | The path of the image as viewed from the positive y direction | |
ny | The path of the image as viewed from the negative y direction | |
pz | The path of the image as viewed from the positive z direction | |
nz | The path of the image as viewed from the negative x direction | |
tex | The path of the resultant image | |
fov | The full horizontal field of view used to generate the input images | |
filter | The pre-defined filter to use | |
swidth | The filter width multiplier for the s direction | |
twidth | The filter width multiplier for the t direction | |
tokens | An Array of additional [String] tokens to set | |
params | An Array of the corresponding basic type to set for each token |
var oRenderMgr = App.getRenderMgr(); var oOptions = oRenderMgr.getRenderOptions(); ... oOptions.Gaussian; ...
void DzRSLShader::makeLatLongEnvironment | ( | String | pic, | |
String | tex, | |||
DzRenderOptions::PixelFilter | filter, | |||
Number | swidth, | |||
Number | twidth, | |||
Array | tokens, | |||
Array | params | |||
) |
Convert an image representing a latitude-longitude map into an environment map in the format required by the renderer.
pic | The path of the source image | |
tex | The path of the resultant image | |
filter | The pre-defined filter to use | |
swidth | The filter width multiplier for the s direction | |
twidth | The filter width multiplier for the t direction | |
tokens | An Array of additional [String] tokens to set | |
params | An Array of the corresponding basic type to set for each token |
var oRenderMgr = App.getRenderMgr(); var oOptions = oRenderMgr.getRenderOptions(); ... oOptions.Gaussian; ...
void DzRSLShader::makeTexture | ( | String | pic, | |
String | tex, | |||
String | swrap, | |||
String | twrap, | |||
DzRenderOptions::PixelFilter | filter, | |||
Number | swidth, | |||
Number | twidth, | |||
Array | tokens, | |||
Array | params | |||
) |
Convert an image map into a map in the format required by the renderer.
pic | The path of the source image | |
tex | The path of the resultant image | |
swrap | The wrapping behavior of s coordinate; | |
twrap | The wrapping behavior of t coordinate | |
filter | The pre-defined filter to use | |
swidth | The filter width multiplier for the s direction | |
twidth | The filter width multiplier for the t direction | |
tokens | An Array of additional [String] tokens to set | |
params | An Array of the corresponding basic type to set for each token |
var oRenderMgr = App.getRenderMgr(); var oOptions = oRenderMgr.getRenderOptions(); ... oOptions.Gaussian; ...
void DzRSLShader::Removed | ( | DzProperty | prop | ) |
Signature: "propertyRemoved(DzProperty*)"
Transmitted when a property is removed from this element
prop | A pointer the the property just removed |
Removes the property named name, if it can be found.
name | The name of the property to remove from the shader. |
true
on success, otherwise false
. Boolean DzRSLShader::removeProperty | ( | DzProperty | prop | ) |
Removes the given property, if it can be found.
prop | The property to remove from the shader. |
true
on success, otherwise false
. void DzRSLShader::setActiveInBakePass | ( | Boolean | yesNo | ) |
Sets whether this shader object participates in the baking pass. False by default. If this is set to true, the shader must have a string input variable named "BakeFileName" and another string input variable named "BakeType".
"BakeFileName" will not be set unless it is a baking pass. When set, it will contain the name of the file to bake into.
"BakeType" will be set to one of three values: "Illumination", "Shader", or "IllumShader". They indicate as follows:
void DzRSLShader::setActiveInBeautyPass | ( | Boolean | yesNo | ) |
Sets whether this shader object participates in the beauty/final pass. True by default.
void DzRSLShader::setActiveInShadowPass | ( | Boolean | yesNo | ) |
Sets whether this shader object participates in the shadow pass. False by default.
void DzRSLShader::setColorAttrib | ( | String | attrib, | |
String | token, | |||
Number | r, | |||
Number | g, | |||
Number | b, | |||
Boolean | isFloat = false | |||
) |
Adds a RiAttribute call with a color value.
attrib | The name of the attribute to set | |
token | The name of the token to set | |
r | The value for the red color component | |
g | The value for the green color component | |
b | The value for the blue color component | |
isFloat | A flag for indicating whether or not the values passed to r, g and b are floating point numbers (in the 0-1 range). |
var color = new Color( 210, 210, 210 ); Shader.setColorAttrib( "user", "color myColor", color.red, color.green, color.blue ); ///Shader.setColorAttrib( "user", "color myColor", color.red, color.green, color.blue, false );
Sets the value of a color token in the list of tokens passed to the shader.
token | The name of the token to set | |
val | The color value to set |
Sets the relative path of the [DAZ Script] file that builds this shader object's property list.
definitionFile | The relative path [from the /scripts folder] to the DAZ Script that creates this shader object's property list |
true
if definitionFile is valid, otherwise false
.Shader
- refering to the current DzRSLShader being rendered, exists for the duration of definitionFile. Referencing this variable from outside definitionFile will result in an error.Adds a RiAttribute call with a float value.
attrib | The name of the attribute to set | |
token | The name of the token to set | |
val | The float value to set |
Shader.setFloatAttrib( "user", "float myFloat", 1.0 );
Sets the value of a float token in the list of tokens passed to the shader.
token | The name of the token to set | |
val | The float value to set |
Adds a RiAttribute call with a integer value.
attrib | The name of the attribute to set | |
token | The name of the token to set | |
val | The integer value to set |
Shader.setIntegerAttrib( "user", "integer myInteger", 1 );
Sets the value of an integer token in the list of tokens passed to the shader.
token | The name of the token to set | |
val | The integer value to set |
Adds a RiAttribute call with a matrix value.
attrib | The name of the attribute to set | |
token | The name of the token to set | |
mtx | The matrix value to set |
Shader.setMatrixAttrib( "user", "matrix myMatrix", new DzMatrix4() );
Sets the value of a matrix token in the list of tokens passed to the shader.
token | The name of the token to set | |
mtx | The matrix value to set |
Adds a RiAttribute call with a normal value.
attrib | The name of the attribute to set | |
token | The name of the token to set | |
vec | The normal value (x, y, z) to set |
Shader.setNormalAttrib( "user", "normal myNormal", new DzVec3( 1, 1, 1 ) );
Sets the value of a normal token in the list of tokens passed to the shader.
token | The name of the token to set | |
vec | The normal value (x, y, z) to set |
void DzRSLShader::setOnlyInShadowPass | ( | Boolean | yesNo | ) |
Sets whether this shader object ONLY participates in the shadow pass. False by default. This is the same as calling setActiveInBeautyPass( false ) and setActiveInShadowPass( true ).
Adds a RiAttribute call with a point value.
attrib | The name of the attribute to set | |
token | The name of the token to set | |
vec | The point value (x, y, z) to set |
Shader.setPointAttrib( "user", "point myPoint", new DzVec3( 1, 1, 1 ) );
Sets the value of a point token in the list of tokens passed to the shader.
token | The name of the token to set | |
vec | The point value (x, y, z) to set |
Sets the relative path of the [DAZ Script] file that will be executed at render-time. This script can set attributes as well as shader parameters for the element, and implement custom logic for special effects.
renderTimeFile | The relative path [from the /scripts folder] to the DAZ Script that sets any attributes or shader parameters at render time. |
true
if renderTimeFile is valid, otherwise false
.Shader
- refering to the current DzRSLShader being rendered - exists for the duration of filename. Referencing this variable from outside filename will result in an error. See the Render Time Funtions for a list of special functions only available to this script.Sets the shader file that this shader object calls when rendered
shaderFile | The relative path [from ./shaders/] to the shader that this shader object calls when rendered. The filename is expected to be sans-extension (e.g. "dzplastic", not "dzplastic.sl" or "dzplastic.sdl" ). |
true
if shaderFile , plus the shader extension for the active renderer, is valid, otherwise false
.For Volume shaders the render option "standardatmosphere" is set to 0. See 3Delight documentations for more information on this option and its effect on volume shaders.
Boolean DzRSLShader::setShaderType | ( | ShaderType | shaderType | ) |
Sets the type for this shader object.
var g_oShadObj = new DzRSLShader; g_oShadObj.setShaderType( DzRSLShader.Surface );
Adds a RiAttribute call with a string value.
attrib | The name of the attribute to set | |
token | The name of the token to set | |
val | The string value to set |
Shader.setStringAttrib( "user", "string myString", "foo.bar" );
Sets the value of a string token in the list of tokens passed to the shader.
token | The name of the token to set | |
val | The string value to set |
Adds a RiAttribute call with a vector value.
attrib | The name of the attribute to set | |
token | The name of the token to set | |
vec | The vector value (x, y, z) to set |
Shader.setVectorAttrib( "user", "vector myVector", new DzVec3( 1, 1, 1 ) );
Sets the value of a vector token in the list of tokens passed to the shader.
token | The name of the token to set | |
vec | The vector value (x, y, z) to set |