VolumeData Struct Reference

#include <c4d_tools.h>

Inheritance diagram for VolumeData:

公共成员函数

void  CalcArea (const RayLight *light, Bool nodiffuse, Bool nospecular, Float specular_exponent, const Vector64 &ray_vector, const Vector64 & p , const Vector64 & bumpn , const Vector64 & orign , RAYBIT raybits , Bool ignoreLightColor, 向量 *diffuse, 向量 *specular)
向量   CalcShadow (const RayLight *l, const Vector64 & p , const Vector64 & bumpn , const Vector64 &phongn, const Vector64 & orign , const Vector64 &rayv, Bool transparency, const RayHitID &hitid, RAYBIT raybits )
Bool   IlluminateSurfacePoint (const RayLight *rl, 向量 * col , Vector64 *light_vector, const Vector64 & p , const Vector64 & bumpn , const Vector64 &phongn, const Vector64 & orign , const Vector64 &ray_vector, ILLUMINATEFLAGS flags, const RayHitID &hitid, RAYBIT raybits , Bool cosine_cutoff)
Bool   IlluminateAnyPoint (const RayLight *rl, 向量 * col , Vector64 *light_vector, const Vector64 & p , ILLUMINATEFLAGS flags, RAYBIT raybits )
void  IlluminanceSurfacePoint ( IlluminanceSurfacePointData *f, 向量 *diffuse, 向量 *specular)
向量   IlluminanceAnyPoint (const Vector64 & p , ILLUMINATEFLAGS flags, RAYBIT raybits )
void  IlluminanceSimple ( 向量 *diffuse, 向量 *specular, Float exponent, IlluminationModel *model, void *data)
Int32   GetCurrentCPU () const
Int32   GetCPUCount () const
Int32   Obj_to_Num (const RayObject *obj) const
const RayObject GetObj ( Int32 index) const
Int32   GetObjCount () const
void  GetUVW (const RayObject * op , Int32 uvwind, Int32 local_id, PolyVector * uvw ) const
void  GetNormals (const RayObject * op , Int32 local_id, PolyVector *norm) const
TexData GetTexData (const RayObject * op , Int32 index) const
Vector64   GetNormal (const RayObject * op , Int32 polygon, Bool second) const
Int32   GetRayPolyState (const RayObject * op , Int32 local_id) const
Int32 GetUniqueID (const RayObject * op , Int32 &length) const
Vector64   GetSmoothedNormal (const RayHitID &hitid, const Vector64 & p ) const
Bool   GetRS (const RayHitID &hitid, const Vector64 & p , Float *r, Float *s) const
void  GetWeights (const RayHitID &hitid, const Vector64 & p , RayPolyWeight *wgt) const
const RayLight GetLight ( Int32 index) const
Int32   GetLightCount () const
Int32   Light_to_Num (const RayLight *light) const
const void *  GetRayData ( Int32 i) const
const RayCamera GetRayCamera () const
const RayParameter GetRayParameter () const
const RayEnvironment GetRayEnvironment () const
const RayObject GetRaySky () const
const RayObject GetRayForeground () const
const RayObject GetRayBackground () const
void  GetRay ( Float x, Float y, Ray * ray ) const
Vector64   ScreenToCamera (const Vector64 & p ) const
Vector64   CameraToScreen (const Vector64 & p ) const
向量   CalcHardShadow (const Vector64 &p1, const Vector64 &p2, CALCHARDSHADOW flags, const RayHitID &last_hit, Int32 recursion_id =0, void * recursion_data =nullptr)
向量   GetPointUVW (const TexData *tdp, const RayHitID &hit, const Vector64 & p ) const
Bool   ProjectPoint (const TexData *tdp, const RayHitID &hit, const Vector64 & p , const Vector64 & n , 向量 *uv) const
void  StatusSetText (const maxon::String &str) const
void  StatusSetBar ( Float percentage) const
void  StatusSetSpinMode ( Bool on) const
向量   CalcVisibleLight (const Ray * ray , Float maxdist, 向量 * trans ) const
void  GetXY ( Int32 *x, Int32 *y, Int32 *scale) const
void  SetXY ( Float x, Float y)
MinMax   GetSceneBoundaries () const
void  CopyTo ( VolumeData *dst) const
void  Init ( VolumeData *from)
void  OutOfMemory ()
Bool   CalcFgBg ( Bool foreground, Int32 x, Int32 y, Int32 subx, Int32 suby, 向量 *color, Float * alpha ) const
Float   GetLightFalloff ( Int32 falloff, Float inner, Float outer, Float dist ) const
Bool   TestBreak ()
BaseVideoPost GetVideoPost ( Int32 nth) const
BaseVideoPost FindVideoPost ( Int32 id) const
const VPFragment **  GetFragments ( Int32 x, Int32 y, Int32 cnt, VPGETFRAGMENTS flags) const
Bool   AddLensGlow (const LensGlowStruct *lgs, 向量 *lgs_pos, Int32 lgs_cnt, Float intensity, Bool linear_workflow) const
Bool   SampleLensFX (const VPBuffer *rgba, const VPBuffer *fx, BaseThread *bt) const
Int32   TranslateObjIndex ( Int32 index, Bool old_to_new) const
Bool   TranslatePolygon (const RayObject * op , Int32 local_index, 向量 *previous_points) const
向量   TraceColor ( Ray * ray , Float maxdist, const RayHitID &last_hit, SurfaceIntersection *si)
向量   TraceColorDirect ( Ray * ray , Float maxdist, Int32 raydepth , RAYBIT raybits , const RayHitID &last_hit, Vector64 *oldray, SurfaceIntersection *si)
Bool   TraceGeometry (const Ray * ray , Float maxdist, const RayHitID &last_hit, SurfaceIntersection *si) const
Bool   TraceGeometryEnhanced (const Ray * ray , Float maxdist, const RayHitID &last_hit, Int32 raydepth , RAYBIT raybits , Vector64 *oldray, SurfaceIntersection *si) const
void  GetSurfaceData ( SurfaceData *cd, Bool calc_illum , Bool calc_shadow , Bool calc_refl , Bool calc_trans , Ray * ray , const SurfaceIntersection &si)
向量   CentralDisplacePointUV (const RayObject * op , Int32 local_id, Int32 uu, Int32 vv) const
向量   CentralDisplacePointFromUVPoint (const RayObject * op , Int32 local_id, Bool bFirst, Float l1, Float l2, const 向量 &uv, const UVWStruct & uvw ) const
向量   CalcDisplacementNormals ( Float par_u , Float par_v , Int32 u0, Int32 v0, Int32 u1, Int32 v1, Int32 u2, Int32 v2, const 向量 &a, const 向量 &b, const 向量 &c, const RayObject * op , Int32 polynum) const
向量   CentralDisplaceUVGetNormal (const RayObject * op , Int32 local_id, Int32 uu, Int32 vv) const
向量   CentralDisplaceGetSurfaceNormalFromUVPoint (const RayObject * op , Int32 local_id, Bool bFirst, Float par_u , Float par_v , const 向量 &uv, const UVWStruct & uvw ) const
向量   CentralDisplaceGetShadingNormalFromUVPoint (const RayObject * op , Int32 local_id, Bool bFirst, Float par_u , Float par_v , const 向量 &uv, const UVWStruct & uvw ) const
Bool   CentralDisplacePointUVGetBarycentric (const RayObject * op , Int32 &local_id, Int32 &uu, Int32 &vv, RayPolyWeight &bary, Bool &displaceQuad) const
Bool   GetDisplaceInfo (const RayObject * op , DisplaceInfo &info) const
Int32   GetDisplaceNeighbor (const RayObject * op , Int32 local_id, Int32 side) const
void  CorrectLocalID (const RayObject * op , Int32 &local_id) const
向量   CalcBackTransformPoint () const
Matrix64   CalcMotionObjectMatrixInv (const RayObject * op ) const
void  SkipRenderProcess ()
const 渲染 GetRenderInstance () const
void  GetDUDV (const TexData * tex , const Vector64 & p , const Vector64 &phongn, const Vector64 & orign , const RayHitID &hit, Bool forceuvw, 向量 * ddu , 向量 * ddv , Bool usetangents, const RayPolyWeight *weight) const
void  GetDUDVFromUVPoint (const RayObject * op , const TexData * tex , Float par_u , Float par_v , const Vector64 &uv, const Vector64 & p , const Vector64 &phongn, const Vector64 & orign , const UVWStruct & uvw , RayHitID &hit, Bool forceuvw, 向量 * ddu , 向量 * ddv , Bool usetangents)
void  InitSurfacePointProperties ( TexData *td)
Bool   AttachVolumeDataFake ( BaseObject *camera, const BaseContainer &renderdata)
Bool   HasVolumeDataFake () const
Bool   SaveShaderStack ( RayShaderStackElement *&stack, Int32 &stack_cnt)
Bool   RestoreShaderStack ( RayShaderStackElement *stack, Int32 stack_cnt)
const RayObject GetRaySky ( Int32 index) const
Int32   GetRaySkyCount () const
RaySampler GetRaySampler (void *guid, Int32 depth)
Float   GetRayWeight () const
Float   CalcAmbientOcclusion ( SurfaceIntersection *si, RaySampler *sampler, Float minlength, Float maxlength, Float index, Bool self, Bool trans , Float weight, Bool reverse)
向量   CalcSubsurfaceScattering ( 向量 scattering, 向量 absorption, 向量 diffuse, Float ior)
Int32   GetStreamCount () const
void  GetStreamRay ( Int32 stream, Float x, Float y, Ray * ray ) const
Bool   CalcIndirectIllumination ( RayHemisphere *hs, Float weight)
Bool   CalcIndirectPDF (const 向量 &point, const 向量 &normal, const 向量 &ray_in, const 向量 &ray_out, Float &pdf_qmc, Float &pdf_area, Float &pdf_portal, Float &pdf_sky)
Bool   CalcIndirectPath ( VolumeData *sd, const 向量 &dir, void *source, void *target)
RayRadianceObject CreateRadianceMaps ()
RayRadianceObject GetRadianceMaps ()
向量   CalcRadianceValue ( Ray * ray , const SurfaceIntersection &si)
向量   CalcRadiancePoly ( RayRadianceObject *obj, SurfaceIntersection *si, Int32 poly, Int32 u, Int32 v, Bool back)
Bool   IsPhysicalRender () const
Float   GetPhysicalCameraIntensity () const
void  SetPhysicalRayTime ( Float time )
const RayMotionObject GetMotionObject ( RayObject * op )
const RayMotionLight GetMotionLight ( RayLight *light)
const RayMotionCamera GetMotionCamera ( Int32 stream)
Bool   GetTile ( Int32 &xMin, Int32 &yMin, Int32 &xMax, Int32 &yMax, Int32 &renderThreadIndex) const

