class ILxShaderService

The shader service provides SDK programmers useful functions to mimic some of modo’s internal shading features.

Public Functions

float ComputeFresnel(LXtObjectID self, const LXtFVector inRay, const LXtFVector normalRay, float normReflAmt)

This function is essentially an SDK wrapper for SchlickFresnel.

float ScalarBlendValue(LXtObjectID self, float v1, float v2, float opa, int mode)

These functions are used for packet blending (like blending two materials in the shader tree).

void ColorBlendValue(LXtObjectID self, LXtFVector c, const LXtFVector c1, const LXtFVector c2, float opa, int mode)
void SquareToCircle(LXtObjectID self, float *x, float *y)

This function will convert a sample drawn from asquare 2D sampling distribution in the (-1, -1) to (1, 1) range to a circular distribution.

LxResult SampleCloud(LXtObjectID self, LXtObjectID sample, void **ppvObj)

This returns an ILxSampleCloud object. This can be used to generate sample points on a surface with xtra data attached to it. The client simply needs to provide a cloud sample interface.

LxResult MeshShaderAccessor(LXtObjectID self, LXtObjectID meshItem, void **ppvObj)
LxResult PolyShaderAccessor(LXtObjectID self, LXtObjectID meshItem, LXtPolygonID polyID, void **ppvObj)
float RussianRoulette(LXtObjectID self, LXtObjectID vector, float importance)

These shader service methods allow a custom shader to perform Russian Roulette, to stochastically and unbiasedly terminate rays. It returns the importance multiplier used to compensate for the termination of some rays.

float NextRandom(LXtObjectID self, LXtObjectID vector)

This method allows a shader to make a thread-safe request for a random float, distributed from 0.0 to 1.0.

LxResult PoissonOffset(LXtObjectID self, LXtObjectID vector, float *u, float *v)

PoissonOffset returns a 2D offset in the unit disc with a nice poisson distribution.

LxResult CollectMaterials(LXtObjectID self, LXtObjectID collection)

Given a collection, add items needed for shading.

bool GetMeshShaders(CLxLoc_Item &meshItem, CLxLoc_Shader &acc)

User Class Only:

bool GetPolyShaders(CLxLoc_Item &meshItem, LXtPolygonID polyID, CLxLoc_Shader &acc)


class ILxShader

The shader service provides SDK programmers useful functions to mimic some of modo’s internal shading features.

Public Functions

LxResult Enumerate(LXtObjectID self, LXtObjectID visitor)

This is used to actually enumerate over all the shaders in the list

LxResult Spawn(LXtObjectID self, void **ppvObj)

These are used to duplicate a shader enumerator.

LxResult ShaderItemGet(LXtObjectID self, void **ppvObj)
CLxUser_Shader(CLxLoc_Item meshItem, LXtPolygonID poly = NULL)

User Class Only:

LxResult Enum(CLxImpl_AbstractVisitor *visitor)
bool duplicate(CLxLoc_Shader &acc)
bool GetShaderItem(CLxLoc_Item &item)

User Class Only: