RenderShaderParameter

Types

TARGET

TYPE

Fields

VSH

PSH

GSH

FREE

VECTOR

VECTOR3

COLOR

FLOAT

BOOL

TEXTURE

MATRIX

REF_EYE_POS_WCS

REF_LIGHT_AMBIENT

REF_LIGHT_POS_VCS

REF_LIGHT_POS_WCS

REF_LIGHT_DIFCOL

REF_LIGHT_SPECOL

REF_LIGHT_RANGE

REF_LIGHT_SIGHT_VCS

REF_LIGHT_SIGHT_WCS

REF_LIGHT_TOP_VCS

REF_LIGHT_TOP_WCS

REF_LIGHT_RIGHT_VCS

REF_LIGHT_RIGHT_WCS

REF_POLYGON_FACING

REF_LIGHT_SHADOW_IMAGE_TEX

REF_LIGHT_SHADOW_ATT_TEX

REF_LIGHT_SPOT_FALLOFF_TEX

REF_LIGHT_BEAM_RADIAL_TEX

REF_LIGHT_PROJECTOR_MATRIX

REF_RAY_STARTING_POS_IMAGE

REF_RAY_ENDING_POS_IMAGE

REF_RAY_REFLECTED_ENDING_POS_IMAGE

REF_RAY_REFRACTED_ENDING_POS_IMAGE

REF_RAY_INCIDENT_DIR_IMAGE

REF_RAY_REFLECTED_DIR_IMAGE

REF_RAY_REFRACTED_DIR_IMAGE

REF_RAY_TRIANGLE_IMAGE

REF_RAY_REFLECTED_TRIANGLE_IMAGE

REF_RAY_REFRACTED_TRIANGLE_IMAGE

REF_RAY_REFLECTION_IMAGE

REF_VRL_CLEAR_COLOR

REF_VRL_CLEAR_DEPTH

REF_VRL_BACKGROUND_CUBE_IMAGE

REF_VRL_BACKGROUND_CUBE_IMAGE_MATRIX

REF_BACK_COLOR_IMAGE

REF_BACK_DEPTH_IMAGE

REF_VRL_DIMENSIONS

REF_VRL_ORIGIN

REF_VRL_ENGINE_ANTI_ALIAS

REF_RAY_FACE_CULL

REF_CAMERA_SIGHT_WCS

REF_CAMERA_TOP_WCS

REF_CAMERA_RIGHT_WCS

REF_SHADOW_MAP_TEX

REF_SHADOW_MAP_FRUSTUM_MATX

REF_INSTANCE_COUNTER_IMAGE

REF_RAY_ENDING_NOR_IMAGE

REF_RAY_WORLD_CACHE_SAMPLE_SPREAD

REF_LIGHT_AREA_SAMPLE_POS

REF_FONT_GLYPH_TEX

REF_FONT_GLYPH_TEX_SIZE

REF_CUTOFF_TEX

RAY_GLOSSY_ANGLE

RAY_GLOSSY_SAMPLES

REF_GLOSSY_JITTER_TEX

REF_GLOSSY_DEVIATION_TEX

REF_GLOSSY_SAMPLE_NUMBER

REF_AUTO_CUBE_MAP

REF_AUTO_CUBE_MAP_CENTER

RAY_GLOSSY_ANGLE_ANISO

REF_EXPONENTIAL_TEX

REF_INSTANCE_COUNTER

REF_GI_CACHE_TEX

REF_VIEWPORT_DIMENSIONS

REF_VIEWPORT_ORIGIN

REF_LIGHT_SKY_IMAGE

REF_LIGHT_SKY_IMAGE_SMOOTH_CUBE

REF_VRL_BACKGROUND_2D_IMAGE

REF_VRL_BACKGROUND_2D_IMAGE_MATRIX

REF_CAMERA_PARAMETER

REF_VRL_VIEW_PROJECTION_VIEWPORT_MATRIX

REF_VRL_MODEL_MATRIX

REF_VRL_MODELVIEW_MATRIX

REF_VRL_MODELVIEW_PROJECTION_MATRIX

REF_VRL_VIEW_MATRIX

REF_VRL_VIEW_PROJECTION_MATRIX

REF_VRL_VIEWPORT_MATRIX

REF_VRL_VIEW_PROJECTION_VIEWPORT_MATRIX_INVERT

REF_VRL_MODEL_MATRIX_INVERT

REF_VRL_MODELVIEW_MATRIX_INVERT

REF_VRL_MODELVIEW_PROJECTION_MATRIX_INVERT

REF_VRL_VIEW_MATRIX_INVERT

REF_VRL_VIEW_PROJECTION_MATRIX_INVERT