私有成员函数

  VolumeData ()
  ~VolumeData ()

Alloc/Free

static VolumeData Alloc (void)
static void  Free ( VolumeData *&vd)

Additional Inherited Members

-  Public Attributes inherited from BaseVolumeData
Int32   version
Int32   fps
向量   ambient
Float   time
向量   col
向量   trans
向量   refl
Float   alpha
Ray tray
Ray rray
Vector64   p
Vector64   bumpn
Ray ray
Vector64   orign
Vector64   n
Vector64   dispn
Float64   dist
Float64   cosc
向量   uvw
向量   delta
RayHitID   lhit
const TexData tex
向量   ddu
向量   ddv
Int32   raydepth
Int32   calc_trans
Int32   calc_refl
Bool   calc_shadow
Int32   calc_illum
Int32   calc_mip
向量   pp [3]
向量   nn [3]
RAYBIT   raybits
const RayLight xlight
const RayObject op
Int32   recursion_id
void *  recursion_data
Multipass multipass
向量   back_p
向量   back_delta
Float   global_mip
Int32   sid
Float   par_u
Float   par_v
SurfaceIntersection intersection
Float   mb_offset
向量   comp_color
向量   comp_specular
向量   comp_luminance
TexEntry *  rtex [4]
Int32   rtex_count
Int32   elementIndex
const RayPolyWeight displacementWeight
-  Protected Member Functions inherited from BaseVolumeData
  BaseVolumeData ()

构造函数 & 析构函数文档编制

◆  VolumeData()

VolumeData () private

◆  ~VolumeData()

~ VolumeData () private

成员函数文档编制

◆  Alloc()

static VolumeData * Alloc ( void  )
static

Allocates a volume data. Destroy the allocated volume data with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

警告
Should normally not be used.
返回
The allocated volume data, or nullptr if the allocation failed.

◆  Free()

static void Free ( VolumeData *&  vd )
static

Destructs volume data allocated with Alloc() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

参数
[in,out] vd The volume data to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆  CalcArea()

void CalcArea ( const RayLight light ,
Bool   nodiffuse ,
Bool   nospecular ,
Float   specular_exponent ,
const Vector64 ray_vector ,
const Vector64 p ,
const Vector64 bumpn ,
const Vector64 orign ,
RAYBIT   raybits ,
Bool   ignoreLightColor ,
向量 diffuse ,
向量 specular  
)

If you code custom illumination models (e.g. different specular function) you can do this for standard light sources easily.
For area lights you will usually want to fall back to the default illumination model though, as otherwise you would have to rebuild the sample code of area lights!
Here is an example how to sample area lights using this method:

for (i=sd-> GetLightCount ()-1; i>=0; i--) { lp = sd-> GetLight (i); if (!sd-> IlluminateSurfacePoint (lp,& col ,&lv,sd-> p ,sd-> bumpn ,sd-> n ,sd-> orign ,SV(sd-> ray -> v ),sd-> calc_shadow ,sd-> lhit ,sd-> raybits , true )) continue ; if (lp->ambient) { *diffuse += col ; continue ; } nodif = nospec = false ; if (lp->lr.object) CalcRestrictionInc (&lp->lr,sd-> op ,nodif,nospec); if (lp->type== RT_LT_AREA ) { 向量 dif,spc; sd-> CalcArea (lp,nodif,nospec,exponent,SV(sd-> ray -> v ),sd-> p ,sd-> bumpn ,sd-> orign ,sd-> raybits ,&dif,&spc); *diffuse += dif^ col ; *specular += spc^ col ; } else { cosa=lv*sd-> bumpn ; if (!(lp->nodiffuse || nodif) && sd-> cosc *cosa>=0.0) { if (lp->contrast!=0.0) *diffuse += Pow ( Abs (cosa), Exp (-lp->contrast))* col ; else *diffuse += Abs (cosa)* col ; } if (calc_specular && !(lp->nospecular || nospec)) { cosb=SV(sd-> ray -> v ) * (lv - sd-> bumpn *(2.0 * cosa)); if (cosb<=0.0) continue ; *specular += Pow (cosb,exponent)* col ; } } } diffuse. ClampMin (); // there can be subtractive light sources specular.ClampMin(); }
参数
[in] light The area light to calculate.
[in] nodiffuse true if the diffuse value should not be calculated, otherwise false .
[in] nospecular true if the specular value should not be calculated, otherwise false .
[in] specular_exponent The specular exponent to use.
[in] ray_vector The ray vector.
[in] p The surface point.
[in] bumpn The bump normal.
[in] orign The original normal.
[in] raybits The ray bits: RAYBIT
[in] ignoreLightColor Whether to factor the light color into the result
[out] diffuse Assigned the diffuse component.
[out] specular Assigned the specular component.

◆  CalcShadow()

向量 CalcShadow ( const RayLight l ,
const Vector64 p ,
const Vector64 bumpn ,
const Vector64 phongn ,
const Vector64 orign ,
const Vector64 rayv ,
Bool   transparency ,
const RayHitID hitid ,
RAYBIT   raybits  
)

Computes a shadow.

参数
[in] l The illuminating light source. The caller owns the pointed light.
[in] p The point in global coordinates.
[in] bumpn The bump normal.
[in] phongn The phong normal.
[in] orign The original normal.
[in] rayv The ray vector.
[in] transparency true if transparencies/alphas for in between objects should be evaluated.
[in] hitid The global RayHitID structure for the surface intersection (to avoid self shadowing).
Pass RayHitID() if not on a surface or to not use of this avoidance.
[in] raybits The ray bits: RAYBIT
返回
The shadow value. If there is no shadow, 0.0 will be returned. 1.0 is the maximum shadow value for each component.

◆  IlluminateSurfacePoint()

Bool IlluminateSurfacePoint ( const RayLight rl ,
向量 col ,
Vector64 light_vector ,
const Vector64 p ,
const Vector64 bumpn ,
const Vector64 phongn ,
const Vector64 orign ,
const Vector64 ray_vector ,
ILLUMINATEFLAGS   flags ,
const RayHitID hitid ,
RAYBIT   raybits ,
Bool   cosine_cutoff  
)

Calculates the intensity of incoming light for a given light and surface point. Used for custom illumination models.

参数
[in] rl The illuminating light. The caller owns the pointed light.
[out] col Assigned the result of the calculation.
[out] light_vector Assigned the light to point vector. For area and tube lights the vector will use the center of the light source.
[in] p The surface point.
[in] bumpn The bump normal.
[in] phongn The phong normal.
[in] orign The original normal.
[in] ray_vector The ray vector.
[in] flags The illuminate flags: ILLUMINATEFLAGS
[in] hitid The global RayHitID structure for the surface intersection (to avoid self shadowing). Can be set to RayHitID() if you do not have the current RayHitID .
[in] raybits The ray bits: RAYBIT
[in] cosine_cutoff true if cosine cut-off should be used, otherwise false .
返回
true if the light illuminates the objects surface point, otherwise false .

