Data Structures | Variables
Shader Globals API

AtShaderGlobals structure contains data accessible during the shading process. More...

Data Structures

struct  AtShaderGlobals
 Shader globals data structure. More...
 

Variables

int32_t AtShaderGlobals::x
 X raster-space coordinate of this ray tree

 
int32_t AtShaderGlobals::y
 Y raster-space coordinate of this ray tree

 
float AtShaderGlobals::px
 subpixel X coordinate of this ray in [0,1)

 
float AtShaderGlobals::py
 subpixel Y coordinate of this ray in [0,1)

 
uint16_t AtShaderGlobals::si
 subpixel sample index

 
uint16_t AtShaderGlobals::transp_index
 transparency index

 
AtVector AtShaderGlobals::Ro
 ray origin (typically the camera position)

 
AtVector AtShaderGlobals::Rd
 ray direction (normalized)

 
float AtShaderGlobals::Rl
 ray length (|Ro-P|)

 
uint16_t AtShaderGlobals::tid
 thread ID

 
uint8_t AtShaderGlobals::Rt
 ray type

 
uint8_t AtShaderGlobals::bounces
 recursion level for the ray that created this hit

 
uint8_t AtShaderGlobals::bounces_diffuse
 ray diffuse depth level

 
uint8_t AtShaderGlobals::bounces_specular
 ray specular depth level

 
uint8_t AtShaderGlobals::bounces_reflect
 ray reflection depth level

 
uint8_t AtShaderGlobals::bounces_transmit
 ray transmission depth level

 
uint8_t AtShaderGlobals::bounces_volume
 ray volume depth level

 
bool AtShaderGlobals::fhemi
 force hemispherical lighting (use only upper hemisphere)

 
float AtShaderGlobals::time
 absolute time, between shutter-open and shutter-close

 
AtNodeAtShaderGlobals::Op
 pointer to the object being shaded

 
AtNodeAtShaderGlobals::proc
 pointer to the procedural object (if exists)

 
AtNodeAtShaderGlobals::shader
 pointer to the current shader

 
const AtShaderGlobalsAtShaderGlobals::psg
 parent shader globals (last shaded)

 
AtVector AtShaderGlobals::Po
 shading point in object-space

 
AtVector AtShaderGlobals::P
 shading point in world-space

 
AtVector AtShaderGlobals::dPdx
 surface derivative wrt screen X-axis

 
AtVector AtShaderGlobals::dPdy
 surface derivative wrt screen Y-axis

 
AtVector AtShaderGlobals::N
 shading normal (in object space during displacement)

 
AtVector AtShaderGlobals::Nf
 face-forward shading normal

 
AtVector AtShaderGlobals::Ng
 geometric normal

 
AtVector AtShaderGlobals::Ngf
 face-forward geometric normal

 
AtVector AtShaderGlobals::Ns
 smoothed normal (same as N but without bump)

 
float AtShaderGlobals::bu
 barycentric coordinate (aka alpha, or u)

 
float AtShaderGlobals::bv
 barycentric coordinate (aka beta, or v)

 
float AtShaderGlobals::u
 U surface parameter

 
float AtShaderGlobals::v
 V surface parameter

 
uint32_t AtShaderGlobals::fi
 primitive ID (triangle, curve segment, etc)

 
AtMatrix AtShaderGlobals::M
 local-to-world matrix transform

 
AtMatrix AtShaderGlobals::Minv
 world-to-local matrix transform

 
AtNode ** AtShaderGlobals::lights
 array of active lights at this shading context

 
AtLightSampleAtShaderGlobals::light_filter
 light sample (for light filter shaders)

 
uint32_t AtShaderGlobals::nlights
 number of active lights at this shading context

 
AtVector AtShaderGlobals::dPdu
 surface derivative wrt U parameter

 
AtVector AtShaderGlobals::dPdv
 surface derivative wrt V parameter

 
AtVector AtShaderGlobals::dDdx
 ray direction derivative wrt screen X-axis

 
AtVector AtShaderGlobals::dDdy
 ray direction derivative wrt screen Y-axis

 
AtVector AtShaderGlobals::dNdx
 surface normal derivative wrt screen X-axis

 
AtVector AtShaderGlobals::dNdy
 surface normal derivative wrt screen Y-axis

 
float AtShaderGlobals::dudx
 U derivative wrt screen X-axis

 
float AtShaderGlobals::dudy
 U derivative wrt screen Y-axis

 
float AtShaderGlobals::dvdx
 V derivative wrt screen X-axis

 
float AtShaderGlobals::dvdy
 V derivative wrt screen Y-axis

 
bool AtShaderGlobals::skip_shadow
 if true, don't trace shadow rays

 
uint8_t AtShaderGlobals::sc
 type of shading context

 
bool AtShaderGlobals::inclusive_traceset
 is the trace-set inclusive?

 
AtString AtShaderGlobals::traceset
 trace-set to assign to rays made from this SG

 
AtParamValue AtShaderGlobals::out
 shader output

 
AtShaderGlobalsPrivateInfo * AtShaderGlobals::privateinfo
 extra information for internal use

 

Shading Contexts

These macros let you determine the purpose that the shader globals were defined for.

AI_API AtShaderGlobalsAiShaderGlobals ()
 Allocate and initialize an AtShaderGlobals structure (a shading context) More...
 
AI_API void AiShaderGlobalsDestroy (AtShaderGlobals *sg)
 Deallocate an AtShaderGlobals struct. More...
 
#define AI_CONTEXT_SURFACE   0x00
 for ray-surface intersections

 
#define AI_CONTEXT_VOLUME   0x01
 for volume points during ray-marching

 
#define AI_CONTEXT_BACKGROUND   0x02
 for rays that don't hit any geometry

 
#define AI_CONTEXT_DISPLACEMENT   0x03
 for each vertex to be displaced

 
#define AI_CONTEXT_IMPORTANCE   0x05
 for importance sample table evaluations
 

Detailed Description

AtShaderGlobals structure contains data accessible during the shading process.

Function Documentation

◆ AiShaderGlobals()

AI_API AtShaderGlobals * AiShaderGlobals ( )

Allocate and initialize an AtShaderGlobals structure (a shading context)

Returns
a new AtShaderGlobals object

◆ AiShaderGlobalsDestroy()

AI_API void AiShaderGlobalsDestroy ( AtShaderGlobals sg)

Deallocate an AtShaderGlobals struct.

Parameters
sga shader globals context

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