REF_VRL_VIEWPORT_MATRIX_INVERT

REF_VRL_PROJECTION_MATRIX

REF_VRL_PROJECTION_MATRIX_INVERT

REF_VRL_BACKGROUND_2D_IMAGE_INTENSITY_SCALE

REF_VRL_BACKGROUND_CUBE_IMAGE_INTENSITY_SCALE

Functions

SET_CID

IMPLEMENT_AS

SET_CHUNK_SIGNATURE

IMPLEMENT_CHUNKINTERPRETER

RenderShaderParameter

RenderShaderParameter

RenderShaderParameter

RED_RC

operator=

~RenderShaderParameter

void

SetValue

void

SetValue

void

SetValue

void

SetValue

void

SetValue

void

SetValue

void

SetImage

void

SetReference

void

SetRayValue

void

SetCameraParameterValue

const String &

GetName

TYPE

GetType

const Object *

GetValue

int

GetCameraParameterValue

TARGET

GetTarget

int

GetBinding

RED_RC

Save

Detailed Description

class RenderShaderParameter : public RED::Object, public RED::IChunkSaver

Variable parameter of a RED::RenderShader.

@related book bk_bm_custom_custom, task tk_adding_shader_parameter, class RED::RenderShader, book bk_ba_viewpoint_level_material_parameters

The RED::RenderShader class uses RED::RenderShaderParameter objects to define its contents and the way the elements are to be rendered. A render shader parameter may be of several types:

A shader parameter is identified through its name string uniquely in the RED::RenderShader it belongs to. It targets one of the three stages of the shader based rendering pipeline:

indicating that way the shader on which it must be bound.

A shader parameter is sent to the corresponding shader stage by its binding position, specified during the construction of the parameter. The binding position is a “program.local” constant number for vectors, colors, matrices and a texture channel number for an image, if we refer to the ARB shader specification.

Shader parameters values are copied from the provided inputs, except for images that are pointed to by their object addresses.

References are scene related parameters: main references are lighting and ray-tracing parameters. One can put references on parameters coming out from a light: its position, color, orientation and whatever else. A reference’s value is calculated purposedly, depending on the rendering configuration found. For example, a mesh that is lit by two different lights will be rendered twice with the light diffuse color, if a reference on a light’s diffuse color is used.

Matrices are bound row by row (with the line major convention for ARB programs and row major convention for GLSL programs) as shader parameter. 4 consecutive constants are used for the parameter binding in ARB.

Ray tracer values are special parameters: they are declared with a specific type (RED::RenderShaderParameter::TYPE::RAY_*) and are used during ray-tracer rendering passes.

Public Types

enum TARGET

Indicates that a given RenderShaderParameter must target the vertex shader program, the geometry shader program or the pixel shader program of a given RED::RenderShader.

Values:

enumerator VSH

Parameter targeting the vertex program.

enumerator PSH

Parameter targeting the pixel program.

enumerator GSH

Parameter targeting the geometry program.

enum TYPE

List all possible types of shader parameters. The FREE value is reserved.

Values:

enumerator FREE
enumerator VECTOR

(x,y,z,w) Program parameter value extracted from a RED::Vector4.

enumerator VECTOR3

(x,y,z,1.0) ARB or (x,y,z) GLSL. Defined by a SetValue call with a RED::Vector3 parameter. The value of the vector3 is stored in a RED::Vector4 and returned as a (x,y,z,1.0f) RED::Vector4 upon access.

enumerator COLOR

(r,g,b,a). Defined by a SetValue call with a RED::Color parameter. Returned as a RED::Color upon access.

enumerator FLOAT

(f,f,f,f) ARB or (f) GLSL. Defined by a SetValue call with a simple float parameter. The value of the float is stored in a RED::Vector4 and returned replicated 4 times for every component of the vector as a RED::Vector4 upon access.

enumerator BOOL

(b,b,b,b) ARB of (b) GLSL. Defined by a SetValue call with a simple bool parameter. The value of the bool is stored as 0.0f (false) or 1.0f (true) and returned as a RED::Vector4 replicated 4 times for every component of the vector.

enumerator TEXTURE

(texture) Program bound texture.

enumerator MATRIX

(matrix) Program parameter value extracted from a RED::Matrix, using the line major convention for ARB shaders and using the row major convention for GLSL shaders.

enumerator REF_EYE_POS_WCS

(x,y,z,w) ARB or (vec4) GLSL. Position of the camera in world space coordinates. The floating origin of the camera is applied to the value sent to the shader.

enumerator REF_LIGHT_AMBIENT

(x,y,z,w) ARB or (vec4) GLSL. Ambient light color.