◆  IlluminateAnyPoint()

Bool IlluminateAnyPoint ( const RayLight rl ,
向量 col ,
Vector64 light_vector ,
const Vector64 p ,
ILLUMINATEFLAGS   flags ,
RAYBIT   raybits  
)

Calculates the intensity of incoming light for a given light and arbitrary point. Used for custom illumination models.

参数
[in] rl The illuminating light. The caller owns the pointed light.
[out] col Assigned the result of the calculation.
[out] light_vector Assigned the light to point vector. For area and tube lights the vector will use the center of the light source.
[in] p The surface point.
[in] flags The illuminate flags: ILLUMINATEFLAGS
[in] raybits The ray bits: RAYBIT
返回
true if the light illuminates the point, otherwise false .

◆  IlluminanceSurfacePoint()

void IlluminanceSurfacePoint ( IlluminanceSurfacePointData f ,
向量 diffuse ,
向量 specular  
)

Calculates the diffuse and specular components for a given point.
This function can calculate the illumination for any point in space and is widely used for volumetric shaders that display a surface structure (e.g. Cinema 4D 's terrain shader).

参数
[in] f The surface point data used for the call. The caller owns the pointed data.
[in] diffuse Assigned the diffuse component.
[in] specular Assigned the specular component.

◆  IlluminanceAnyPoint()

向量 IlluminanceAnyPoint ( const Vector64 p ,
ILLUMINATEFLAGS   flags ,
RAYBIT   raybits  
)

Calculates the light intensity for a given point p .
This function can calculate the illumination for any point in space and is widely used for transparent volumetric shaders (gases, clouds etc.).

参数
[in] p The global coordinate point to calculate the illumination for.
[in] flags The illuminate flags: ILLUMINATEFLAGS
[in] raybits The ray bits: RAYBIT
返回
The calculated color. Note its components can exceed values of 1.0!

◆  IlluminanceSimple()

void IlluminanceSimple ( 向量 diffuse ,
向量 specular ,
Float   exponent ,
IlluminationModel model ,
void *  data  
)

Calculates the diffuse and specular components according to the current VolumeData and a given specular exponent , or optionally using a custom illumination model .

参数
[out] diffuse Assigned the diffuse component.
[out] specular Assigned the specular component.
[in] exponent The exponent to calculate the specular component.
exponent == 0.0 then no specular is calculated, otherwise a specular is calculated with exponent as exponent value for the phong formula.
[in] model A custom illumination model, or nullptr to use the default illumination model. The caller owns the pointed illumination model.
[in] data The private data passed to the custom illumination function. The caller owns the pointed data.

◆  GetCurrentCPU()

Int32 GetCurrentCPU ( ) const

Retrieves the current thread index on which the shader is executed.

返回
The running thread index, which is guaranteed to be >= 0 and smaller than GetCPUCount() .

◆  GetCPUCount()

Int32 GetCPUCount ( ) const

Retrieves the thread count the renderer is utilizing. The value returned here can differ from or exceed the global GeGetCurrentThreadCount() as the renderer can utilize any different number of threads.

返回
The number of utilized threads (>=1).

◆  Obj_to_Num()

Int32 Obj_to_Num ( const RayObject obj ) const

Retrieves an object's number. Opposite of GetObj() .

参数
[in] obj The object to get the number for. The caller owns the pointed object.
返回
The object's number.

◆  GetObj()

const RayObject * GetObj ( Int32   index ) const

Retrieves the object at index .

参数
[in] index The object index: 0<= index < GetObjCount()
返回
The object. The volume data owns the pointed object.

◆  GetObjCount()

Int32 GetObjCount ( ) const

Retrieves the overall number of objects.

返回
The total number of objects.

◆  GetUVW()

void GetUVW ( const RayObject op ,
Int32   uvwind ,
Int32   local_id ,
PolyVector uvw  
) const

Retrieves the UVW coordinates information for a polygon.

注意
If the polygon consists of three points (triangle) the fourth UVW coordinate 'd' may be uninitialized.
参数
[in] op The object. The caller owns the pointed object.
[in] uvwind The UVW number (there may be several UVW coordinate sets): 1 <= uvwind < op -> uvwcnt
[in] local_id The local polygon ID: 0 <= local_id < op -> vcnt
[out] uvw Assigned the UVW coordinates. The caller owns the pointed coordinates.

◆  GetNormals()

void GetNormals ( const RayObject op ,
Int32   local_id ,
PolyVector norm  
) const

Retrieves the phong normals for a polygon.

注意
If the polygon consists of three points (triangle) the fourth normal d may be uninitialized.
参数
[in] op The object. The caller owns the pointed object.
[in] local_id The local polygon ID: 0 <= local_id < op -> vcnt
[out] norm Assigned the phong normals. The caller owns the pointed coordinates.

◆  GetTexData()

TexData * GetTexData ( const RayObject op ,
Int32   index  
) const

Retrieves the texture at index of an object.

参数
[in] op The object. The caller owns the pointed object.
[in] index The index of the texture: 0 <= index < op -> texcnt
返回
The texture. The volume data owns the pointed texture.

◆  GetNormal()

Vector64 GetNormal ( const RayObject op ,
Int32   polygon ,
Bool   second  
) const

Retrieves the face normal for a polygon.

参数
[in] op The object. The caller owns the pointed object.
[in] polygon The local polygon ID: 0 <= local_id < op -> vcnt
[in] second true if this is the second part of a quadrangle (A-C-D), otherwise false .
返回
The face normal.

◆  GetRayPolyState()

Int32 GetRayPolyState ( const RayObject op ,
Int32   local_id  
) const

Gets the polygon state of the polygon with ID local_id of object op .

参数
[in] op The object. The caller owns the pointed object.
[in] local_id The local polygon ID: 0 <= local_id < op -> vcnt
返回
The polygon state: RayTracePolystate

◆  GetUniqueID()

Int32 * GetUniqueID ( const RayObject op ,
Int32 length  
) const

Retrieves the unique object IP address.

注意
The ID is somewhat constant across frames so it is handy to identify objects in animation.
参数
[in] op The object. The caller owns the pointed object.
[in] length Assigned the length.
返回
The pointer to the address of the unique ID. Cinema 4D owns the pointed ID.

◆  GetSmoothedNormal()

Vector64 GetSmoothedNormal ( const RayHitID hitid ,
const Vector64 p  
) const

Retrieves the phong normal for a point.

参数
[in] hitid The global RayHitID .
[in] p The point for the phong normal. Must be within the surface boundaries of the polygon.
返回
The phong normal.

◆  GetRS()

Bool GetRS ( const RayHitID hitid ,
const Vector64 p ,
Float r ,
Float s  
) const

Calculates the R/S parameters for a point.
To calculate the weighted data (e.g. based upon a color for each polygon point) do it the following way:

Float r,s; Bool snd = sd-> GetRS (hitid, p ,&r,&s); if (snd) result = [color a] * (1.0-r-s) + [color d]*r + [color c]*s else result = [color a] * (1.0-r-s) + [color b]*r + [color c]*s
参数
[in] hitid The global RayHitID .
[in] p The point.
[out] r Assigned the R parameter.
[out] s Assigned the S parameter.
返回
true if the polygon is a quadrangle for the second part (a-c-d) of the quadrangle or false for the first part (a-b-c).
If the polygon is a triangle then this is the same as the first part of a quadrangle (a-b-c).

◆  GetWeights()

void GetWeights ( const RayHitID hitid ,
const Vector64 p ,
RayPolyWeight wgt  
) const

Calculates the barycentric coordinates for a point on the surface of a polygon.
Cinema 4D uses enhanced interpolation routines for quadrangles, so you will get a higher quality using it instead of considering a quadrangle as two triangles.
The routine works for any type of polygon, including triangles and non-coplanar quadrangles.

The function fills the wgt structure with the weight factors for the global polygon with ID hitid at point p on polygon.
Works similar to GetRS() , but has a higher quality. Here is an example:

cd->vd->GetWeights(cd->vd->lhit, vSurfIntersect, &weight); Float rWeightA, rWeightB, rWeightC, rWeightD; Int32 lIndexA = pRayObject->vadr[lPolygonIndex].a; Int32 lIndexB = pRayObject->vadr[lPolygonIndex].b; Int32 lIndexC = pRayObject->vadr[lPolygonIndex].c; Int32 lIndexD = pRayObject->vadr[lPolygonIndex].d; rWeightA = prVertexMapData[lIndexA]; rWeightB = prVertexMapData[lIndexB]; rWeightC = prVertexMapData[lIndexC]; rWeightD = prVertexMapData[lIndexD]; rFunctionSample = weight.wa * rWeightA + weight.wb * rWeightB + weight.wc * rWeightC + weight.wd * rWeightD;
参数
[in] hitid The global RayHitID .
[in] p The point on polygon.
[out] wgt Filled with the weight factors. The caller owns the pointed weights.

◆  GetLight()

const RayLight * GetLight ( Int32   index ) const

Get the light source at index .

参数
[in] index The index of the light source to return: 0 <= index < GetLightCount()
返回
The light source. The volume data owns the pointed light.

◆  GetLightCount()

Int32 GetLightCount ( ) const

Gets the overall number of lights.

返回
The number of lights.

◆  Light_to_Num()

Int32 Light_to_Num ( const RayLight light ) const

Gets the number for a light. Opposite of GetLight() .

参数
[in] light The light to get the number for. The caller owns the pointed light.
返回
The light's number.

◆  GetRayData()

const void* GetRayData ( Int32   i ) const

Retrieves one of the raytracer structures, these are also available as direct called, for example GetRaySky() .

参数
[in] i The requested structure type: RAY
返回
The requested raytracer structure. The volume data owns the pointed structure.

◆  GetRayCamera()

const RayCamera * GetRayCamera ( ) const

Retrieves the raytracer camera.

返回
The camera. The volume data owns the pointed camera.

◆  GetRayParameter()

const RayParameter * GetRayParameter ( ) const

Retrieves the raytracer parameters (settings).

注意
The raytracer uses a completely different representation than the normal scene ( BaseDocument ).
It has new, efficient data structures where you do not need to check a lot of things. As you do not have a BaseDocument (it is still there for special purposes, but normally you will not have to deal with it in the raytracer) all relevant data structures can be obtained through VolumeData .
返回
The raytracer parameters. Guaranteed to be valid (not nullptr ). The volume data owns the pointed parameters.

◆  GetRayEnvironment()

const RayEnvironment * GetRayEnvironment ( ) const

Retrieves the raytracer environment parameters.

返回
The raytracer environment. Guaranteed to be valid (not nullptr ). The volume data owns the pointed parameters.

◆  GetRaySky() [1/2]

const RayObject * GetRaySky ( ) const

Retrieves the sky object.

返回
The sky object, or nullptr if none is there. The volume data owns the pointed sky object.

◆  GetRayForeground()

const RayObject * GetRayForeground ( ) const

Retrieves the foreground object.

返回
The foreground object, or nullptr if none is there. The volume data owns the pointed foreground object.

◆  GetRayBackground()

const RayObject * GetRayBackground ( ) const

Retrieves the background object.

返回
The background object, or nullptr if none is there. The volume data owns the pointed background object.

◆  GetRay()

void GetRay ( Float   x ,
Float   y ,
Ray ray  
) const

Generates the view ray for a position.
Does not set Ray::pp [ 0 .. 2 ], Ray::vv [ 0 .. 2 ], Ray::transport and Ray::ior . Those have to be filled in if used subsequently by TraceColor() , TraceColorDirect() or GetSurfaceData() .
It is not necessary for TraceGeometry() though (as there are no MIP mapping calculations).

ray . ior =1.0; ray . transport =1.0; ray . pp [0]= ray . pp [1]= ray . pp [2]=SV( ray . p ); ray . vv [0]= ray . vv [1]= ray . vv [2]=SV( ray . v );
参数
[in] x The X position for the view ray in screen space coordinates.
[in] y The Y position for the view ray in screen space coordinates.
[out] ray Assigned the generated view ray. The caller owns the pointed ray.

◆  ScreenToCamera()

Vector64 ScreenToCamera ( const Vector64 p ) const

Transforms screen to camera coordinates.

注意
During QTVR rendering same point is returned.
参数
[in] p The screen coordinate.
返回
The camera coordinate.

◆  CameraToScreen()

Vector64 CameraToScreen ( const Vector64 p ) const

Transforms camera to screen coordinates.

注意
During QTVR rendering same point is returned.
参数
[in] p The camera coordinate.
返回
The screen coordinate.

◆  CalcHardShadow()

向量 CalcHardShadow ( const Vector64 p1 ,
const Vector64 p2 ,
CALCHARDSHADOW   flags ,
const RayHitID last_hit ,
Int32   recursion_id = 0 ,
void *  recursion_data = nullptr  
)

Calculates a hard shadow from point p1 to p2 .

注意
Set the CALCHARDSHADOW::TRANSPARENCY flag if transparencies/alphas for in between objects shall be evaluated.
An additional last_hit can be passed to avoid self-shadowing (if starting on a surface). To not make use of it just pass 0 .
参数
[in] p1 The start point for the hard shadow.
[in] p2 The end point for the hard shadow.
[in] flags The flags: CALCHARDSHADOW
[in] last_hit The last intersection. Pass RayHitID() to include all polygons.
[in] recursion_id A plugin ID for data passed through recursion.
[in] recursion_data The data that can be passed through recursion.
返回
The shadow value. 0.0 if there is no shadow. 1.0 is the maximum shadow value for each component.

◆  GetPointUVW()

向量 GetPointUVW ( const TexData tdp ,
const RayHitID hit ,
const Vector64 p  
) const

Computes the UVW coordinates for a texture.

参数
[in] tdp The texture for the coordinate. The caller owns the pointed texture.
[in] hit The global RayHitID .
[in] p The point for the UVW coordinate.
返回
The UVW coordinate.

◆  ProjectPoint()

Bool ProjectPoint ( const TexData tdp ,
const RayHitID hit ,
const Vector64 p ,
const Vector64 n ,
向量 uv  
) const

Computes the UVW coordinates for a texture.

参数
[in] tdp The texture for the coordinates. The caller owns the pointed texture.
[in] hit The global RayHitID .
[in] p The point for the UVW coordinate.
[in] n The normal for the UVW coordinate.
[out] uv Assigned the UVW coordinate.
返回
true if successful, otherwise false .

◆  StatusSetText()

void StatusSetText ( const maxon::String str ) const

Set the status bar text during initialization of a shader or videopost effect. If String() is passed the status bar will be cleared.

参数
[in] str The status text to display.

◆  StatusSetBar()

void StatusSetBar ( Float   percentage ) const

Sets the status bar progress during initialization a your shader or videopost effect.

参数
[in] percentage The percentage for the bar.

◆  StatusSetSpinMode()

void StatusSetSpinMode ( Bool   on ) const

Sets the render progress bar spinning. Use this to indicate that a plugin is still processing even if the progress bar is not increasing.

参数
[in] on true to set the progress bar spinning, false to stop it.

◆  CalcVisibleLight()

向量 CalcVisibleLight ( const Ray ray ,
Float   maxdist ,
向量 trans  
) const

Calculates the mixed color of all visible lights on a given ray span.

参数
[in] ray The ray span. The caller owns the pointed ray.
[in] maxdist The maximum distance for the lights.
[out] trans Assigned a value !=0 if some light sources have a dust effect.
返回
The mixed color of the lights.

◆  GetXY()

void GetXY ( Int32 x ,
Int32 y ,
Int32 scale  
) const

Retrieves the current X/Y pixel position in render resolution. Render resolution is the screen resolution multiplied by scale .

注意
Float(x)/Float (scale) and Float(y)/Float (scale) is the screen position.
参数
[out] x Assigned the X pixel position.
[out] y Assigned the Y pixel position.
[out] scale Assigned the render scale.

◆  SetXY()

void SetXY ( Float   x ,
Float   y  
)

Sets the current X/Y pixel position in render resolution. Render resolution is the screen resolution multiplied by scale .

注意
Float(x)/Float (scale) and Float(y)/Float (scale) is the screen position.
Certain Shaders use the screen pixel position. Plugins (like the Baker for instance) can change this position without having to render an image.
参数
[in] x The X pixel position to set.
[in] y The Y pixel position to set.

◆  GetSceneBoundaries()

MinMax GetSceneBoundaries ( ) const

Goes through all objects and calculates the scene boundaries. It does not take into account infinite sky/floor objects.

返回
The boundary for all objects within the scene.

◆  CopyTo()

void CopyTo ( VolumeData dst ) const

Copies the volume data to another VolumeData .

参数
[out] dst The destination VolumeData . The caller owns the pointed volume data.

◆  Init()

void Init ( VolumeData from )

Initializes the VolumeData with the data of the from object.
Only the most essential parts are copied over, including the render instance.
Such a VolumeData can be used for TraceColorDirect() , TraceGeometry() , TraceColor() etc.

注意
Init() is faster than CopyTo() , but does not allow subsequent access of functions like BaseMaterial::CalcSurface() (only possible if all members are initialized by hand).
参数
[in] from The source volume data. The caller owns the pointed volume data.

◆  OutOfMemory()

void OutOfMemory ( )

Notify Cinema 4D that a (severe) out-of-memory condition occurred.
Cinema 4D will stop as soon as possible, but there is no guarantee when exactly. It is possible that the shader could still be called several times, so it has to be programmed to handle this and to be crash-proof.

◆  CalcFgBg()

Bool CalcFgBg ( Bool   foreground ,
Int32   x ,
Int32   y ,
Int32   subx ,
Int32   suby ,
向量 color ,
Float alpha  
) const

Calculates the foreground or background color and alpha at ( x , y ).

参数
[in] foreground true to calculate the foreground color, otherwise the background color.
[in] x The X coordinate.
[in] y The Y coordinate.
[in] subx The sub-pixel X position: 0 <= subx <= 15
[in] suby The sub-pixel Y position: 0 <= suby <= 15
[out] color Assigned the background/foreground color.
[out] alpha Assigned the background/foreground alpha.
返回
true if successful, otherwise false .

◆  GetLightFalloff()

Float GetLightFalloff ( Int32   falloff ,
Float   inner ,
Float   outer ,
Float   dist  
) const

Calculates the light falloff function (light intensity for a distance).

参数
[in] falloff The light falloff type: RaytraceLightFalloff
[in] inner The inner falloff value.
[in] outer The outer falloff value.
[in] dist The distance for the intensity to be calculated at.
返回
The light falloff.

◆  TestBreak()

Bool TestBreak ( )

Tests for termination. If time intensive operations are performed (such as sending out several rays into the scene) call this routine to check for a renderer break.
In normal situations Cinema 4D breaks after a pixel has been calculated.

返回
true if the operation has been terminated, otherwise false .

◆  GetVideoPost()

BaseVideoPost * GetVideoPost ( Int32   nth ) const

Retrieves a videopost effect for the current render process by index.

参数
[in] nth The index of the videopost effect.
返回
The video post, or nullptr if the index is too large.

◆  FindVideoPost()

BaseVideoPost * FindVideoPost ( Int32   id ) const

Retrieves a video post effect for the current render process by ID.

参数
[in] id The video post effect ID.
返回
The video post, or nullptr if the index is too large.

◆  GetFragments()

const VPFragment ** GetFragments ( Int32   x ,
Int32   y ,
Int32   cnt ,
VPGETFRAGMENTS   flags  
) const

Retrieves the videopost fragments for a point.

注意
Not all fragments are stored during rendering, just the ones closest to the camera. So this cannot be used to for example draw inside a transparent object.
警告
The array needs to be freed with DeleteMem() afterwards. The fragments must not be freed!
参数
[in] x The X coordinate.
[in] y The Y coordinate.
[in] cnt The X pixel count.
[in] flags The flags: VPGETFRAGMENTS
返回
An array of pointers to the videopost fragments. The caller owns the pointed array. The volume data owns the pointed fragments.

◆  AddLensGlow()

Bool AddLensGlow ( const LensGlowStruct lgs ,
向量 lgs_pos ,
Int32   lgs_cnt ,
Float   intensity ,
Bool   linear_workflow  
) const

Adds a number of lens glows to the image.
In earlier versions the SampleLensFX() call was done automatically. Now this has to be called manually at the end to provide Cinema 4D with the information where to sample.

参数
[in] lgs An array of lgs_cnt lens glow structs to draw. The caller owns the pointed array.
[in] lgs_pos An array of lgs_cnt vectors with the corresponding positions of each lens glow in lgs . The caller owns the pointed array.
[in] lgs_cnt The number of elements in the lgs and lgs_pos arrays.
[in] intensity The intensity of the lens glows.
[in] linear_workflow true if linear workflow is used, otherwise false .
返回
true if the lens glow was added, otherwise false .

◆  SampleLensFX()

Bool SampleLensFX ( const VPBuffer rgba ,
const VPBuffer fx ,
BaseThread bt  
) const

Samples all lens effects previously created by calling AddLensGlow() .

参数
[in] rgba The image buffer. The caller owns the pointed buffer.
[in] fx An FX buffer for the new post effect multipass feature, or nullptr . The caller owns the pointed buffer.
[in] bt The current thread, or nullptr for the main Cinema 4D thread.
返回
true if successful, otherwise false .

◆  TranslateObjIndex()

Int32 TranslateObjIndex ( Int32   index ,
Bool   old_to_new  
) const

Translates a current RayObject number to the one used in the last frame's rendering or vice versa.
For instance if object 5 was object 10 in the last frame. Then TranslateObjIndex(5, false) = 10 and TranslateObjIndex(10, true) = 5 .

注意
If plugin generator objects are involved it is necessary that they support the BaseObject::SetUniqueIP() feature.
参数
[in] index The object index to convert.
[in] old_to_new true then index is an index from the last frame and the return value is an index in the current frame. Otherwise it is the other way around.
返回
The converted object index, or NOTOK if the object does not exist anymore (or did not exist before).

◆  TranslatePolygon()

Bool TranslatePolygon ( const RayObject op ,
Int32   local_index ,
向量 previous_points  
) const

For a given RayObject op and a local polygon ID local_index retrieves the array of points from the last frame.

注意
To enable this functionality VIDEOPOSTINFO::REQUEST_MOTIONGEOMETRY must be set in the video post.
This function only makes sense to activate in a videopost plugin, as it goes beyond a single frame.
参数
[in] op A ray object from the current frame. The caller owns the pointed object.
[in] local_index A local polygon ID from the current frame.
[in,out] previous_points Should point to an array of 4 Vector elements. The caller owns the pointed array.
Assigned the points of the specified polygon from the last frame, if it existed. For a triangle only the 3 first fields of the array are filled.
返回
true the data was available and stored in previous_points , otherwise false .

◆  TraceColor()

向量 TraceColor ( Ray ray ,
Float   maxdist ,
const RayHitID last_hit ,
SurfaceIntersection si  
)

Works like TraceGeometry() , but calculates the color for a given ray and evaluates all shaders for the intersection point.

注意
To avoid self-intersection, pass the current hit as last_hit . To include all polygons, set last_hit to RayHitID() .
警告
Always use a limit for the recursion (typically a value from 6 to 20 ) to avoid the danger of a stack overflow.
参数
[in] ray The ray to find the intersection for. The caller owns the pointed ray.
[in] maxdist The maximum distance to check for intersections.
[in] last_hit The last intersection, or RayHitID() to include all polygons.
[out] si The surface intersection structure to take the calculated hit data. The caller owns the pointed surface intersection.
返回
The color.
A color can be returned even if there was no intersection ( si.gid==0 ); in this case the ray intersected the sky.

◆  TraceColorDirect()

向量 TraceColorDirect ( Ray ray ,
Float   maxdist ,
Int32   raydepth ,
RAYBIT   raybits ,
const RayHitID last_hit ,
Vector64 oldray ,
SurfaceIntersection si  
)

Works like TraceColor() , but always samples the full color including all effects.

注意
To avoid self-intersection, pass the current hit as last_hit . To include all polygons, set last_hit to RayHitID() .
警告
A shader must not call this function if RAYBIT::GI is set in raybits .
参数
[in] ray The ray to find the intersection for. The caller owns the pointed ray.
[in] maxdist The maximum distance to check for intersections.
[in] raydepth The ray depth.
[in] raybits The ray flags: RAYBIT
[in] last_hit The last intersection. Pass RayHitID() to include all polygons.
[in] oldray Should be set to nullptr .
[out] si The surface intersection structure to take the calculated hit data. The caller owns the pointed surface intersection.
返回
The color.

◆  TraceGeometry()

Bool TraceGeometry ( const Ray ray ,
Float   maxdist ,
const RayHitID last_hit ,
SurfaceIntersection si  
) const

Calculates an intersection for ray .

注意
To avoid self-intersection, pass the current hit as last_hit . To include all polygons, set last_hit to RayHitID() .
参数
[in] ray The ray to find the intersection for. The caller owns the pointed ray.
[in] maxdist The maximum distance to check for intersections.
[in] last_hit The last intersection. Pass RayHitID() to include all polygons.
[out] si The surface intersection structure to take the calculated hit data. The caller owns the pointed surface intersection.
返回
true if an intersection was found, otherwise false .

◆  TraceGeometryEnhanced()

Bool TraceGeometryEnhanced ( const Ray ray ,
Float   maxdist ,
const RayHitID last_hit ,
Int32   raydepth ,
RAYBIT   raybits ,
Vector64 oldray ,
SurfaceIntersection si  
) const

Calculates an intersection for ray at a certain ray depth.

注意
To avoid self-intersection, pass the current hit as last_hit . To include all polygons, set last_hit to RayHitID() .
参数
[in] ray The ray to find the intersection for. The caller owns the pointed ray.
[in] maxdist The maximum distance to check for intersections.
[in] last_hit The last intersection. Pass RayHitID() to include all polygons.
[in] raydepth The ray depth.
[in] raybits The rays flags: RAYBIT
[in] oldray Should be set to nullptr .
[out] si The surface intersection structure to take the calculated hit data. The caller owns the pointed surface intersection.
返回
true if an intersection was found, otherwise false .

◆  GetSurfaceData()

void GetSurfaceData ( SurfaceData cd ,
Bool   calc_illum ,
Bool   calc_shadow ,
Bool   calc_refl ,
Bool   calc_trans ,
Ray ray ,
const SurfaceIntersection si  
)

Retrieves information for a point on a surface.

参数
[out] cd The retrieved surface information. The caller owns the pointed surface information.
[in] calc_illum true if the point shall be shaded (e.g. the sky is not shaded so is false ).
[in] calc_shadow true if a shadow shall be calculated.
[in] calc_refl true if a reflection shall be calculated.
[in] calc_trans true if a transparency shall be calculated.
[in] ray The ray. The caller owns the pointed ray.
[in] si The surface intersection data.

◆  CentralDisplacePointUV()

向量 CentralDisplacePointUV ( const RayObject op ,
Int32   local_id ,
Int32   uu ,
Int32   vv  
) const

Calculates the subpolygon displacement for a polygon local_id of object op .
SPD has to be enabled for the object. The indices uu and vv are >= 0 and uu + vv <= op -> spd_displacement .
CalcDisplacementNormals() for an example.

注意
Cinema 4D automatically converts quads to triangles only if an objects has SPD enabled.
参数
[in] op The ray object. The caller owns the pointed object.
[in] local_id The local polygon ID.
[in] uu The R coordinate.
[in] vv The S coordinate.
返回
The displacement vector.

◆  CentralDisplacePointFromUVPoint()

向量 CentralDisplacePointFromUVPoint ( const RayObject op ,
Int32   local_id ,
Bool   bFirst ,
Float   l1 ,
Float   l2 ,
const 向量 uv ,
const UVWStruct uvw  
) const

Calculates the subpolygon displacement of a point uv in polygon local_id of object op .
SPD has to be enabled for the object. The uv point is expected to be within the triangle local_id . The parameters l1 and l2 are expected to be the triangular barycentric coordinates of point uv within a the triangle. If local_id corresponds to a triangle within a quad, bFirst indicates which of the sub triangles local_id is.

注意
Cinema 4D automatically converts quads to triangles only if an objects has SPD enabled.
由于
R18
参数
[in] op The ray object. The caller owns the pointed object.
[in] local_id The abc or acd triangle id of a quad polygon.
[in] bFirst Whether local_id corresponds to the abc or acd triangle of the quad polygon.
[in] l1 First barycentric coordinate.
[in] l2 Second barycentric coordinate.
[in] uv UV coordinates of the point to displace.
[in] uvw UVW polygon enclosing the 'uv' point.
返回
The displacement vector.

◆  CalcDisplacementNormals()

向量 CalcDisplacementNormals ( Float   par_u ,
Float   par_v ,
Int32   u0 ,
Int32   v0 ,
Int32   u1 ,
Int32   v1 ,
Int32   u2 ,
Int32   v2 ,
const 向量 a ,
const 向量 b ,
const 向量 c ,
const RayObject op ,
Int32   polynum  
) const

Calculates the normal at a point on polygon polynum of object op .
SPD has to be enabled for the object. The indices a / b / c are the corner points of the subpolygon and u0 / v0 / u1 / v1 / u2 / v2 are the r/s coordinates for it.
These are passed here since one usually has to calculate them before, so for speed reasons they do not have to be calculated again.
范例:

Int32 num = lSubID & ~(1<<31), u0, u1, u2, v0, v1, v2; u0 = u1 = u2 = num / m_pRayObject->spd_displacement; v0 = v1 = v2 = num % m_pRayObject->spd_displacement; if (lSubID & (1<<31)) { u1--; v2--; } else { u1++; v2++; } tri0 = m_pVolumeData->CentralDisplacePointUV(m_pRayObject, lLocalID, u0, v0); tri1 = m_pVolumeData->CentralDisplacePointUV(m_pRayObject, lLocalID, u1, v1); tri2 = m_pVolumeData->CentralDisplacePointUV(m_pRayObject, lLocalID, u2, v2); n = m_pVolumeData->CalcDisplacementNormals(rParU, rParV, u0, v0, u1, v1, u2, v2, tri0, tri1, tri2, m_pRayObject, lLocalID));

