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

◆ AiIrradiance()

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:

AtRGB irr[NPOINTS];
AtVector p[NPOINTS];
AtVector n[NPOINTS];
for (i=0; i<NPOINTS; i++) {
p[i] = ... // set position
n[i] = ... // set normal vector
irr[i] = AiIrradiance(p[i], n[i], 0, i);
// NOTE#1: we pass 0 as thread id because this example doesn't have multi-threading
// NOTE#2: if we passed 0 instead of i, we'd get aliasing in the illumination
}
// ... save irr to file
AI_API void AiBegin(AtSessionMode default_rs_mode=AI_SESSION_BATCH)
Marks the beginning of a block which uses the Arnold rendering interface API.
Definition: ai_render.cpp:46
AI_API AtRenderErrorCode AiRender(AtRenderSession *render_session, AtRenderMode mode=AI_RENDER_MODE_CAMERA)
Prepares a render and wait synchronously until it is finished before returning.
Definition: ai_render.cpp:1034
AI_API void AiEnd()
Marks the end of a block which uses the Arnold rendering interface API.
Definition: ai_render.cpp:64
@ AI_RENDER_MODE_FREE
Process arbitrary ray-tracing requests, acting as a "ray server".
Definition: ai_render.h:37
AI_API AtRGB AiIrradiance(const AtVector &p, const AtVector &n, int tid, uint32_t pid)
Irradiance lookup at a (point,normal) pair.
Definition: ai_rtrace.cpp:1053
RGB color.
Definition: ai_color.h:32
3D point (single precision)
Definition: ai_vector.h:30
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

◆ AiRadiance()

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

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