enumerator REF_LIGHT_POS_VCS

(x,y,z,w) ARB or (vec4) GLSL. Position of the current light source in view space coordinates.

enumerator REF_LIGHT_POS_WCS

(x,y,z,w) ARB or (vec4) GLSL. Position of the current light source in world space coordinates.

enumerator REF_LIGHT_DIFCOL

(x,y,z,w) ARB or (vec4) GLSL. Current light source diffuse color.

enumerator REF_LIGHT_SPECOL

(x,y,z,w) ARB or (vec4) GLSL. Current light source specular color.

enumerator REF_LIGHT_RANGE

(x,y,z,w) ARB or (vec4) GLSL. Current light source effect distance.

x = Light intensity texture ramp pixel size / Light effect distance.

y = 0.0f.

z = Light intensity texture ramp pixel size.

w = Light effect distance.

enumerator REF_LIGHT_SIGHT_VCS

(x,y,z,w) ARB or (vec4) GLSL. Sight vector of the current light source in view space coordinates.

enumerator REF_LIGHT_SIGHT_WCS

(x,y,z,w) ARB or (vec4) GLSL. Sight vector of the current light source in world space coordinates.

enumerator REF_LIGHT_TOP_VCS

(x,y,z,w) ARB or (vec4) GLSL. Top vector of the current light source in view space coordinates.

enumerator REF_LIGHT_TOP_WCS

(x,y,z,w) ARB or (vec4) GLSL. Top vector of the current light source in world space coordinates.

enumerator REF_LIGHT_RIGHT_VCS

(x,y,z,w) ARB or (vec4) GLSL. Right vector of the current light source in view space coordinates.

enumerator REF_LIGHT_RIGHT_WCS

(x,y,z,w) ARB or (vec4) GLSL. Right vector of the current light source in world space coordinates.

enumerator REF_POLYGON_FACING

(x,y,z,w) ARB or (vec4) GLSL. Either (1,1,1,1) or (-1,-1,-1,-1). Whenever a material is declared as surfacic by a RED::StateShader, the polygon facing reference’s value is +1 for the rendering of the first side of an object’s polygons, and -1 for the rendering of the second side of an object’s polygons.

enumerator REF_LIGHT_SHADOW_IMAGE_TEX

(image) Screen space texture sized to the rendered VRL dimensions. This image contains the per pixel shadow intensity to apply for the current rendering pass with the current light.

enumerator REF_LIGHT_SHADOW_ATT_TEX

(image) Intensity ramp for the current light. The size of the ramp is specified on the RED::ILightShape interface, and accessed using the RenderShaderParameter::REF_LIGHT_RANGE reference.

enumerator REF_LIGHT_SPOT_FALLOFF_TEX

(cube image) Cube image containing the directional spot intensity falloff.

enumerator REF_LIGHT_BEAM_RADIAL_TEX

(image) Texture containing the radial intensity falloff for a beam light.

enumerator REF_LIGHT_PROJECTOR_MATRIX

(matrix) Projection matrix to wrap onto the radial texture of a beam light, provided (uv) coordinates in the (right,top) referential of the light source.

enumerator REF_RAY_STARTING_POS_IMAGE

(image) Screen space ray starting positions in indirect lighting. This image does not exist for rays fired from the camera. Ray positions are expressed in world space coordinates.

enumerator REF_RAY_ENDING_POS_IMAGE

(image) Screen space ray ending positions in indirect lighting. This image does not exist for ray fired from the camera. Ray positions are expressed in world space coordinates.

enumerator REF_RAY_REFLECTED_ENDING_POS_IMAGE

(image) Screen space image containing reflected rays ending positions after a ray bounce. Ray positions are expressed in world space coordinates.

enumerator REF_RAY_REFRACTED_ENDING_POS_IMAGE

(image) Screen space image containing refracted rays ending positions after a ray bounce. Ray positions are expressed in world space coordinates.

enumerator REF_RAY_INCIDENT_DIR_IMAGE

(image) Screen space incident ray directions in indirect lighting. This image does not exist for rays fired from the camera. An incident ray will split in reflected and refracted rays whose directions will be REF_RAY_REFLECTED_DIR_IMAGE and REF_RAY_REFRACTED_DIR_IMAGE. Ray directions are expressed in world space coordinates.

enumerator REF_RAY_REFLECTED_DIR_IMAGE

(image) Screen space reflected ray directions in indirect lighting after a ray bounce at our current ray ending position. The texture contains:

  • image.xyz = reflection direction in WCS.

  • image.w = refraction index of the material we’re currently in.

enumerator REF_RAY_REFRACTED_DIR_IMAGE

