Radiance and irradiance lookup functions. More...
Functions | |
AI_API AtRGB | AiIrradiance (const AtVector &p, const AtVector &n, int tid, uint32_t pid) |
Irradiance lookup at a (point,normal) pair. More... | |
AI_API AtRGB | AiRadiance (const AtVector &p, const AtVector &dir, const AtVector &n, AtNode *obj, uint32_t face, float u, float v, AtNode *shader, int tid, uint32_t pid) |
Radiance lookup at a point. More... | |
Radiance and irradiance lookup functions.
Irradiance lookup at a (point,normal) pair.
This function computes the total hemispherical irradiance at a given point and normal vector, including both direct and indirect illumination.
This can be used to precompute (or "bake") lightmaps as it's typically done for videogames and other realtime applications.
Here is a snippet of code that shows how to make "free" calls to AiIrradiance() and store them in an array:
p | the input shading point |
n | the input shading normal |
tid | thread id for the irradiance calculation (used for multi-threaded code) |
pid | a unique identifier, or point id, for this irradiance calculation, used to generate variations in the illumination sampling patterns |
AI_API AtRGB AiRadiance | ( | const AtVector & | p, |
const AtVector & | dir, | ||
const AtVector & | n, | ||
AtNode * | obj, | ||
uint32_t | face, | ||
float | u, | ||
float | v, | ||
AtNode * | shader, | ||
int | tid, | ||
uint32_t | pid | ||
) |
Radiance lookup at a point.
This function computes the radiance along a given direction, coming from a given point. The local surface properties at the point must be passed in: normal vector, object, face, parametric coordinates, and shader.
This function is used in "free" mode just like AiIrradiance(). Possible uses include precomputing a spherical harmonics representation of the reflected radiance function at a point in space.
p | the point where radiance comes from |
dir | the radiance direction |
n | the unit normal vector at p |
obj | an AtNode* for the geometry object at p, usually a polymesh |
face | the face in the polymesh |
u | the U parametric coordinate, or barycentric coordinate for a polymesh |
v | the V parametric coordinate, or barycentric coordinate for a polymesh |
shader | an AtNode* for the shader at p |
tid | thread id for the irradiance calculation (used for multi-threaded code) |
pid | point id used to set random values |