Functions
Irradiance / Radiance API

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...
 

Detailed Description

Radiance and irradiance lookup functions.

Function Documentation

AI_API AtRGB AiIrradiance ( const AtVector p,
const AtVector n,
int  tid,
uint32_t  pid 
)

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:

1 AiBegin();
2 AiRender(AI_RENDER_MODE_FREE);
3 
4 AtRGB irr[NPOINTS];
5 AtVector p[NPOINTS];
6 AtVector n[NPOINTS];
7 
8 for (i=0; i<NPOINTS; i++) {
9  p[i] = ... // set position
10  n[i] = ... // set normal vector
11  irr[i] = AiIrradiance(p[i], n[i], 0, i);
12  // NOTE#1: we pass 0 as thread id because this example doesn't have multi-threading
13  // NOTE#2: if we passed 0 instead of i, we'd get aliasing in the illumination
14 }
15 // ... save irr to file
16 
17 AiEnd();
Parameters
pthe input shading point
nthe input shading normal
tidthread id for the irradiance calculation (used for multi-threaded code)
pida unique identifier, or point id, for this irradiance calculation, used to generate variations in the illumination sampling patterns
Returns
the irradiance at the hemisphere defined by p and n
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.

Parameters
pthe point where radiance comes from
dirthe radiance direction
nthe unit normal vector at p
objan AtNode* for the geometry object at p, usually a polymesh
facethe face in the polymesh
uthe U parametric coordinate, or barycentric coordinate for a polymesh
vthe V parametric coordinate, or barycentric coordinate for a polymesh
shaderan AtNode* for the shader at p
tidthread id for the irradiance calculation (used for multi-threaded code)
pidpoint id used to set random values
Returns
the radiance along dir from p

© 2020 Autodesk, Inc. · All rights reserved · www.arnoldrenderer.com