(image) Screen space refracted ray directions in indirect lighting after a ray bounce at our current ray ending position. The texture contains:

  • image.xyz = refraction direction in WCS.

  • image.w = refraction index of the material we’ll step in after crossing our hit interface.

enumerator REF_RAY_TRIANGLE_IMAGE

(image) Screen space triangle identifiers image used for the shader pixel ownership test, that identify who has been really hit for each pixel. This image does not exist for rays fired from the camera.

enumerator REF_RAY_REFLECTED_TRIANGLE_IMAGE

(image) Screen space triangle identifiers image identifying hit triangles after a reflection bounce at our current ray ending position.

enumerator REF_RAY_REFRACTED_TRIANGLE_IMAGE

(image) Screen space triangle identifiers image identifying hit triangles after a refraction bounce at our current ray ending position.

enumerator REF_RAY_REFLECTION_IMAGE

(image) Screen space image that contains the reflection color that should be applied to reflective objects to complete their lighting.

enumerator REF_VRL_CLEAR_COLOR

(x,y,z,w) ARB or (vec4) GLSL. Value of the VRL clear color.

enumerator REF_VRL_CLEAR_DEPTH

(x,y,z,w) ARB or (vec4) GLSL. Value of the VRL clear depth. x = 0.0;

y = 0.0;

z = clear depth.

w = 1.0;

enumerator REF_VRL_BACKGROUND_CUBE_IMAGE

(imageCUBE) Cube image that may has been specified in the RED::IViewpointRenderList::SetBackgroundImages call.

enumerator REF_VRL_BACKGROUND_CUBE_IMAGE_MATRIX

(matrix) Additional transformation matrix that has been specified in the RED::IViewpointRenderList::SetBackgroundImages call.

enumerator REF_BACK_COLOR_IMAGE

(image) Screen space image of the back buffer color. This image is generated before the startup of each rendering pass (RED::MTL_LIT or RED::MTL_POSTLIT) that is requesting it. The contents of the image is the color of all previous rendering passes before the one asking for it.

enumerator REF_BACK_DEPTH_IMAGE

(image) Screen space image of the back buffer depth. This image is generated before the startup of each rendering pass (RED::MTL_LIT or RED::MTL_POSTLIT) that is requesting it. The contents of the image is the depth of all previous rendering passes before the one asking for it.

enumerator REF_VRL_DIMENSIONS

(x,y,z,w) ARB or (vec4) GLSL. Dimensions of the current VRL we are rendering into. Note that these values are modified by the engine anti-aliasing setting value used by the current VRL. The real VRL size is its pixel size times its engine anti-aliasing setup.

x = 1.0f / VRL pixel width.

y = 1.0f / VRL pixel height.

z = VRL pixel width.

w = VRL pixel height.

enumerator REF_VRL_ORIGIN

(x,y,z,w) ARB or (vec4) GLSL. Origin of the lower left pixel of the VRL we are rendering into. The engine may use many internal tiles to render a single VRL in separate pieces. This reference is to be added to the fragment.position value when the absolute coordinate of a pixel is to be retrieved.

x = VRL x origin.

y = VRL y origin.

z = 0.0f.

w = 0.0f.

enumerator REF_VRL_ENGINE_ANTI_ALIAS

(x,y,z,w) ARB or (vec4) GLSL. Engine anti-aliasing setup for the rendered VRL. This reference value may be used to scale pixel coordinates for screen space related texture sampling.

x = 1.0f / VRL engine anti alias.

y = 1.0f / VRL engine anti alias.

z = VRL engine anti alias.

w = VRL engine anti alias.

enumerator REF_RAY_FACE_CULL

(x,y,z,w) ARB or (vec4) GLSL. Ray tracer reference used to simulate polygon back face culling within the ray-traced shaders. This reference is part of the ray-tracer binding package needed to process indirect lighting workflows.

enumerator REF_CAMERA_SIGHT_WCS

(x,y,z,w) ARB or (vec4) GLSL. Current viewpoint sight vector in world space coordinates. The floating origin of the camera is applied to the value sent to the shader.

enumerator REF_CAMERA_TOP_WCS

(x,y,z,w) ARB or (vec4) GLSL. Current viewpoint top vector in world space coordinates. The floating origin of the camera is applied to the value sent to the shader.

enumerator REF_CAMERA_RIGHT_WCS

(x,y,z,w) ARB or (vec4) GLSL. Current viewpoint right vector in world space coordinates. The floating origin of the camera is applied to the value sent to the shader.

enumerator REF_SHADOW_MAP_TEX

(image) Direct access to the shadow map image of a given light. This reference is only valid for beam and spot lights. The texture has a depth texture setup on NVIDIA GPUs and has no depth texture setup on ATI GPUs.