The sub-ID and par_u/par_v e.g. are retrieved with VolumeData::TraceGeometry() .

参数
[in] par_u The U parameter.
[in] par_v The V parameter.
[in] u0 The R coordinate for a .
[in] v0 The S coordinate for a .
[in] u1 The R coordinate for b .
[in] v1 The S coordinate for b .
[in] u2 The R coordinate for c .
[in] v2 The S coordinate for c .
[in] a The first corner point of the sub-polygon.
[in] b The second corner point of the sub-polygon.
[in] c The third corner point of the sub-polygon.
[in] op The ray object. The caller owns the pointed object.
[in] polynum The polygon index.
返回
The displacement normal.

◆  CentralDisplaceUVGetNormal()

向量 CentralDisplaceUVGetNormal ( const RayObject op ,
Int32   local_id ,
Int32   uu ,
Int32   vv  
) const

Private .

◆  CentralDisplaceGetSurfaceNormalFromUVPoint()

向量 CentralDisplaceGetSurfaceNormalFromUVPoint ( const RayObject op ,
Int32   local_id ,
Bool   bFirst ,
Float   par_u ,
Float   par_v ,
const 向量 uv ,
const UVWStruct uvw  
) const

Computes the surface normal at the world point corresponding to the UV point at uv . Takes into account whether surface subdivision is active and if true, whether surface rounding is applied.

