ai_shader_closure.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_closure.h"
14#include "ai_color.h"
15#include "ai_shaderglobals.h"
16
35/* BSSRDF random walk versions */
36enum class AtRandomWalkVersion
37{
38 // This is a brute-force Monte Carlo random walk approach to subsurface scattering
39 // that produces estimates from a series of simulated interior scattering events.
40 v1 = 1,
41
42 // This is an improved version of the brute-force Monte Carlo v1, that
43 // suffers from less brightening and desaturation at corners. Please note that
44 // this change causes light to penetrate more deeply at grazing angles, which
45 // can cause an increase in noise and scattering distance.
46 v2,
47
48 // This version of the random walk SSS was designed for OpenPBR.
49 v3
50};
51
52/* BSSRDF Closures */
53AI_API AI_DEVICE AtClosure AiClosureEmpiricalBSSRDF(const AtShaderGlobals* sg, const AtRGB& weight, const AtVector& mfp, const AtRGB& albedo);
54
55AI_API AI_DEVICE AtClosure AiClosureRandomWalkBSSRDF(const AtShaderGlobals* sg, const AtRandomWalkVersion& version,
56 const AtRGB& weight, const AtVector& mfp, const AtRGB& albedo, float g = 0.0f);
57
58AI_API AI_DEVICE void AiClosureBSSRDFSetDirectIndirect(AtClosure closure, float weight_direct, float weight_indirect);
59
60/* Emission Closures */
61AI_API AI_DEVICE AtClosure AiClosureEmission(const AtShaderGlobals* sg, const AtRGB& weight);
62
63
64/* Transparency & Matte Closures */
65AI_API AI_DEVICE AtClosure AiClosureTransparent(const AtShaderGlobals* sg, const AtRGB& weight = AI_RGB_WHITE,
66 const AtClosureList interior_volume = nullptr,
67 int32_t dielectric_importance = 0,
68 float dielectric_roughness = 0,
69 float dielectric_eta = 1,
70 float transmission_shadow_density = 0.5f);
71
72AI_API AI_DEVICE AtClosure AiClosureMatte(const AtShaderGlobals* sg, const AtRGB& weight = AI_RGB_WHITE);
73
74/* Background Closure */
75AI_API AtClosure AiClosureBackground(const AtShaderGlobals* sg, const AtRGB& weight = AI_RGB_WHITE);
76
77/* Volume Closures */
78AI_API AI_DEVICE AtClosure AiClosureVolumeAbsorption(const AtShaderGlobals* sg, const AtRGB& weight);
79AI_API AI_DEVICE AtClosure AiClosureVolumeEmission(const AtShaderGlobals* sg, const AtRGB& weight);
80AI_API AI_DEVICE AtClosure AiClosureVolumeHenyeyGreenstein(const AtShaderGlobals* sg, const AtRGB& absorption, const AtRGB& scattering, const AtRGB& emission, float g = 0.f);
81AI_API AI_DEVICE AtClosure AiClosureVolumeDoubleHenyeyGreenstein(const AtShaderGlobals* sg, const AtRGB& absorption, const AtRGB& scattering, const AtRGB& emission, float g = 0.f, float g2=0.f, float w2=0.f);
82
83AI_API AI_DEVICE AtClosure AiClosureVolumeMatte(const AtShaderGlobals* sg, const AtRGB& weight);
84AI_API AI_DEVICE AtClosure AiClosureVolumeAtmosphere(const AtShaderGlobals* sg, const AtRGB& emission, const AtRGB& transparent, const AtRGB& matte);
85
86/*\}*/
Closure type and utilities.
Color types and utilities.
Shader globals struct, methods and macros.
AI_API AI_DEVICE AtClosure AiClosureMatte(const AtShaderGlobals *sg, const AtRGB &weight=AI_RGB_WHITE)
Create matte closure for surface shaders.
Definition: ai_shader_closure.cpp:259
AI_API AI_DEVICE AtClosure AiClosureVolumeDoubleHenyeyGreenstein(const AtShaderGlobals *sg, const AtRGB &absorption, const AtRGB &scattering, const AtRGB &emission, float g=0.f, float g2=0.f, float w2=0.f)
This creates a linear mix of two Henyey-Greenstein phase function lobes, of the form:
Definition: ai_shader_closure.cpp:352
AI_API AI_DEVICE AtClosure AiClosureVolumeAtmosphere(const AtShaderGlobals *sg, const AtRGB &emission, const AtRGB &transparent, const AtRGB &matte)
Create volume atmosphere closure, for legacy atmosphere shaders.
Definition: ai_shader_closure.cpp:414
AI_API AI_DEVICE AtClosure AiClosureVolumeEmission(const AtShaderGlobals *sg, const AtRGB &weight)
Create volume emission closure, for volume shaders.
Definition: ai_shader_closure.cpp:378
AI_API AI_DEVICE AtClosure AiClosureTransparent(const AtShaderGlobals *sg, const AtRGB &weight=AI_RGB_WHITE, const AtClosureList interior_volume=nullptr, int32_t dielectric_importance=0, float dielectric_roughness=0, float dielectric_eta=1, float transmission_shadow_density=0.5f)
Create transparent closure for surface shaders.
Definition: ai_shader_closure.cpp:234
AI_API AI_DEVICE AtClosure AiClosureEmpiricalBSSRDF(const AtShaderGlobals *sg, const AtRGB &weight, const AtVector &mfp, const AtRGB &albedo)
Create BSSRDF closure for subsurface scattering in surface shaders.
Definition: ai_shader_closure.cpp:140
AI_API AI_DEVICE AtClosure AiClosureEmission(const AtShaderGlobals *sg, const AtRGB &weight)
Create emission closure for surface shaders.
Definition: ai_shader_closure.cpp:203
AI_API AtClosure AiClosureBackground(const AtShaderGlobals *sg, const AtRGB &weight=AI_RGB_WHITE)
Create background closure for background surface shaders.
Definition: ai_shader_closure.cpp:272
AI_API AI_DEVICE AtClosure AiClosureRandomWalkBSSRDF(const AtShaderGlobals *sg, const AtRandomWalkVersion &version, const AtRGB &weight, const AtVector &mfp, const AtRGB &albedo, float g=0.0f)
Create BSSRDF closure for random walk subsurface scattering in surface shaders.
Definition: ai_shader_closure.cpp:164
AI_API AI_DEVICE AtClosure AiClosureVolumeAbsorption(const AtShaderGlobals *sg, const AtRGB &weight)
Create volume absorption closure, for volume shaders.
Definition: ai_shader_closure.cpp:294
AI_API AI_DEVICE void AiClosureBSSRDFSetDirectIndirect(AtClosure closure, float weight_direct, float weight_indirect)
Set the BSSRDF closure direct and indirect light contribution weights.
Definition: ai_shader_closure.cpp:185
AI_API AI_DEVICE AtClosure AiClosureVolumeMatte(const AtShaderGlobals *sg, const AtRGB &weight)
Create volume matte closure, for volume shaders.
Definition: ai_shader_closure.cpp:394
AI_API AI_DEVICE AtClosure AiClosureVolumeHenyeyGreenstein(const AtShaderGlobals *sg, const AtRGB &absorption, const AtRGB &scattering, const AtRGB &emission, float g=0.f)
Create Henyey-Greenstein volume scattering closure, for volume shaders.
Definition: ai_shader_closure.cpp:327
Definition: ai_closure.h:85
Definition: ai_closure.h:61
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

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