enumerator REF_SHADOW_MAP_FRUSTUM_MATX

(matrix) World space to device space frustum matrix for the view of the light source for a shadow image. This matrix is for usage with REF_SHADOW_MAP_TEX.

enumerator REF_INSTANCE_COUNTER_IMAGE

(image) This reference associates a user defined image value to each object instance being rendered with a shader that is using the reference. The mapping table between an instance and the reference value is made by RED::IViewpoint::SetInstanceCounterImageCallback.

enumerator REF_RAY_ENDING_NOR_IMAGE

(image) Screen space ray hit points ending normals in indirect lighting. This image does not exist for ray fired from the camera. Ray hit points normals are expressed in world space coordinates.

enumerator REF_RAY_WORLD_CACHE_SAMPLE_SPREAD

(x,y,z,w) Value of the RED::OPTIONS_RAY_WORLD_CACHE_SAMPLE_SPREAD. x = (float)value.

y = 1.0f / (float)value.

z = 0.0f.

w = 1.0f.

enumerator REF_LIGHT_AREA_SAMPLE_POS

(image) This reference is used to bind area sample information for a pixel shader. Refer to the product documentation for details and example usage of this reference.

enumerator REF_FONT_GLYPH_TEX

(image 2D) This reference contains pre-rendered textures for all font characters (glyphs) that are used for a given font that is rendered using textured quads (RED::FNT_TEXTURE

fonts).

This shader reference is not accessible in GLSL. It’s usually accessed through the

RED::RenderShaderText display shader.

enumerator REF_FONT_GLYPH_TEX_SIZE

(x,y,z,w) ARB only. This reference contains the size of the font glyph texture.

z = glyph texture pixel width. w = glyph texture pixel height. x = 1.0f / z. y = 1.0f / w.

enumerator REF_CUTOFF_TEX

(image) This reference contains the per pixel ray attenuation at the currently processed ray tree level. It can only be accessed by a shader in the RED::MTL_RAYTRACE pass that targets one of the possible indirect cutoffs targets:

  • RED_SHAD_TARGET_INDIRECT_REFLECTION_CUTOFF,

  • RED_SHAD_TARGET_INDIRECT_REFRACTION_CUTOFF.

    The next level cutoff should multiply the current level ray attenuation by the cumulated attenuation value stored in this texture.

enumerator RAY_GLOSSY_ANGLE

(RED::Vector4

) Ray tracer parameter value. Defines the spread angle used for the calculations of glossy ray-traced reflections or refractions, depending on the shader target used to register the parameter.

We use the ‘.x’ value of the provided vector that specify the glossiness angle in radians between 0.0f and RED_PI / 2.0f.

enumerator RAY_GLOSSY_SAMPLES

(RED::Vector4

) Ray tracer parameter value. Defines the number of rays that’ll be fired in the cone of glossy reflections or refraction for the shader that is using this parameter. Reflections or refractions are selected based on the shader target used to register the parameter.

We use the ‘.x’ value of the provided vector to define that number of rays being fired. If the value is 0.0f or below, then the ray-tracer automatically selects the number of samples to shoot, based on the RAY_GLOSSY_ANGLE specified by the shader.

enumerator REF_GLOSSY_JITTER_TEX

(image) This reference converts a screen coordinates defined by ‘fragment.position’ into a random number in the [0,2048] range. This reference is only accessible if glossy effects are enabled.

enumerator REF_GLOSSY_DEVIATION_TEX

(image) This reference offsets a ray direction in the glossiness calculation basis. Too long to explain here in detail. Contact us if you need to compute glossiness by yourself. Otherwise, this reference is used by the ray-tracer shaders for all glossiness effects calculations.

enumerator REF_GLOSSY_SAMPLE_NUMBER

(RED::Vector4) Number of the glossy sample being currently rendered. .x = number of the sample. .y = number of the sample / 255.0f. .z = 0.0f. .w = 0.0f.

enumerator REF_AUTO_CUBE_MAP

(image cube) This reference launches the automatic calculation of a cube image that can be then accessed in shader programs. The cube image is calculated for each scene in which the material using this reference is used. The center of the cube image is set to the barycentric coordinates of all points of all objects using the material that is using this reference.

All objects using the reference through their material are discarded for the cube image rendering. Please note that using this reference has a clear impact on rendering performances.

enumerator REF_AUTO_CUBE_MAP_CENTER

(RED::Vector4) This reference is associated to REF_AUTO_CUBE_MAP. It stores the coordinates of the point that has been used to compute the REF_AUTO_CUBE_MAP image. It’s used for example to correct parallax errors for real-time approximated effects. The floating origin of the viewpoint is applied in the resulting matrix.

