#include <c4d_materialdata.h>
A data class for creating material plugins.
Use RegisterMaterialPlugin() to register a material plugin.
General notes
Here are some general comments on the material API:
Optimization
CalcSurface, CalcVolumetric, ChangeNormal, CalcTransparency and CalcAlpha are the speed critical routines; concentrate efforts optimizing them.
Do not allocate new classes in those routines; only if absolutely necessary! Most of classes can be pre-allocated in InitRender::
Avoid ANY function calls there. For instance to access the global render settings store the pointer in InitRender for later use. This can save a tremendous amount of time.
Additional Inherited Members | |
![]() | |
GeListNode * | private_link |
|
virtual |
Called to draw additional information for the material in the editor. Called for every op/tag pair that references the material.
[in] | mat | The BaseMaterial connected with the MaterialData instance. Equal to static_cast <BaseMaterial*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed material. |
[in] | op | The object associated with the material. Cinema 4D owns the pointed object. |
[in] | tag | The material tag. The caller owns the pointed tag. |
[in] | bd | The editor's view. The caller owns the pointed view. |
[in] | bh | The helper for the editor's view. The caller owns the pointed base draw helper. |
|
virtual |
Called to get information about what the material plugin requires from the raytracer and what it returns.
[in] | mat | The BaseMaterial connected with the MaterialData instance. Equal to static_cast <BaseMaterial*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed material. |
|
virtual |
Called to initialize resources for rendering.
[in] | mat | The BaseMaterial connected with the MaterialData instance. Equal to static_cast <BaseMaterial*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed material. |
[in] | irs | A struct with information about the upcoming rendering. |
|
virtual |
Called to free any resources allocated in InitRender.
[in] | mat | The BaseMaterial connected with the MaterialData instance. Equal to static_cast <BaseMaterial*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed material. |
|
virtual |
Called every time a new series of shader calls is made.
In InitCalculation precalculate values for the following calls. Store the resulting data for each processor (vd->GetCurrentCPU()) separately because InitCalculation may be entered multiple times on a MP thread contexts.
If all the routines are overridden and the flags are set properly Cinema 4D calls them in this order:
Before rendering:
InitCalculation
(INITCALCULATION::DISPLACEMENT)During rendering:
InitCalculation
(INITCALCULATION::SURFACE)During rendering for e.g. shadow rays:
InitCalculation
(INITCALCULATION::TRANSPARENCY)[in] | mat | The BaseMaterial connected with the MaterialData instance. Equal to static_cast <BaseMaterial*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed material. |
[in] | vd | The volume data to use. The caller owns the pointed volume data. |
[in] | type | The upcoming call sequence: INITCALCULATION |
|
virtual |
Called to displace a point on the surface.
Modify vd->p. Usually it elevates the point along its normal a certain extent such as vd->p += vd->dispn * factor
.
Called after the render initialization (InitRender) but during the beginning phase.
[in] | mat | The BaseMaterial connected with the MaterialData instance. Equal to static_cast <BaseMaterial*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed material. |
[in,out] | vd | The volume data to use and modify. The caller owns the pointed volume data. |
|
virtual |
Called to create a bump effect.
Modify vd->bumpn. If VOLUMEINFO::DUDVREQUIRED was set for the material registration then use vd->ddu and vd->ddv as modification directions perpendicular to the face normal.
Called during rendering. See InitCalculation for the order of calls.
[in] | mat | The BaseMaterial connected with the MaterialData instance. Equal to static_cast <BaseMaterial*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed material. |
[in,out] | vd | The volume data to use and modify. The caller owns the pointed volume data. |
|
virtual |
Called to calculate the surface color.
Set vd->col, vd->trans and vd->refl. Also vd->rray and vd->tray (the reflecting and transparent rays) can be modified.
Called during rendering. See InitCalculation for the order of calls.
[in] | mat | The BaseMaterial connected with the MaterialData instance. Equal to static_cast <BaseMaterial*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed material. |
[in,out] | vd | The volume data to use and modify. The caller owns the pointed volume data. |
|
virtual |
Called to speed up the transparency calculation.
Several times Cinema 4D needs the transparency information, for example for fast shadow calculation.
Set vd->trans. Use vd->xlight to find out which light is being evaluated.
If this routine is not supplied then the result will be slower shadow calculations.
Called during rendering. See InitCalculation for the order of calls.
[in] | mat | The BaseMaterial connected with the MaterialData instance. Equal to static_cast <BaseMaterial*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed material. |
[in,out] | vd | The volume data to use and modify. The caller owns the pointed volume data. |
|
virtual |
Called to calculate the alpha.
Set vd->alpha.
[in] | mat | The BaseMaterial connected with the MaterialData instance. Equal to static_cast <BaseMaterial*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed material. |
[in,out] | vd | The volume data to use and modify. The caller owns the pointed volume data. |
|
virtual |
Called to calculate volumetric information.
[in] | mat | The BaseMaterial connected with the MaterialData instance. Equal to static_cast <BaseMaterial*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed material. |
[in,out] | vd | The volume data to use and modify. The caller owns the pointed volume data. |
|
virtual |
Called to return a 2D representation of the material for use in the editor.
The image is shown both in OpenGL and Software mode.
[in] | mat | The BaseMaterial connected with the MaterialData instance. Equal to static_cast <BaseMaterial*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed material. |
[in] | doc | The document. The caller owns the pointed document. |
[in] | th | The thread. The caller owns the pointed thread. |
[in,out] | bmp | The bitmap to fill, initialized to the right size. The caller owns the pointed bitmap. |
[in] | doccolorspace | The document's color space: DOCUMENT_COLORPROFILE |
[in] | linearworkflow | true if Linear Workflow is enabled, otherwise false. |
|
virtual |
To ensure SDK compatibility Private.
|
virtual |
Called to check if the material has editor transparency.