由于
R18
参数
[in] op RayObject containing the UV point and polygon in question.
[in] local_id Id of the triangle containing the point uv .
[in] bFirst local_id is within a quad, whether local_id is the 'abc' or 'acd' triangle.
[in] par_u 'u' barycentric coordinate of uv within the triangle.
[in] par_v 'v' barycentric coordinate of uv within the triangle.
[in] uv UV point to evaluate.
[in] uvw UVW polygon enclosing the 'uv' point.
返回
The surface normal at the world point corresponding to the UV point at uv .

◆  CentralDisplaceGetShadingNormalFromUVPoint()

向量 CentralDisplaceGetShadingNormalFromUVPoint ( const RayObject op ,
Int32   local_id ,
Bool   bFirst ,
Float   par_u ,
Float   par_v ,
const 向量 uv ,
const UVWStruct uvw  
) const

Computes the shading normal at the world point corresponding to the UV point at uv . Takes into account whether surface subdivision is active and if true, whether surface rounding is applied.

由于
R18
参数
[in] op RayObject containing the UV point and polygon in question.
[in] local_id Id of the triangle containing the point uv .
[in] bFirst local_id is within a quad, whether local_id is the 'abc' or 'acd' triangle.
[in] par_u 'u' barycentric coordinate of uv ' within the triangle.
[in] par_v 'v' barycentric coordinate of uv within the triangle.
[in] uv Point to evaluate.
[in] uvw UVW polygon enclosing the 'uv' point.
返回
The shading normal at the world point corresponding to the UV point at uv .