enumerator RAY_GLOSSY_ANGLE_ANISO

(RED::Vector4) Ray tracer parameter value. This value is similar to the RED::RenderShaderParameter::RAY_GLOSSY_ANGLE except that it defines a second angular value that can be used to define an anisotropic basis for the calculation of glossiness spreading. We use the ‘.x’ value of the provided vector that specify this glossiness angle in radians between 0.0f and RED_PI / 2.0f.

enumerator REF_EXPONENTIAL_TEX

(image RECT) Floating point texture of 2048 x 1 texels. Texel[0] is expf(0.0f); Texel[2047] is expf(-20.0f). This exponent ramp is used as a mathematical built-in exponent table for all shaders that need it.

enumerator REF_INSTANCE_COUNTER

(RED::Vector4) This reference associates a user defined RED::Vector4 value to each object instance being rendered with a shader that is using the reference. The mapping table between an instance and the reference value is made by RED::IViewpoint::SetInstanceCounterCallback.

enumerator REF_GI_CACHE_TEX

(image RECT) Screen space image containing the irradiance cache color that can be used to display a pre-processed global illumination contribution to the scene. See RED::IWindow::FrameDrawingGICache. The RED::RenderShaderAmbient uses this reference for automatic GI replay.

enumerator REF_VIEWPORT_DIMENSIONS

(x,y,z,w) ARB or (vec4) GLSL. Dimensions of the current viewport we are rendering into. These are the dimensions of the viewpoint being rendered as it was anchored inside the VRL hosting it. Note that these values are modified by the engine anti- aliasing setting value used by the current VRL. The real viewport size is its pixel size times the engine anti-aliasing setup for the VRL that contains it.

x = 1.0f / Viewport pixel width.

y = 1.0f / Viewport pixel height.

z = Viewport pixel width.

w = Viewport pixel height.

enumerator REF_VIEWPORT_ORIGIN

(x,y,z,w) ARB or (vec4) GLSL. Origin of the lower left pixel of the viewport we are rendering into. This is the position of the lower left pixel of the viewpoint being rendered as it was anchored inside the VRL hosting it. Note that the engine may use many internal tiles to render a single VRL in separate pieces. The viewport origin is calculated relatively to the current origin of the VRL tile as expressed by the RED::RenderShaderParameter::REF_VRL_ORIGIN

reference. This reference value is to be subtracted from the fragment.position value when the coordinate of a pixel in the viewport are to be retrieved: viewport_coordinates = fragment.position - viewport_origin.

x = Viewport x origin.

y = Viewport y origin.

z = 0.0f.

w = 0.0f.

enumerator REF_LIGHT_SKY_IMAGE

(image RECT) This reference points to the sky texture image that was supplied to the RED::ISkyLightShape::SetSkyTexture method during the construction of a skylight.

enumerator REF_LIGHT_SKY_IMAGE_SMOOTH_CUBE

(image CUBE) This reference is a small cube image being generated from the sky texture of the skylight. This is a downsampled and blurred version of the original sky texture, turned into a cube texture. This is used as a noise reduction technique for the calculation of the diffuse shading of the skylight. This reference is only available on the GPU.

enumerator REF_VRL_BACKGROUND_2D_IMAGE

(imageCUBE) 2D image that may has been specified in the RED::IViewpointRenderList::SetBackgroundImages call.

enumerator REF_VRL_BACKGROUND_2D_IMAGE_MATRIX

(matrix) Additional transformation matrix that has been specified in the RED::IViewpointRenderList::SetBackgroundImages call.

enumerator REF_CAMERA_PARAMETER

(RED::Vector4) This reference stores an integer value in the first coordinate of the vector. The value can be set using RED::RenderShaderParameter::SetCameraParameterValue and retrieved using RED::RenderShaderParameter::GetCameraParameterValue. A camera parameter stores a reference to a parameter registered in a RED::IViewpoint, using RED::IViewpoint::AddRenderShaderParameter.

enumerator REF_VRL_VIEW_PROJECTION_VIEWPORT_MATRIX

(matrix) This reference returns the matrix that can be accessed otherwise using RED::IViewpointRenderList::GetFloatingViewProjectionViewportMatrix, for the current camera in the current VRL. The floating origin of the viewpoint is applied in the resulting matrix.

enumerator REF_VRL_MODEL_MATRIX

(matrix) This reference returns the current matrix corresponding to the matrix set for the currently rendered object. The reference is valid only if the RED::RenderCode of the corresponding shader has enabled the model matrix. This reference is not available in software rendering.

enumerator REF_VRL_MODELVIEW_MATRIX

