RayGIRefractionColorShader

Detailed Description

class RayGIRefractionColorShader : public RED::RenderShader

Built-in Global Illumination shader for refraction color calculations.

@related Using Built-in Render Shaders, class RED::IMaterial, class RED::RenderShader, class RED::StateShader, class RED::RenderCode

This shader matches the standard refraction setup of a material. It uses an opacity color / texture and an optional Fresnel term to equilibrate the amount of energy that is reflected / transmitted. Values produced by this shader are used for global illumination calculations.

This shader is intended for use in the RED::MTL_RAYTRACE rendering pass.

This shader has one configuration:

See the REDRayGIRefractionColorShader.h file documentation for the list of all #define statements used to name all parameters of this shader.

Public Functions

SET_CID(CID_class_REDRayGIRefractionColorShader)
IMPLEMENT_AS()
RayGIRefractionColorShader(const RED::Color &iOpacityColor, const RED::Object *iOpacityTexture, const RED::Matrix &iOpacityMatrix, RED::MESH_CHANNEL iOpacityUV, float iIOR, const RED::Object *iFresnel, RED::Object *iResMgr, RED_RC &oErrorCode)

RayGIRefractionColorShader construction method.

Parameters:
  • iOpacityColor – Opacity color.
  • iOpacityTexture – Opacity texture. Overrides the color when set.
  • iOpacityMatrix – Texture matrix applied to iOpacityTexture.
  • iOpacityUV – Mesh UV channel to use to sample iOpacityTexture.
  • iIOR – Index of refraction (IOR) of the material.
  • iFresnel – Must be NULL or a valid composite image. The ‘.xyz’ value of the image returns the opacity to consider as the transmission color. RED::IImageComposite::Fresnel is a possible valid composite image for this shader.
  • iResMgr – The cluster’s resource manager.
  • oErrorCode – Indicates a construction failure when not returned set to RED_OK.
~RayGIRefractionColorShader()

RayGIRefractionColorShader destruction method.

Public Static Functions

static RED_RC LoadProgram(RED::String &oString, const RED::ShaderProgramID &iID)

Loads a shader program.

Generates a shader program that corresponds to the specified iID.

Parameters:
  • oString – The created program string.
  • iID – The shader program unique ID.
Returns:

RED_OK if the shader could be loaded,

RED_ALLOC_FAILURE if an allocation has failed,

RED_FAIL otherwise.

static RED_RC EvaluateFromInputParameters(RED::RenderShader *ioShader, RED::Object *iResMgr)

Evaluate a shader from its input parameters.

Parameters:
  • ioShaderShader to redefine using its own input parameters.
  • iResMgr – The cluster’s resource manager.
Returns:

RED_OK if the operation has succeeded,

RED_BAD_PARAM if iShader was not valid,

RED_BAD_PARAM if an invalid parameter was found during the evaluation,

RED_ALLOC_FAILURE if a memory allocation has failed,

Other RED_RC related to shader creation can be returned.