◆  CentralDisplacePointUVGetBarycentric()

Bool CentralDisplacePointUVGetBarycentric ( const RayObject op ,
Int32 local_id ,
Int32 uu ,
Int32 vv ,
RayPolyWeight bary ,
Bool displaceQuad  
) const

Private .

◆  GetDisplaceInfo()

Bool GetDisplaceInfo ( const RayObject op ,
DisplaceInfo info  
) const

Private .

◆  GetDisplaceNeighbor()

Int32 GetDisplaceNeighbor ( const RayObject op ,
Int32   local_id ,
Int32   side  
) const

Private .

◆  CorrectLocalID()

void CorrectLocalID ( const RayObject op ,
Int32 local_id  
) const

Private .

◆  CalcBackTransformPoint()

向量 CalcBackTransformPoint ( ) const

Calculates the back transform point.

注意
Every time the texture matrix multiplies the back point this method should be used: Call CalcBackTransformPoint() : p = cd->vd->CalcBackTransformPoint(); Instead of writing: p = cd->vd->tex->im * cd->vd->back_p;
返回
The back transform point.

◆  CalcMotionObjectMatrixInv()

Matrix64 CalcMotionObjectMatrixInv ( const RayObject op ) const

Calculates the inverse matrix of the object when in motion blur.

由于
R16
参数
[in] op The object. The caller owns the pointed object.
返回
The inverse matrix of the object for motion blur.

◆  SkipRenderProcess()

void SkipRenderProcess ( )

Skips the render process.

注意
Useful for custom renderers.

◆  GetRenderInstance()

const 渲染 * GetRenderInstance ( ) const

Retrieves the current Render* instance.

返回
The render instance.

◆  GetDUDV()

