53 : weight(weight), reverse_pdf(reverse_pdf), pdf(pdf) { }
56 : weight(eval), reverse_pdf(1.0f), pdf(1.0f) { }
85 const float wavelength,
91 AtRGB (*Albedo)(
const AtBSDF* bsdf,
94 bool (*Merge)(AtBSDF* bsdf,
95 const AtBSDF* other_bsdf);
101#define AI_BSDF_EXPORT_METHODS(tag) \
105static AtBSDFMethods ai_bsdf_methods = { \
114AtBSDFMethods* tag = &ai_bsdf_methods;
126static void Init(const AtShaderGlobals* sg, \
142static AtBSDFLobeMask Eval(const AtBSDF* bsdf, \
143 const AtVector& wi, \
144 const AtBSDFLobeMask lobe_mask, \
145 const bool need_pdf, \
146 AtBSDFLobeSample out_lobes[])
158static AtBSDFLobeMask Sample(const AtBSDF* bsdf, \
159 const AtVector rnd, \
160 const float wavelength, \
161 const AtBSDFLobeMask lobe_mask, \
162 const bool need_pdf, \
163 AtVectorDv& out_wi, \
164 int& out_lobe_index, \
165 AtBSDFLobeSample out_lobes[])
171static AtRGB Albedo(const AtBSDF* bsdf, const AtShaderGlobals* sg, const AtBSDFLobeMask lobe_mask); \
172AI_OPTIONAL_METHOD_INSTALL(ai_bsdf_methods, Albedo) \
173static AtRGB Albedo(const AtBSDF* bsdf, const AtShaderGlobals* sg, const AtBSDFLobeMask lobe_mask)
186static bool Merge(AtBSDF* bsdf, const AtBSDF* other_bsdf); \
187AI_OPTIONAL_METHOD_INSTALL(ai_bsdf_methods, Merge) \
188static bool Merge(AtBSDF* bsdf, const AtBSDF* other_bsdf)
196#define bsdf_interior \
197static AtClosureList Interior(const AtShaderGlobals* sg, AtBSDF* bsdf); \
198AI_OPTIONAL_METHOD_INSTALL(ai_bsdf_methods, Interior) \
199static AtClosureList Interior(const AtShaderGlobals* sg, AtBSDF* bsdf)
214AI_API AI_DEVICE
void AiBSDFGetDirectIndirect(
const AtBSDF* bsdf,
float& weight_direct,
float& weight_indirect);
228 const AtVector& N,
float r = 0.0f,
bool transmission =
false,
233 float eta,
float rx,
float ry, uint8_t exit_type = 0,
239 float ior,
float rx,
float ry, uint8_t exit_type,
241 int32_t dielectric_importance);
245 float ior,
float rx,
float ry,
float dispersion,
251 float ior,
float rx,
float ry,
float dispersion,
253 uint8_t exit_type,
const AtString label,
254 int32_t dielectric_importance);
258 float eta,
float rx,
float ry,
265 const AtRGB& n,
const AtRGB& k,
float rx,
float ry,
269 const AtVector& tangent,
const float roughness,
const float eta,
283#define AI_MICROFACET_BECKMANN 0x00
284#define AI_MICROFACET_GGX 0x01
Color types and utilities.
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
AtBSDFLobeFlags
BSDF Lobe flags.
Definition: ai_shader_bsdf.h:29
AI_API AI_DEVICE void AiMicrofacetSetThinFilm(AtBSDF *bsdf, float thickness, float eta)
Set the thickness and refractive index of a thin film layered on top of a microfacet surface.
Definition: ai_shader_bsdf.cpp:799
AI_API AI_DEVICE void AiBSDFGetDirectIndirect(const AtBSDF *bsdf, float &weight_direct, float &weight_indirect)
Get the BSDF direct and indirect light contribution weights.
Definition: ai_shader_bsdf.cpp:781
AI_API AI_DEVICE AtBSDF * AidEonBSDF(const AtShaderGlobals *sg, const AtRGB &absorption, const AtRGB weights[3], const AtVector &tangent, const float roughness, const float eta, const float tilt, const AtString label=AtString())
Create d'Eon BSDF for hair.
Definition: ai_shader_bsdf.cpp:489
AI_API const AtBSDFLobeInfo * AiBSDFGetLobes(const AtBSDF *bsdf)
Get BSDF lobes, available after the BSDF has been initialized.
Definition: ai_shader_bsdf.cpp:726
AI_API AI_DEVICE AtBSDF * AiMicrofacetRefractionBSDF(const AtShaderGlobals *sg, const AtRGB &weight, int distribution, const AtVector &N, const AtVector *U, float ior, float rx, float ry, float dispersion, bool use_fresnel=true, AtClosureList interior=NULL, uint8_t exit_type=0, const AtString label=AtString())
Create microfacet refraction BSDF.
Definition: ai_shader_bsdf.cpp:365
AI_API void AiBSDFIntegrate(AtShaderGlobals *sg, AtRGB *direct, AtRGB *indirect, AtBSDF *bsdf)
Returns the direct and indirect radiance reflected by the provided BSDF.
Definition: ai_shader_bsdf.cpp:611
AI_API AI_DEVICE AtRGB AiBSDFAlbedo(const AtShaderGlobals *sg, AtBSDF *bsdf)
Returns BSDF albedo for incident direction sg->Rd, i.e.
Definition: ai_shader_bsdf.cpp:166
AI_API AtRGB AiBSDFGetWeight(const AtBSDF *bsdf)
Get the BSDF weight.
Definition: ai_shader_bsdf.cpp:749
AI_API const AtBSDFMethods * AiBSDFGetMethods(const AtBSDF *bsdf)
Get BSDF methods.
Definition: ai_shader_bsdf.cpp:702
AI_API AI_DEVICE void AiBSDFInitNormal(AtBSDF *bsdf, const AtVector &N, bool bounding)
Initialize BSDF normal.
Definition: ai_shader_bsdf.cpp:690
AI_API AI_DEVICE AtBSDF * AiMetalBSDF(const AtShaderGlobals *sg, const AtRGB &weight, int distribution, const AtVector &N, const AtVector *U, const AtRGB &n, const AtRGB &k, float rx, float ry, const AtString label=AtString())
Create microfacet BSDF with conductive Fresnel, for metals.
Definition: ai_shader_bsdf.cpp:437
AI_API AI_DEVICE AtBSDF * AiSheenBSDF(const AtShaderGlobals *sg, const AtRGB &weight, const AtVector &N, const float r, const AtString label=AtString())
Create Sheen BSDF for cloth-like materials.
Definition: ai_shader_bsdf.cpp:563
AI_API AI_DEVICE void AiBSDFInitLobes(AtBSDF *bsdf, const AtBSDFLobeInfo *lobes, int num_lobes)
Initialize BSDF lobes.
Definition: ai_shader_bsdf.cpp:669
AI_API AI_DEVICE float AiBSDFBumpShadow(const AtVector &Ns, const AtVector &N, const AtVector &Ld)
Compute BSDF shadow factor to solve shading artifacts with bump mapping.
Definition: ai_shader_bsdf.cpp:819
uint32_t AtBSDFLobeMask
BSDF lobe bitmask.
Definition: ai_shader_bsdf.h:46
AI_API AI_DEVICE AtBSDF * AiMicrofacetBSDF(const AtShaderGlobals *sg, const AtRGB &weight, int distribution, const AtVector &N, const AtVector *U, float eta, float rx, float ry, uint8_t exit_type=0, const AtString label=AtString())
Create microfacet reflection BSDF.
Definition: ai_shader_bsdf.cpp:261
AI_API AI_DEVICE AtBSDF * AiMicrofacetRefractionBSDF_private(const AtShaderGlobals *sg, const AtRGB &weight, int distribution, const AtVector &N, const AtVector *U, float ior, float rx, float ry, float dispersion, bool use_fresnel, AtClosureList interior, uint8_t exit_type, const AtString label, int32_t dielectric_importance)
Create microfacet refraction BSDF.
Definition: ai_shader_bsdf.cpp:296
AI_API int AiBSDFGetNumLobes(const AtBSDF *bsdf)
Get the number of BSDF lobes, available after the BSDF has been initialized.
Definition: ai_shader_bsdf.cpp:737
AI_API AtBSDF * AiBSDF(const AtShaderGlobals *sg, const AtRGB &weight, const AtBSDFMethods *methods, size_t data_size)
Allocate a BSDF and data memory to store parameters.
Definition: ai_shader_bsdf.cpp:642
AI_API AI_DEVICE AtBSDF * AiZinkeBSDF(const AtShaderGlobals *sg, const AtRGB &weight, const AtVector &tangent, const AtString label=AtString())
Create Zinke BSDF for hair with Lambertian reflectance properties.
Definition: ai_shader_bsdf.cpp:532
AI_API AI_DEVICE void AiBSDFSetDirectIndirect(AtBSDF *bsdf, float weight_direct, float weight_indirect)
Set the BSDF direct and indirect light contribution weights.
Definition: ai_shader_bsdf.cpp:765
AI_API AI_DEVICE void * AiBSDFGetData(const AtBSDF *bsdf)
Get BSDF data memory to store BSDF parameters.
Definition: ai_shader_bsdf.cpp:714
AI_API AI_DEVICE AtBSDF * AiOrenNayarBSDF(const AtShaderGlobals *sg, const AtRGB &weight, const AtVector &N, float r=0.0f, bool transmission=false, const AtString label=AtString())
Create Oren-Nayar BSDF.
Definition: ai_shader_bsdf.cpp:135
AI_API AI_DEVICE AtBSDF * AiMicrofacetThinWallRefractionBSDF(const AtShaderGlobals *sg, const AtRGB &weight, int distribution, const AtVector &N, const AtVector *U, float eta, float rx, float ry, uint8_t exit_type=0, AtString label=AtString())
Create thin-walled microfacet refraction BSDF.
Definition: ai_shader_bsdf.cpp:392
AI_API AI_DEVICE float AiBSDFMinRoughness(const AtShaderGlobals *sg)
Estimate a minimum roughness for specular BSDFs, to reduce noise from caustics.
Definition: ai_shader_bsdf.cpp:868
AI_API AI_DEVICE AtBSDF * AiMicrofacetBSDF_private(const AtShaderGlobals *sg, const AtRGB &weight, int distribution, const AtVector &N, const AtVector *U, float ior, float rx, float ry, uint8_t exit_type, const AtString label, int32_t dielectric_importance)
Create microfacet reflection BSDF.
Definition: ai_shader_bsdf.cpp:209
@ AI_BSDF_LOBE_WAVELENGTH_SAMPLE
Sampling the BSDF lobe requires a wavelength
Definition: ai_shader_bsdf.h:31
@ AI_BSDF_LOBE_SINGULAR
Sampling the BSDF always returns the same direction.
Definition: ai_shader_bsdf.h:30
@ AI_BSDF_LOBE_EXIT_WHITE
If ray depth exceeded, use white color
Definition: ai_shader_bsdf.h:33
@ AI_BSDF_LOBE_EXIT_BACKGROUND
If ray depth exceeded, use background color
Definition: ai_shader_bsdf.h:32
BSDF lobe information.
Definition: ai_shader_bsdf.h:38
BSDF lobe sample.
Definition: ai_shader_bsdf.h:51
BSDF function table.
Definition: ai_shader_bsdf.h:74
Definition: ai_closure.h:85
RGB color.
Definition: ai_color.h:32
Shader globals data structure.
Definition: ai_shaderglobals.h:45
Vector with differentials.
Definition: ai_vector.h:515
3D point (single precision)
Definition: ai_vector.h:30