ai_shader_lights.h
Go to the documentation of this file.
1// Copyright 2021 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.
6
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"
18
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) {}
37
38 const AtNode* Lp;
39 float Ldist;
44 float pdf;
47};
48
54AI_API void AiLightsPrepare(AtShaderGlobals* sg);
55AI_API bool AiLightsGetSample(AtShaderGlobals* sg, AtLightSample& sample);
56AI_API uint32_t AiLightsTrace(AtShaderGlobals* sg, const AtVector& dir, uint8_t ray_type, AtLightSample*& hits);
57AI_API uint8_t AiLightsTraceRayTypes(AtShaderGlobals* sg);
58AI_API void AiLightsResetCache(AtShaderGlobals* sg);
59AI_API AtRGB AiLightsIntegrateShadowMatte(AtShaderGlobals* sg, AtBSDF *bsdf = NULL);
60/*\}*/
61
68AI_API AI_PURE AtRGB AiLightGetColor(const AtNode* node);
69AI_API AI_PURE float AiLightGetIntensity(const AtNode* node);
70AI_API AI_PURE float AiLightGetDiffuse(const AtNode* node);
71AI_API AI_PURE float AiLightGetSpecular(const AtNode* node);
72AI_API AI_PURE float AiLightGetTransmission(const AtNode* node);
73AI_API AI_PURE float AiLightGetSSS(const AtNode* node);
74AI_API AI_PURE float AiLightGetVolume(const AtNode* node);
75AI_API AI_PURE float AiLightGetInfluence(const AtShaderGlobals* sg, const AtNode* node, uint8_t ray_type);
76/*\}*/
77
84AI_API bool AiLightIESLoad(const AtString filename, const unsigned int width, const unsigned int height, float* max_intensity, float* data);
85
86/*\}*/
87
88/*\}*/
Color types and utilities.
AtNode struct and methods.
Ray struct and various trace functions.
Shader globals struct, methods and macros.
Vector math types, operators and utilities.
Arnold String allows for fast string comparisons.
Definition: ai_string.h:46
AI_API AI_PURE float AiLightGetDiffuse(const AtNode *node)
Fast getter method for the light's diffuse shading multiplier.
Definition: ai_lights.cpp:28
AI_API uint32_t AiLightsTrace(AtShaderGlobals *sg, const AtVector &dir, uint8_t ray_type, AtLightSample *&hits)
Intersect all lights present in the light sampling loop for a given ray type and direction as seen fr...
Definition: ai_sample_cache.cpp:395
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
uint8_t trace_ray_types
bitmask of ray types that will return light hits from AiLightsTrace
Definition: ai_shader_lights.h:45
float Ldist
distance from P to light source
Definition: ai_shader_lights.h:39
AI_API void AiLightsResetCache(AtShaderGlobals *sg)
Reset the light cache before running another light loop.
Definition: ai_sample_cache.cpp:523
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:468
const AtNode * Lp
pointer to light node
Definition: ai_shader_lights.h:38
AI_API uint8_t AiLightsTraceRayTypes(AtShaderGlobals *sg)
Returns a bitmask of ray types for which AiLightsTrace can be effectively used in the given shading c...
Definition: ai_sample_cache.cpp:447
float pdf
sample probability density function
Definition: ai_shader_lights.h:44
AI_API bool AiLightsGetSample(AtShaderGlobals *sg, AtLightSample &sample)
Get a cached light sample within a light loop.
Definition: ai_sample_cache.cpp:364
AtVector Ld
normalized direction vector from P to the light sample
Definition: ai_shader_lights.h:40
AtRGB Lo
shadow occlusion factor, (1,1,1) means fully occluded
Definition: ai_shader_lights.h:43
AtRGB Liu
unoccluded incident radiance
Definition: ai_shader_lights.h:42
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 AI_PURE float AiLightGetSSS(const AtNode *node)
Fast getter method for the light's SSS shading multiplier.
Definition: ai_lights.cpp:46
AtRGB Li
incident radiance, same as Liu * (1 - Lo)
Definition: ai_shader_lights.h:41
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
AI_API AI_PURE AtRGB AiLightGetColor(const AtNode *node)
Fast getter method for parameter color.
Definition: ai_lights.cpp:16
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 AI_PURE float AiLightGetIntensity(const AtNode *node)
Fast getter method for parameter intensity.
Definition: ai_lights.cpp:22
AI_API void AiLightsPrepare(AtShaderGlobals *sg)
Initialize light sampling loop.
Definition: ai_sample_cache.cpp:290
Light sample data structure.
Definition: ai_shader_lights.h:27
This represents a node in Arnold.
RGB color.
Definition: ai_color.h:32
Shader globals data structure.
Definition: ai_shaderglobals.h:45
3D point (single precision)
Definition: ai_vector.h:30

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