void GetDUDV ( const TexData tex ,
const Vector64 p ,
const Vector64 phongn ,
const Vector64 orign ,
const RayHitID hit ,
Bool   forceuvw ,
向量 ddu ,
向量 ddv ,
Bool   usetangents ,
const RayPolyWeight weight  
) const

Calculates the DU/DV components for a texture and a given point/normal.
Only necessary for channel shaders that normally cannot access this information.

注意
Traditionally we would estimate the DU/DV for UV mapping from surrounding points.
But it can be inaccurate at the edges for smooth surfaces. Just like we precompute phong normals to compute smooth normals, we added an option (usetangents) to use UV tangents to compute correct DU/DV at any point.
It is a more accurate method that avoid many of the previous problems.
参数
[in] tex The texture to initialize. The caller owns the pointed texture data.
[in] p The surface point.
[in] phongn The shading normal.
[in] orign The original normal.
[in] hit The global RayHitID to get the UV coordinate in.
[in] forceuvw true to force UVW calculation.
[out] ddu Assigned the calculated DU component.
[out] ddv Assigned the calculated DV component.
[in] usetangents true to use UV tangents to compute DU/DV components.
[in] weight Optional weight for the polygon.

◆  GetDUDVFromUVPoint()

void GetDUDVFromUVPoint ( const RayObject op ,
const TexData tex ,
Float   par_u ,
Float   par_v ,
const Vector64 uv ,
const Vector64 p ,
const Vector64 phongn ,
const Vector64 orign ,
const UVWStruct uvw ,
RayHitID hit ,
Bool   forceuvw ,
向量 ddu ,
向量 ddv ,
Bool   usetangents  
)

Calculates the DU/DV components for a texture and a given point/normal. Takes into account geometry rounding.

由于
R18
参数
[in] op Ray object on which the tangents are being evaluated.
[in] tex The texture to initialize. The caller owns the pointed texture data.
[in] par_u 'u' triangle barycentric coordinate for uv point
[in] par_v 'v' triangle barycentric coordinate for uv point
[in] uv The UV point for which to evaluate the tangents.
[in] p The surface point.
[in] phongn The shading normal. See CentralDisplaceGetShadingNormalFromUVPoint
[in] orign The surface normal. See CentralDisplaceGetSurfaceNormalFromUVPoint
[in] uvw UVW polygon enclosing the 'uv' point.
[in] hit The RayHitID containing the triangle info for the 'uv' point.
[in] forceuvw true to force UVW calculation.
[out] ddu The calculated DU tangent vector.
[out] ddv The calculated DV co-tangent vector.
[in] usetangents true to use UV tangents to compute DU/DV components.

◆  InitSurfacePointProperties()

void InitSurfacePointProperties ( TexData td )

Initializes the surface point properties in the texture data td .

参数
[in] td The texture data to initialize. The caller owns the pointed texture data.

◆  AttachVolumeDataFake()

Bool AttachVolumeDataFake ( BaseObject camera ,
const BaseContainer renderdata  
)

Attaches camera data to the VolumeData structure that is not available otherwise (like camera information, renderdata and screen pixel position).
Enables the following render functions to work: SetXY() , GetXY() , ProjectPoint() (frontal projection), GetRay() , ScreenToCamera() , CameraToScreen() , GetParameter(), GetRayCamera() .
To delete it either free the VolumeData or call AttachVolumeData(nullptr, empty_container).
Here is an example of how to use this method:

VolumeData *vd = VolumeData::Alloc (); BaseDraw *bd = doc-> GetRenderBaseDraw (); BaseObject *camera = bd?bd-> GetSceneCamera (doc): nullptr ; RenderData *rdata = doc-> GetActiveRenderData (); if (vd && camera && rdata && vd-> AttachVolumeDataFake (camera,*rdata-> GetDataInstance ())) { Int32 x,y; Ray ray ; for (y=0; y<10; y++) { for (x=0; x<rdata-> GetDataInstance ()->GetInt32( RDATA_XRES ); x++) { vd-> GetRay (x,y,& ray ); GePrint ( String::FloatToString ( ray . v . x )+ String ( " " )+ String::FloatToString ( ray . v . y )+ String ( " " )+ String::FloatToString ( ray . v . z )); } } } VolumeData::Free (vd);
参数
[in] camera The camera to attach. The caller owns the pointed camera.
[in] renderdata The render data container.
返回
true if successful, otherwise false .

◆  HasVolumeDataFake()

Bool HasVolumeDataFake ( ) const

Checks if the VolumeData has fake attached.

返回
true if the volume data has fake data attached, otherwise false .

◆  SaveShaderStack()

Bool SaveShaderStack ( RayShaderStackElement *&  stack ,
Int32 stack_cnt  
)

Private .

◆  RestoreShaderStack()

Bool RestoreShaderStack ( RayShaderStackElement stack ,
Int32   stack_cnt  
)

Private .

◆  GetRaySky() [2/2]

const RayObject * GetRaySky ( Int32   index ) const

Retrieves the index -th sky object (index ranging from 0 to GetRaySkyCount() - 1 ). The object is of type O_SKY .

参数
[in] index The sky object index.
返回
The sky object, or nullptr . The volume data owns the pointed sky object.

◆  GetRaySkyCount()

Int32 GetRaySkyCount ( ) const

Gets the number of sky objects.

返回
The number of sky objects.

◆  GetRaySampler()

RaySampler * GetRaySampler ( void *  guid ,
Int32   depth  
)

Private .

◆  GetRayWeight()

Float GetRayWeight ( ) const

Private .

◆  CalcAmbientOcclusion()

Float CalcAmbientOcclusion ( SurfaceIntersection si ,
RaySampler sampler ,
Float   minlength ,
Float   maxlength ,
Float   index ,
Bool   self ,
Bool   trans ,
Float   weight ,
Bool   reverse  
)

Private .

◆  CalcSubsurfaceScattering()

向量 CalcSubsurfaceScattering ( 向量   scattering ,
向量   absorption ,
向量   diffuse ,
Float   ior  
)

Private .

◆  GetStreamCount()

Int32 GetStreamCount ( ) const

Retrieves the number of stereoscopic streams that are rendered.

返回
The number of stereoscopic streams.

◆  GetStreamRay()

void GetStreamRay ( Int32   stream ,
Float   x ,
Float   y ,
Ray ray  
) const

如同 GetRay() but just for stereoscopic streams.

参数
[in] stream The stereoscopic stream: 0 <= stream < GetStreamCount()
[in] x The X position for the view ray in screen space coordinates.
[in] y The Y position for the view ray in screen space coordinates.
[in] ray Assigned the generated view ray. The caller owns the pointed ray.

◆  CalcIndirectIllumination()

Bool CalcIndirectIllumination ( RayHemisphere hs ,
Float   weight  
)

Entry point into Cinema 4D GI calculation. Performs the full 3 phase MIS sampling for indirect illumination.
CalcIndirectIllumination() can also be used to compute AO. It is handy as it computes also gradients allowing very fast AO with interpolation.

参数
[in] hs Controls the GI and if gradient information needs to be computed or not for the caches.
[in] weight The weight.
返回
true if successful, otherwise false .

◆  CalcIndirectPDF()

Bool CalcIndirectPDF ( const 向量 point ,
const 向量 normal ,
const 向量 ray_in ,
const 向量 ray_out ,
Float pdf_qmc ,
Float pdf_area ,
Float pdf_portal ,
Float pdf_sky  
)

Calculates the PDF (Probability Distribution) for the given intersection and 2 ray directions.

参数
[in] point The point.
[in] normal The normal.
[in] ray_in The ray in direction.
[in] ray_out The ray out direction.
[out] pdf_qmc Assigned the PDF QMC.
[out] pdf_area Assigned the PDF area.
[out] pdf_portal Assigned the PDF portal.
[out] pdf_sky Assigned the PDF sky.
返回
true if successful, otherwise false .

◆  CalcIndirectPath()

Bool CalcIndirectPath ( VolumeData sd ,
const 向量 dir ,
void *  source ,
void *  target  
)

Private .

◆  CreateRadianceMaps()

RayRadianceObject * CreateRadianceMaps ( )

Private .

◆  GetRadianceMaps()

RayRadianceObject * GetRadianceMaps ( )

Private .

◆  CalcRadianceValue()

向量 CalcRadianceValue ( Ray ray ,
const SurfaceIntersection si  
)

Calculates the values for radiance maps.

参数
[in] ray The ray. The caller owns the pointed ray.
[in] si The surface intersection structure. The caller owns the pointed surface intersection.
返回
The radiance value.

◆  CalcRadiancePoly()

向量 CalcRadiancePoly ( RayRadianceObject obj ,
SurfaceIntersection si ,
Int32   poly ,
Int32   u ,
Int32   v ,
Bool   back  
)