(matrix) This reference returns the current modelview matrix corresponding to the matrix set for the currently rendered object ( inverse viewing matrix x model matrix ). The reference is valid only if the RED::RenderCode of the corresponding shader has enabled the modelview matrix. The floating origin of the viewpoint is applied in the resulting matrix. This reference is not available in software rendering.

enumerator REF_VRL_MODELVIEW_PROJECTION_MATRIX

(matrix) This reference returns the current modelview projection matrix corresponding to the matrix set for the currently rendered object ( projection x inverse viewing matrix x model matrix ). The reference is valid only if the RED::RenderCode of the corresponding shader has enabled the modelview projection matrix. The floating origin of the viewpoint is applied in the resulting matrix. This reference is not available in software rendering.

enumerator REF_VRL_VIEW_MATRIX

(matrix) This reference returns the current view matrix corresponding to the camera being currently rendered. The floating origin of the viewpoint is applied in the resulting matrix. That reference is not available in software rendering for which the RED::ISoftRenderingContext::GetViewingMatrix can be directly used instead to retrieve the matrix.

enumerator REF_VRL_VIEW_PROJECTION_MATRIX

(matrix) This reference returns the matrix that can be accessed otherwise using RED::IViewpointRenderList::GetFloatingViewProjectionMatrix, for the current camera in the current VRL. The floating origin of the viewpoint is applied in the resulting matrix. That reference is not available in software rendering for which the RED::ISoftRenderingContext::GetViewProjectionMatrix can be directly used instead to retrieve the matrix.

enumerator REF_VRL_VIEWPORT_MATRIX

(matrix) This reference returns the matrix that can be accessed otherwise using RED::IViewpointRenderList::GetViewportMatrix, for the current camera in the current VRL. That reference is not available in software rendering for which the RED::ISoftRenderingContext::GetViewportMatrix can be directly used instead to retrieve the matrix.

enumerator REF_VRL_VIEW_PROJECTION_VIEWPORT_MATRIX_INVERT

(matrix) Inverse of RED::RenderShaderParameter::REF_VRL_VIEW_PROJECTION_VIEWPORT_MATRIX.

enumerator REF_VRL_MODEL_MATRIX_INVERT

(matrix) Inverse of RED::RenderShaderParameter::REF_VRL_MODEL_MATRIX.

enumerator REF_VRL_MODELVIEW_MATRIX_INVERT

(matrix) Inverse of RED::RenderShaderParameter::REF_VRL_MODELVIEW_MATRIX.

enumerator REF_VRL_MODELVIEW_PROJECTION_MATRIX_INVERT

(matrix) Inverse of RED::RenderShaderParameter::REF_VRL_MODELVIEW_PROJECTION_MATRIX.

enumerator REF_VRL_VIEW_MATRIX_INVERT

(matrix) Inverse of RED::RenderShaderParameter::REF_VRL_VIEW_MATRIX.

enumerator REF_VRL_VIEW_PROJECTION_MATRIX_INVERT

(matrix) Inverse of RED::RenderShaderParameter::REF_VRL_VIEW_PROJECTION_MATRIX.

enumerator REF_VRL_VIEWPORT_MATRIX_INVERT

(matrix) Inverse of RED::RenderShaderParameter::REF_VRL_VIEWPORT_MATRIX.

enumerator REF_VRL_PROJECTION_MATRIX

(matrix) This reference returns the matrix that can be accessed otherwise using RED::IViewpoint::GetProjectionMatrix, for the current camera in the current VRL. That reference is not available in software rendering for which the value can be accessed from the camera retrieved from RED::ISoftRayContext::GetCamera.

enumerator REF_VRL_PROJECTION_MATRIX_INVERT

(matrix) Inverse of RED::RenderShaderParameter::REF_VRL_PROJECTION_MATRIX.

enumerator REF_VRL_BACKGROUND_2D_IMAGE_INTENSITY_SCALE

(x,y,z,w) ARB or (vec4) GLSL. Contains the 2D intensity scale value supplied to RED::IViewpointRenderList::SetBackgroundImages.

enumerator REF_VRL_BACKGROUND_CUBE_IMAGE_INTENSITY_SCALE

(x,y,z,w) ARB or (vec4) GLSL. Contains the Cube image intensity scale value supplied to RED::IViewpointRenderList::SetBackgroundImages.

Public Functions

SET_CID(CID_class_REDRenderShaderParameter)
IMPLEMENT_AS()
SET_CHUNK_SIGNATURE (0x00000409)
IMPLEMENT_CHUNKINTERPRETER()
RenderShaderParameter()

RenderShaderParameter default construction method.

