Go to the documentation of this file.
1 // Copyright 2020 Autodesk, Inc. All rights reserved.
2 //
3 // Use of this software is subject to the terms of the Autodesk license
4 // agreement provided at the time of installation or download, or which
5 // otherwise accompanies this software in either electronic or hard copy form.
12 #pragma once
13 #include "ai_nodes.h"
14 #include "ai_shaderglobals.h"
15 #include "ai_color.h"
16 #include "ai_vector.h"
17 #include "ai_ray.h"
27 struct AtLightSample {
28  AI_DEVICE AtLightSample() :
29  Lp (NULL),
30  Ldist (0.f),
31  Ld (AI_V3_ZERO),
32  Li (AI_RGB_BLACK),
33  Liu (AI_RGB_BLACK),
34  Lo (AI_RGB_BLACK),
35  pdf (0.f),
36  trace_ray_types(0) {}
38  const AtNode* Lp;
39  float Ldist;
44  float pdf;
45  uint8_t trace_ray_types;
47 };
54 AI_API void AiLightsPrepare(AtShaderGlobals* sg);
55 AI_API bool AiLightsGetSample(AtShaderGlobals* sg, AtLightSample& sample);
56 AI_API uint32_t AiLightsTrace(AtShaderGlobals* sg, const AtVector& dir, uint8_t ray_type, AtLightSample*& hits);
57 AI_API uint8_t AiLightsTraceRayTypes(AtShaderGlobals* sg);
58 AI_API void AiLightsResetCache(AtShaderGlobals* sg);
59 AI_API AtRGB AiLightsIntegrateShadowMatte(AtShaderGlobals* sg, AtBSDF *bsdf = NULL);
60 /*\}*/
68 AI_API AI_PURE AtRGB AiLightGetColor(const AtNode* node);
69 AI_API AI_PURE float AiLightGetIntensity(const AtNode* node);
70 AI_API AI_PURE float AiLightGetDiffuse(const AtNode* node);
71 AI_API AI_PURE float AiLightGetSpecular(const AtNode* node);
72 AI_API AI_PURE float AiLightGetTransmission(const AtNode* node);
73 AI_API AI_PURE float AiLightGetSSS(const AtNode* node);
74 AI_API AI_PURE float AiLightGetVolume(const AtNode* node);
75 AI_API AI_PURE float AiLightGetInfluence(const AtShaderGlobals* sg, const AtNode* node, uint8_t ray_type);
76 /*\}*/
84 AI_API bool AiLightIESLoad(const AtString filename, const unsigned int width, const unsigned int height, float* max_intensity, float* data);
86 /*\}*/
88 /*\}*/
Ray struct and various trace functions.
AI_API AI_PURE float AiLightGetDiffuse(const AtNode *node)
Fast getter method for the light's diffuse shading multiplier.
Definition: ai_lights.cpp:28
RGB color.
Definition: ai_color.h:31
float Ldist
distance from P to light source
Definition: ai_shader_lights.h:39
AI_API bool AiLightIESLoad(const AtString filename, const unsigned int width, const unsigned int height, float *max_intensity, float *data)
Loads an IES profile and returns a lat long array of intensity values.
Definition: ai_lights.cpp:97
Light sample data structure.
Definition: ai_shader_lights.h:27
This represents a node in Arnold.
AtNode struct and methods.
Vector math types, operators and utilities.
AI_API void AiLightsPrepare(AtShaderGlobals *sg)
Initialize light loop.
Definition: ai_sample_cache.cpp:281
Shader globals struct, methods and macros.
Arnold String allows for fast string comparisons.
Definition: ai_string.h:46
3D point (single precision)
Definition: ai_vector.h:29
incident radiance, same as Liu * (1 - Lo)
Definition: ai_shader_lights.h:41
AI_API AI_PURE float AiLightGetTransmission(const AtNode *node)
Fast getter method for the light's specular transmission shading multiplier.
Definition: ai_lights.cpp:40
AI_API AtRGB AiLightsIntegrateShadowMatte(AtShaderGlobals *sg, AtBSDF *bsdf=NULL)
Get the shadow or occlusion value for the current shading point and the active set of lights using th...
Definition: ai_sample_cache.cpp:442
Color types and utilities.
AI_API AI_PURE float AiLightGetInfluence(const AtShaderGlobals *sg, const AtNode *node, uint8_t ray_type)
Get light shading multiplier depending on the shading context and ray type.
Definition: ai_lights.cpp:58
AI_API void AiLightsResetCache(AtShaderGlobals *sg)
Reset the light cache before running another light loop.
Definition: ai_sample_cache.cpp:487
AI_API uint32_t AiLightsTrace(AtShaderGlobals *sg, const AtVector &dir, uint8_t ray_type, AtLightSample *&hits)
Intersect all visible lights.
Definition: ai_sample_cache.cpp:373
AI_API AI_PURE AtRGB AiLightGetColor(const AtNode *node)
Fast getter method for parameter color.
Definition: ai_lights.cpp:16
const AtNode * Lp
pointer to light node
Definition: ai_shader_lights.h:38
AI_API AI_PURE float AiLightGetSpecular(const AtNode *node)
Fast getter method for the light's specular reflection shading multiplier.
Definition: ai_lights.cpp:34
Shader globals data structure.
Definition: ai_shaderglobals.h:45
shadow occlusion factor, (1,1,1) means fully occluded
Definition: ai_shader_lights.h:43
AI_API AI_PURE float AiLightGetIntensity(const AtNode *node)
Fast getter method for parameter intensity.
Definition: ai_lights.cpp:22
float pdf
sample probability density function
Definition: ai_shader_lights.h:44
AI_API bool AiLightsGetSample(AtShaderGlobals *sg, AtLightSample &sample)
Get a sample within a light loop.
Definition: ai_sample_cache.cpp:355
unoccluded incident radiance
Definition: ai_shader_lights.h:42
uint8_t trace_ray_types
bitmask of ray types that will return light hits from AiLightsTrace
Definition: ai_shader_lights.h:45
AI_API AI_PURE float AiLightGetVolume(const AtNode *node)
Fast getter method for the light's volume shading multiplier.
Definition: ai_lights.cpp:52
AI_API uint8_t AiLightsTraceRayTypes(AtShaderGlobals *sg)
Returns bitmask of ray types for which AiLightsTrace can be used.
Definition: ai_sample_cache.cpp:421
AtVector Ld
normalized direction vector from P to the light sample
Definition: ai_shader_lights.h:40
AI_API AI_PURE float AiLightGetSSS(const AtNode *node)
Fast getter method for the light's SSS shading multiplier.
Definition: ai_lights.cpp:46

© 2020 Autodesk, Inc. · All rights reserved ·