c4d.plugins.ShaderData

New in version R13.029.

A data class for creating shader (channel shader) plugins. Use RegisterShaderPlugin() to register the plugin. A registered shader will appear in the popup menu of the channels in the Materials Manager in CINEMA 4D.

Here are some general comments on the shader API:

  • Coordinate Systems: if there is no further note all elements like points, normals etc. then they are always given in global coordinates.
  • Angle Systems: all angle values are always given in radians. Use Deg (angle) for conversion if needed.
  • Vectors: all normals and ray vectors must be normalized. Also, all normals and ray vectors you recieve from CINEMA 4D are normalized.

See also

Py-Fresnel plugin example.

Inheritance

Members

ShaderData.InitRender(sh, irs)

Override - Precalculate any data for rendering.

Parameters:
  • sh (BaseShader) – The shader node connected with this instance.
  • irs (InitRenderStruct) – Information about the upcoming rendering.
Return type:

long

Returns:

Result of the initialisation:

INITRENDERRESULT_OK

No error.

INITRENDERRESULT_OUTOFMEMORY

Not enough memory.

INITRENDERRESULT_ASSETMISSING

Assets (textures etc.) are missing.

INITRENDERRESULT_UNKNOWNERROR

Unknown error.

INITRENDERRESULT_THREADEDLOCK

Thread lock.

ShaderData.FreeRender(sh)

Override - Free any resources used for the precalculated data from InitRender().

Parameters: sh (BaseShader) – The shader node connected with this instance.
ShaderData.Output(sh, cd)

Override - Called for each point of the visible surface of a shaded object. Here you should calculate and return the channel color for the point cd.p.

Important: No OS calls are allowed during this function. Doing so could cause a crash, since it can be called in a multi-processor context.

Parameters:
  • sh (BaseShader) – The shader node connected with this instance.
  • cd (ChannelData) – Channel data to use and/or modify.
Return type:

Vector

Returns:

The calculated color.

ShaderData.SetExceptionColor(col)

New in version R13.029.

Set the exception color.

Parameters: col (Vector <c4d.Vector>) – The exception color.

Table Of Contents