Builds a default render shader parameter with no data (RED::RenderShaderParameter::FREE) and an empty string name.

RenderShaderParameter(const RED::String &iName, int iBindingPosition, RED::RenderShaderParameter::TARGET iTarget)

RenderShaderParameter construction method.

Builds the shader parameter whose name is iName, and that targets either the vertex shader, geometry shader or pixel shader stage of the hardware rendering pipeline, according to iTarget.

Parameters
  • iName – Name uniquely identifying the shader parameter in the RED::RenderShader it’ll be added to.

  • iBindingPosition – Binding register or channel for the parameter.

  • iTarget – VSH (vertex) or PSH (pixel), according to the need.

RenderShaderParameter(const RED::RenderShaderParameter &iSource)

RenderShaderParameter copy construction method.

Parameters

iSource – Source of our contents.

RED_RC operator=(const RED::RenderShaderParameter &iSource)

Assignment operator.

Parameters

iSource – Source of our contents.

Returns

RED_OK if the operation has succeeded,

RED_ALLOC_FAILURE if a memory allocation has failed.

virtual ~RenderShaderParameter()

RenderShaderParameter destruction method.

inline void SetValue(const RED::Vector4 &iValue)

Sets the parameter value to a vector.

Parameters

iValueVector value for the parameter.

inline void SetValue(const RED::Vector3 &iValue)

Sets the parameter value to a vector3.

Parameters

iValueVector3 value for the parameter.

inline void SetValue(const RED::Matrix &iValue)

Sets the parameter value to a matrix.

Parameters

iValueMatrix value for the parameter.

inline void SetValue(const RED::Color &iValue)

Sets the parameter value to a color.

Parameters

iValueColor value for the parameter.

inline void SetValue(double iValue)

Sets the parameter value to a double precision floating point value.

Parameters

iValue – Double precision floating point value for the parameter.

inline void SetValue(bool iValue)

Sets the parameter value to a boolean.

The value is turned into 0.0f (false) or 1.0f (true) internally.

Parameters

iValue – Boolean value for the parameter.

inline void SetImage(const RED::Object *iValue)

Sets the parameter value to an image.

Images are not duplicated by the call.

Parameters

iValue – Image address. The provided pointer may be NULL. In this case the texture will be ignored by the rendering.

inline void SetReference(RED::RenderShaderParameter::TYPE iReference)

Sets the contents of the shader parameter to a reference.

Parameters

iReference – The parameter reference identifier.

inline void SetRayValue(RED::RenderShaderParameter::TYPE iReference, const RED::Vector4 &iValue)

Sets the contents of the shader parameter to a ray tracer value.

Parameters
  • iReference – The parameter type identifier.

  • iValue – The associated parameter value.

inline void SetCameraParameterValue(int iIndex)

Sets the contents of the shader parameter to a camera parameter index value.

Parameters

iIndex – The index entry that will be used to lookup the real parameter value in the camera list. A camera parameter value is set using RED::IViewpoint::AddRenderShaderParameter.

inline const RED::String &GetName() const

Gets the name of a shader parameter.

Returns

The shader parameter name.

inline RED::RenderShaderParameter::TYPE GetType() const

Gets the type of a shader parameter.

Returns

The shader parameter type.

inline const RED::Object *GetValue() const

Gets the value of the shader parameter.

The returned parameter should not be modified.

Returns

The value of the shader. The method may return NULL if the shader parameter has no value.

inline int GetCameraParameterValue() const

Gets the index of a parameter set as a RED::RenderShaderParameter::REF_CAMERA_PARAMETER.

Returns

The index value stored in the parameter. -1 is returned if the parameter is not a RED::RenderShaderParameter::REF_CAMERA_PARAMETER reference. A camera parameter value is set using RED::IViewpoint::AddRenderShaderParameter.

inline RED::RenderShaderParameter::TARGET GetTarget() const

Gets the current target of the shader parameter.

Returns

The shader stage targeted by the shader parameter.

inline int GetBinding() const

Gets the binding position of the shader parameter.

Returns

The (int) register position / channel where to bind the parameter.

virtual RED_RC Save(RED::IStream *iStream, RED::StreamingPolicy &iPolicy, int iState = -1) const

Saves the object content as one or more chunks in the given stream.

Parameters
  • iStream – Pointer to the stream where the data must be saved.

  • iPolicy – Reference to the streaming policy to be used.

  • iState – Optional state number parameter at which the data to be saved must be retrieved. Default is set to 0 (for current state).

Returns

RED_OK on success,

RED_FILE_WRITE_ERROR on a file write error (if iStream is a file stream),

RED_ALLOC_FAILURE on a memory allocation error,

RED_FAIL otherwise.