Computes the radiance for the given object and polygon index. Used by the Radiosity Maps when computing the color for each "texel" on the poly.

参数
[in] obj The radiance object.
[in] si The surface intersection structure. The caller owns the pointed surface intersection.
[in] poly The polygon index.
[in] u The U texel position for the radiosity map.
[in] v The V texel position for the radiosity map.
[in] back Set to true to computes the illumination for the back side.
返回
The radiance value.

◆  IsPhysicalRender()

Bool IsPhysicalRender ( ) const

Checks if the Physical Render is being used to render the volume data.

返回
true if the Physical Render is used to render, otherwise false .

◆  GetPhysicalCameraIntensity()

Float GetPhysicalCameraIntensity ( ) const

Used in Physical Render (always returns 1.0 in Standard).

注意
This method is handy if the plugin does any custom drawing into the buffer. e.g. it can be used in the GI/AO prepass to make sure the prepass intensity matches the render.
返回
The relative intensity of the camera when exposure is used.

◆  SetPhysicalRayTime()

void SetPhysicalRayTime ( Float   time )

Used in Physical Render. Sets the time state inside the renderer.
The value range is from 0.0 to 1.0 , and corresponds to the frame exposure range as specified by the camera.

注意
This method is useful to customize the time when rays are traced before the rendering starts, for example in various prepass tasks to make sure Motion Blur is properly handled.
参数
[in] time The time.

◆  GetMotionObject()

const RayMotionObject * GetMotionObject ( RayObject op )

Retrieves the motion blur information for an object.

由于
R17.032
参数
[in] op The object. The caller owns the pointed op.
返回
The motion data.

◆  GetMotionLight()

const RayMotionLight * GetMotionLight ( RayLight light )

Retrieves the motion blur information for a light.

由于
R17.032
参数
[in] light The light. The caller owns the pointed light.
返回
The motion data.

◆  GetMotionCamera()

const RayMotionCamera * GetMotionCamera ( Int32   stream )

Retrieves the motion blur information for a camera.

由于
R17.032
参数
[in] stream The camera stream.
返回
The motion data.

◆  GetTile()

Bool GetTile ( Int32 xMin ,
Int32 yMin ,
Int32 xMax ,
Int32 yMax ,
Int32 renderThreadIndex  
) const

Queries information about the currently rendered RayTile.

由于
R16.038
警告
Not valid during Videopost execution, with the exception of VIDEOPOSTCALL::TILE .
参数
[out] xMin Assigned the upper left of the rendered tile.
[out] yMin Assigned the lower left of the rendered tile.
[out] xMax Assigned the upper right of the rendered tile.
[out] yMax Assigned the lower right of the rendered tile.
[out] renderThreadIndex Assigned the index of the render thread that invoked VIDEOPOSTCALL::TILE and 'owns' the tile.
Note that pixel calculation can be distributed on multiple render threads.
返回
true if successful, otherwise false .
Ray::p
Vector64 p
[READ WRITE] The rays position.
定义: c4d_shader.h:588
BaseVolumeData::raybits
RAYBIT raybits
[READ ONLY] The ray information: RAYBIT
定义: c4d_shader.h:918
String::FloatToString
static String FloatToString(Float32 v, Int32 vvk=-1, Int32 nnk=-3)
定义: c4d_string.h:529
BaseVolumeData::calc_shadow
Bool calc_shadow
[READ ONLY] Specifies, if shadows will be rendered.
定义: c4d_shader.h:905
VolumeData::GetLight
const RayLight * GetLight(Int32 index) const
定义: c4d_tools.h:1620
BaseVolumeData::ray
Ray * ray
[READ ONLY] The current eye ray. Always valid, not nullptr.
定义: c4d_shader.h:880
BaseVolumeData::lhit
RayHitID lhit
[READ ONLY] The surface identity.
定义: c4d_shader.h:890
BaseList2D::GetDataInstance
const BaseContainer * GetDataInstance() const
定义: c4d_baselist.h:2283
BaseObject
定义: c4d_baseobject.h:224
VolumeData::IlluminateSurfacePoint
Bool IlluminateSurfacePoint(const RayLight *rl, Vector *col, Vector64 *light_vector, const Vector64 &p, const Vector64 &bumpn, const Vector64 &phongn, const Vector64 &orign, const Vector64 &ray_vector, ILLUMINATEFLAGS flags, const RayHitID &hitid, RAYBIT raybits, Bool cosine_cutoff)
定义: c4d_tools.h:1424
VolumeData::Free
static void Free(VolumeData *&vd)
Ray::v
Vector64 v
[READ WRITE] The rays direction vector.
定义: c4d_shader.h:589
VolumeData::CalcArea
void CalcArea(const RayLight *light, Bool nodiffuse, Bool nospecular, Float specular_exponent, const Vector64 &ray_vector, const Vector64 &p, const Vector64 &bumpn, const Vector64 &orign, RAYBIT raybits, Bool ignoreLightColor, Vector *diffuse, Vector *specular)
定义: c4d_tools.h:1390
BaseVolumeData::n
Vector64 n
[READ ONLY] The surface phong normal.
定义: c4d_shader.h:882
Ray::pp
Vector pp[3]
定义: c4d_shader.h:591
Float
maxon::Float Float
定义: ge_sys_math.h:64
VolumeData::GetRay
void GetRay(Float x, Float y, Ray *ray) const
定义: c4d_tools.h:1695
VolumeData::GetLightCount
Int32 GetLightCount() const
定义: c4d_tools.h:1626
BaseDraw::GetSceneCamera
BaseObject * GetSceneCamera(const BaseDocument *doc)
定义: c4d_basedraw.h:829
GePrint
void GePrint(const maxon::String &str)
BaseDraw
定义: c4d_basedraw.h:747
maxon::Vec3::z
T z
定义: vec.h:34
String
定义: c4d_string.h:38
Ray::transport
Vector transport
[READ ONLY] The current ray intensity (for special shadow calculation). A ray starts with intensity 1...
定义: c4d_shader.h:602
BaseVolumeData::col
Vector col
[READ WRITE] Set the calculated color within MaterialData::CalcSurface() and MaterialData::CalcVolume...
定义: c4d_shader.h:871
maxon::Vec3< maxon::Float64, 1 >
maxon::Vec3::x
T x
定义: vec.h:32
VolumeData::GetRS
Bool GetRS(const RayHitID &hitid, const Vector64 &p, Float *r, Float *s) const
定义: c4d_tools.h:1587
VolumeData::Alloc
static VolumeData * Alloc(void)
RDATA_XRES
@ RDATA_XRES
定义: drendersettings.h:152
BaseDocument::GetRenderBaseDraw
BaseDraw * GetRenderBaseDraw(void)
maxon::Vec3::y
T y
定义: vec.h:33
VolumeData
定义: c4d_tools.h:1299
VolumeData::AttachVolumeDataFake
Bool AttachVolumeDataFake(BaseObject *camera, const BaseContainer &renderdata)
定义: c4d_tools.h:2231
Pow
Float32 Pow(Float32 v1, Float32 v2)
定义: apibasemath.h:171
BaseVolumeData::orign
Vector64 orign
[READ ONLY] The original surface normal.
定义: c4d_shader.h:881
BaseVolumeData::op
const RayObject * op
The object. Can be nullptr, always check.
定义: c4d_shader.h:920
Int32
maxon::Int32 Int32
定义: ge_sys_math.h:58
Ray::ior
Float ior
[READ WRITE] The current index of refraction.
定义: c4d_shader.h:590
Ray
定义: c4d_shader.h:581
Abs
Float32 Abs(Float32 val)
定义: apibasemath.h:186
RT_LT_AREA
#define RT_LT_AREA
Area light.
定义: c4d_raytrace.h:96
BaseDocument::GetActiveRenderData
RenderData * GetActiveRenderData(void)
BaseVolumeData::cosc
Float64 cosc
[READ ONLY] The angle between ray vector and unbumped normal.
定义: c4d_shader.h:885
BaseVolumeData::bumpn
Vector64 bumpn
[READ WRITE] The surface phong and bump normal.
定义: c4d_shader.h:878
maxon::Vec3::ClampMin
constexpr void ClampMin(const Vec3 &other=Vec3())
Set the minimum of each component.
定义: vec.h:371
CalcRestrictionInc
void CalcRestrictionInc(const ObjectRestriction *lr, const RayObject *op, Bool &nodif, Bool &nospec)
RenderData
定义: c4d_basedocument.h:136
Bool
maxon::Bool Bool
定义: ge_sys_math.h:53
BaseVolumeData::p
Vector64 p
[READ WRITE] The surface point, this can only be modified by MaterialData::Displace().
定义: c4d_shader.h:877
Exp
Float32 Exp(Float32 val)
定义: apibasemath.h:147
Ray::vv
Vector vv[3]
定义: c4d_shader.h:596