|
Blender V4.3
|
#include "kernel/closure/bsdf_util.h"#include "kernel/sample/pattern.h"#include "kernel/util/lookup_table.h"Go to the source code of this file.
Classes | |
| struct | FresnelThinFilm |
| struct | FresnelDielectricTint |
| struct | FresnelConductor |
| struct | FresnelGeneralizedSchlick |
| struct | FresnelF82Tint |
| struct | MicrofacetBsdf |
Typedefs | |
| typedef struct FresnelThinFilm | FresnelThinFilm |
| typedef struct FresnelDielectricTint | FresnelDielectricTint |
| typedef struct FresnelConductor | FresnelConductor |
| typedef struct FresnelGeneralizedSchlick | FresnelGeneralizedSchlick |
| typedef struct FresnelF82Tint | FresnelF82Tint |
| typedef struct MicrofacetBsdf | MicrofacetBsdf |
Enumerations | |
| enum | MicrofacetType { BECKMANN , GGX } |
| enum | MicrofacetFresnel { NONE = 0 , DIELECTRIC , DIELECTRIC_TINT , CONDUCTOR , GENERALIZED_SCHLICK , F82_TINT } |
| typedef struct FresnelConductor FresnelConductor |
| typedef struct FresnelDielectricTint FresnelDielectricTint |
| typedef struct FresnelF82Tint FresnelF82Tint |
| typedef struct FresnelGeneralizedSchlick FresnelGeneralizedSchlick |
| typedef struct FresnelThinFilm FresnelThinFilm |
| typedef struct MicrofacetBsdf MicrofacetBsdf |
| enum MicrofacetFresnel |
| Enumerator | |
|---|---|
| NONE | |
| DIELECTRIC | |
| DIELECTRIC_TINT | |
| CONDUCTOR | |
| GENERALIZED_SCHLICK | |
| F82_TINT | |
Definition at line 23 of file bsdf_microfacet.h.
| enum MicrofacetType |
| Enumerator | |
|---|---|
| BECKMANN | |
| GGX | |
Definition at line 18 of file bsdf_microfacet.h.
| ccl_device_inline float bsdf_aniso_D | ( | float | alpha_x, |
| float | alpha_y, | ||
| float3 | H ) |
Definition at line 524 of file bsdf_microfacet.h.
References BECKMANN, expf, GGX, H, kernel_assert, len_squared(), M_PI_F, m_type, make_float3(), and sqr().
Referenced by bsdf_microfacet_eval(), and bsdf_microfacet_sample().
| ccl_device_inline float bsdf_aniso_lambda | ( | float | alpha_x, |
| float | alpha_y, | ||
| float3 | V ) |
Definition at line 489 of file bsdf_microfacet.h.
References bsdf_lambda_from_sqr_alpha_tan_n(), sqr(), and V.
Referenced by bsdf_microfacet_eval(), and bsdf_microfacet_sample().
| ccl_device_inline float bsdf_D | ( | float | alpha2, |
| float | cos_NH ) |
Definition at line 509 of file bsdf_microfacet.h.
References BECKMANN, expf, GGX, kernel_assert, M_PI_F, m_type, min, and sqr().
Referenced by bsdf_hair_huang_eval_r(), bsdf_hair_huang_eval_residual(), bsdf_microfacet_eval(), and bsdf_microfacet_sample().
| ccl_device_inline float bsdf_G | ( | float | alpha2, |
| float | cos_N ) |
Definition at line 496 of file bsdf_microfacet.h.
References bsdf_lambda().
Referenced by bsdf_hair_huang_eval_r(), and bsdf_hair_huang_eval_residual().
| ccl_device_inline float bsdf_G | ( | float | alpha2, |
| float | cos_NI, | ||
| float | cos_NO ) |
Definition at line 503 of file bsdf_microfacet.h.
References bsdf_lambda().
| ccl_device_inline float bsdf_lambda | ( | float | alpha2, |
| float | cos_N ) |
Definition at line 483 of file bsdf_microfacet.h.
References bsdf_lambda_from_sqr_alpha_tan_n(), fmaxf, and sqr().
Referenced by bsdf_G(), bsdf_G(), bsdf_Go(), bsdf_microfacet_eval(), and bsdf_microfacet_sample().
| ccl_device_inline float bsdf_lambda_from_sqr_alpha_tan_n | ( | float | sqr_alpha_tan_n | ) |
Definition at line 464 of file bsdf_microfacet.h.
References BECKMANN, GGX, inversesqrtf(), kernel_assert, m_type, and sqrtf.
Referenced by bsdf_aniso_lambda(), and bsdf_lambda().
| ccl_device Spectrum bsdf_microfacet_beckmann_eval | ( | KernelGlobals | kg, |
| ccl_private const ShaderClosure * | sc, | ||
| const float3 | Ng, | ||
| const float3 | wi, | ||
| const float3 | wo, | ||
| ccl_private float * | pdf ) |
Definition at line 1038 of file bsdf_microfacet.h.
References bsdf_microfacet_eval().
Referenced by bsdf_eval().
| ccl_device int bsdf_microfacet_beckmann_glass_setup | ( | ccl_private MicrofacetBsdf * | bsdf | ) |
Definition at line 1027 of file bsdf_microfacet.h.
References bsdf_microfacet_eval_flag(), CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID, DIELECTRIC, saturatef, SD_BSDF, and SD_BSDF_HAS_TRANSMISSION.
Referenced by osl_closure_dielectric_bsdf_setup(), osl_closure_generalized_schlick_bsdf_setup(), osl_closure_microfacet_setup(), and svm_node_closure_bsdf().
| ccl_device int bsdf_microfacet_beckmann_refraction_setup | ( | ccl_private MicrofacetBsdf * | bsdf | ) |
Definition at line 1016 of file bsdf_microfacet.h.
References bsdf_microfacet_eval_flag(), CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID, NONE, saturatef, SD_BSDF, and SD_BSDF_HAS_TRANSMISSION.
Referenced by osl_closure_dielectric_bsdf_setup(), osl_closure_generalized_schlick_bsdf_setup(), osl_closure_microfacet_setup(), and svm_node_closure_bsdf().
| ccl_device int bsdf_microfacet_beckmann_sample | ( | KernelGlobals | kg, |
| ccl_private const ShaderClosure * | sc, | ||
| float3 | Ng, | ||
| float3 | wi, | ||
| const float3 | rand, | ||
| ccl_private Spectrum * | eval, | ||
| ccl_private float3 * | wo, | ||
| ccl_private float * | pdf, | ||
| ccl_private float2 * | sampled_roughness, | ||
| ccl_private float * | eta ) |
Definition at line 1048 of file bsdf_microfacet.h.
References bsdf_microfacet_sample().
Referenced by bsdf_sample().
| ccl_device int bsdf_microfacet_beckmann_setup | ( | ccl_private MicrofacetBsdf * | bsdf | ) |
Definition at line 1005 of file bsdf_microfacet.h.
References bsdf_microfacet_eval_flag(), CLOSURE_BSDF_MICROFACET_BECKMANN_ID, NONE, saturatef, and SD_BSDF.
Referenced by osl_closure_conductor_bsdf_setup(), osl_closure_dielectric_bsdf_setup(), osl_closure_generalized_schlick_bsdf_setup(), osl_closure_microfacet_f82_tint_setup(), osl_closure_microfacet_setup(), and svm_node_closure_bsdf().
| ccl_device void bsdf_microfacet_blur | ( | ccl_private ShaderClosure * | sc, |
| float | roughness ) |
Definition at line 963 of file bsdf_microfacet.h.
References MicrofacetBsdf::alpha_x, ccl_private, and fmaxf.
Referenced by bsdf_blur().
| ccl_device Spectrum bsdf_microfacet_estimate_albedo | ( | KernelGlobals | kg, |
| ccl_private const ShaderData * | sd, | ||
| ccl_private const MicrofacetBsdf * | bsdf, | ||
| const bool | eval_reflection, | ||
| const bool | eval_transmission ) |
Definition at line 408 of file bsdf_microfacet.h.
References ccl_private, dot(), F82_TINT, fabsf, float, GENERALIZED_SCHLICK, is_zero(), kernel_data, lookup_table_read_3D(), microfacet_fresnel(), mix, one_spectrum, sqrtf, and z().
Referenced by bsdf_albedo(), bsdf_microfacet_setup_fresnel_conductor(), bsdf_microfacet_setup_fresnel_dielectric(), bsdf_microfacet_setup_fresnel_dielectric_tint(), bsdf_microfacet_setup_fresnel_f82_tint(), and bsdf_microfacet_setup_fresnel_generalized_schlick().
| ccl_device Spectrum bsdf_microfacet_eval | ( | KernelGlobals | kg, |
| ccl_private const ShaderClosure * | sc, | ||
| const float3 | Ng, | ||
| const float3 | wi, | ||
| const float3 | wo, | ||
| ccl_private float * | pdf ) |
Definition at line 547 of file bsdf_microfacet.h.
References average(), bsdf_aniso_D(), bsdf_aniso_lambda(), bsdf_D(), bsdf_lambda(), bsdf_microfacet_eval_flag(), ccl_private, CLOSURE_IS_GLASS, CLOSURE_IS_REFRACTION, D, dot(), fabsf, H, is_zero(), len, make_float3(), make_orthonormals_tangent(), microfacet_fresnel(), N, safe_divide(), sqr(), X, Y, and zero_spectrum.
Referenced by bsdf_microfacet_beckmann_eval(), and bsdf_microfacet_ggx_eval().
| ccl_device_forceinline int bsdf_microfacet_eval_flag | ( | const ccl_private MicrofacetBsdf * | bsdf | ) |
Definition at line 541 of file bsdf_microfacet.h.
References BSDF_ROUGHNESS_SQ_THRESH, and SD_BSDF_HAS_EVAL.
Referenced by bsdf_label(), bsdf_microfacet_beckmann_glass_setup(), bsdf_microfacet_beckmann_refraction_setup(), bsdf_microfacet_beckmann_setup(), bsdf_microfacet_eval(), bsdf_microfacet_ggx_glass_setup(), bsdf_microfacet_ggx_refraction_setup(), bsdf_microfacet_ggx_setup(), and bsdf_microfacet_sample().
| ccl_device Spectrum bsdf_microfacet_ggx_eval | ( | KernelGlobals | kg, |
| ccl_private const ShaderClosure * | sc, | ||
| const float3 | Ng, | ||
| const float3 | wi, | ||
| const float3 | wo, | ||
| ccl_private float * | pdf ) |
Definition at line 971 of file bsdf_microfacet.h.
References bsdf_microfacet_eval(), ccl_private, and MicrofacetBsdf::energy_scale.
Referenced by bsdf_eval().
| ccl_device int bsdf_microfacet_ggx_glass_setup | ( | ccl_private MicrofacetBsdf * | bsdf | ) |
Definition at line 951 of file bsdf_microfacet.h.
References bsdf_microfacet_eval_flag(), CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID, DIELECTRIC, saturatef, SD_BSDF, and SD_BSDF_HAS_TRANSMISSION.
Referenced by osl_closure_dielectric_bsdf_setup(), osl_closure_generalized_schlick_bsdf_setup(), osl_closure_microfacet_multi_ggx_glass_setup(), osl_closure_microfacet_setup(), precompute_ggx_glass_E(), and svm_node_closure_bsdf().
| ccl_device int bsdf_microfacet_ggx_refraction_setup | ( | ccl_private MicrofacetBsdf * | bsdf | ) |
Definition at line 939 of file bsdf_microfacet.h.
References bsdf_microfacet_eval_flag(), CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID, NONE, saturatef, SD_BSDF, and SD_BSDF_HAS_TRANSMISSION.
Referenced by osl_closure_dielectric_bsdf_setup(), osl_closure_generalized_schlick_bsdf_setup(), osl_closure_microfacet_setup(), osl_closure_refraction_setup(), and svm_node_closure_bsdf().
| ccl_device int bsdf_microfacet_ggx_sample | ( | KernelGlobals | kg, |
| ccl_private const ShaderClosure * | sc, | ||
| float3 | Ng, | ||
| float3 | wi, | ||
| const float3 | rand, | ||
| ccl_private Spectrum * | eval, | ||
| ccl_private float3 * | wo, | ||
| ccl_private float * | pdf, | ||
| ccl_private float2 * | sampled_roughness, | ||
| ccl_private float * | eta ) |
Definition at line 982 of file bsdf_microfacet.h.
References bsdf_microfacet_sample(), ccl_private, and label.
Referenced by bsdf_sample(), precompute_ggx_E(), precompute_ggx_gen_schlick_s(), and precompute_ggx_glass_E().
| ccl_device int bsdf_microfacet_ggx_setup | ( | ccl_private MicrofacetBsdf * | bsdf | ) |
Definition at line 927 of file bsdf_microfacet.h.
References bsdf_microfacet_eval_flag(), CLOSURE_BSDF_MICROFACET_GGX_ID, NONE, saturatef, and SD_BSDF.
Referenced by osl_closure_conductor_bsdf_setup(), osl_closure_dielectric_bsdf_setup(), osl_closure_generalized_schlick_bsdf_setup(), osl_closure_microfacet_f82_tint_setup(), osl_closure_microfacet_multi_ggx_aniso_setup(), osl_closure_microfacet_setup(), osl_closure_reflection_setup(), precompute_ggx_E(), precompute_ggx_gen_schlick_s(), and svm_node_closure_bsdf().
| ccl_device int bsdf_microfacet_sample | ( | KernelGlobals | kg, |
| ccl_private const ShaderClosure * | sc, | ||
| float3 | Ng, | ||
| float3 | wi, | ||
| const float3 | rand, | ||
| ccl_private Spectrum * | eval, | ||
| ccl_private float3 * | wo, | ||
| ccl_private float * | pdf, | ||
| ccl_private float2 * | sampled_roughness, | ||
| ccl_private float * | eta ) |
Definition at line 637 of file bsdf_microfacet.h.
References average(), bsdf_aniso_D(), bsdf_aniso_lambda(), bsdf_D(), bsdf_lambda(), bsdf_microfacet_eval_flag(), ccl_private, D, dot(), fabsf, float3_to_float2(), GGX, H, is_zero(), LABEL_GLOSSY, LABEL_NONE, LABEL_REFLECT, LABEL_SINGULAR, LABEL_TRANSMIT, m_type, make_float2(), make_float3(), make_orthonormals(), make_orthonormals_tangent(), microfacet_beckmann_sample_vndf(), microfacet_fresnel(), microfacet_ggx_sample_vndf(), N, refract_angle(), sqr(), X, float3::x, Y, float3::y, and float3::z.
Referenced by bsdf_microfacet_beckmann_sample(), and bsdf_microfacet_ggx_sample().
| ccl_device void bsdf_microfacet_setup_fresnel_conductor | ( | KernelGlobals | kg, |
| ccl_private MicrofacetBsdf * | bsdf, | ||
| ccl_private const ShaderData * | sd, | ||
| ccl_private FresnelConductor * | fresnel, | ||
| const bool | preserve_energy ) |
Definition at line 770 of file bsdf_microfacet.h.
References average(), B, bsdf_microfacet_estimate_albedo(), CONDUCTOR, fresnel_conductor(), microfacet_ggx_preserve_energy(), mix, one_spectrum, and saturate.
Referenced by osl_closure_conductor_bsdf_setup(), and svm_node_closure_bsdf().
| ccl_device void bsdf_microfacet_setup_fresnel_constant | ( | KernelGlobals | kg, |
| ccl_private MicrofacetBsdf * | bsdf, | ||
| ccl_private const ShaderData * | sd, | ||
| const Spectrum | color ) |
Definition at line 893 of file bsdf_microfacet.h.
References DIELECTRIC, kernel_assert, microfacet_ggx_preserve_energy(), and NONE.
Referenced by osl_closure_microfacet_multi_ggx_aniso_setup(), osl_closure_microfacet_multi_ggx_glass_setup(), osl_closure_microfacet_setup(), and svm_node_closure_bsdf().
| ccl_device void bsdf_microfacet_setup_fresnel_dielectric | ( | KernelGlobals | kg, |
| ccl_private MicrofacetBsdf * | bsdf, | ||
| ccl_private const ShaderData * | sd ) |
Definition at line 906 of file bsdf_microfacet.h.
References average(), bsdf_microfacet_estimate_albedo(), and DIELECTRIC.
Referenced by svm_node_closure_bsdf().
| ccl_device void bsdf_microfacet_setup_fresnel_dielectric_tint | ( | KernelGlobals | kg, |
| ccl_private MicrofacetBsdf * | bsdf, | ||
| ccl_private const ShaderData * | sd, | ||
| ccl_private FresnelDielectricTint * | fresnel, | ||
| const bool | preserve_energy ) |
Definition at line 792 of file bsdf_microfacet.h.
References average(), bsdf_microfacet_estimate_albedo(), DIELECTRIC_TINT, and microfacet_ggx_preserve_energy().
Referenced by osl_closure_dielectric_bsdf_setup().
| ccl_device void bsdf_microfacet_setup_fresnel_f82_tint | ( | KernelGlobals | kg, |
| ccl_private MicrofacetBsdf * | bsdf, | ||
| ccl_private const ShaderData * | sd, | ||
| ccl_private FresnelF82Tint * | fresnel, | ||
| const Spectrum | f82_tint, | ||
| const bool | preserve_energy ) |
Definition at line 859 of file bsdf_microfacet.h.
References average(), bsdf_microfacet_estimate_albedo(), F82_TINT, isequal(), microfacet_ggx_preserve_energy(), mix, one_spectrum, sqr(), and zero_spectrum.
Referenced by osl_closure_microfacet_f82_tint_setup(), and svm_node_closure_bsdf().
| ccl_device void bsdf_microfacet_setup_fresnel_generalized_schlick | ( | KernelGlobals | kg, |
| ccl_private MicrofacetBsdf * | bsdf, | ||
| ccl_private const ShaderData * | sd, | ||
| ccl_private FresnelGeneralizedSchlick * | fresnel, | ||
| const bool | preserve_energy ) |
Definition at line 809 of file bsdf_microfacet.h.
References average(), bsdf_microfacet_estimate_albedo(), F0_from_ior(), GENERALIZED_SCHLICK, inverse_lerp(), is_zero(), microfacet_ggx_preserve_energy(), mix, one_spectrum, saturate, and saturatef.
Referenced by osl_closure_generalized_schlick_bsdf_setup(), and svm_node_closure_bsdf().
| ccl_device_forceinline float3 microfacet_beckmann_sample_vndf | ( | const float3 | wi, |
| const float | alpha_x, | ||
| const float | alpha_y, | ||
| const float2 | rand ) |
Definition at line 92 of file bsdf_microfacet.h.
References b, cosf, expf, fabsf, fast_erff(), fast_ierff(), K, logf, M_2PI_F, make_float2(), make_float3(), normalize(), signf(), sin_from_cos(), sinf, sqr(), sqrtf, float2::x, float3::x, float2::y, float3::y, and float3::z.
Referenced by bsdf_microfacet_sample().
| ccl_device_forceinline void microfacet_fresnel | ( | KernelGlobals | kg, |
| ccl_private const MicrofacetBsdf * | bsdf, | ||
| const float | cos_theta_i, | ||
| ccl_private float * | r_cos_theta_t, | ||
| ccl_private Spectrum * | r_reflectance, | ||
| ccl_private Spectrum * | r_transmittance ) |
Definition at line 229 of file bsdf_microfacet.h.
References ccl_private, CLOSURE_IS_GLASS, CLOSURE_IS_REFRACTION, CONDUCTOR, DIELECTRIC, DIELECTRIC_TINT, F, F0_from_ior(), F82_TINT, float, FOREACH_SPECTRUM_CHANNEL, fresnel_conductor(), fresnel_dielectric(), fresnel_iridescence(), GENERALIZED_SCHLICK, GET_SPECTRUM_CHANNEL, inverse_lerp(), isequal(), kernel_assert, make_spectrum, mix, NONE, one_spectrum, powf, saturate, saturatef, sqr(), sqrtf, and zero_spectrum.
Referenced by bsdf_microfacet_estimate_albedo(), bsdf_microfacet_eval(), and bsdf_microfacet_sample().
| ccl_device_inline void microfacet_ggx_preserve_energy | ( | KernelGlobals | kg, |
| ccl_private MicrofacetBsdf * | bsdf, | ||
| ccl_private const ShaderData * | sd, | ||
| const Spectrum | Fss ) |
Definition at line 345 of file bsdf_microfacet.h.
References average(), CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID, CLOSURE_BSDF_MICROFACET_GGX_ID, dot(), fabsf, isequal(), kernel_assert, kernel_data, lookup_table_read(), lookup_table_read_2D(), lookup_table_read_3D(), one_spectrum, sqrtf, and z().
Referenced by bsdf_microfacet_setup_fresnel_conductor(), bsdf_microfacet_setup_fresnel_constant(), bsdf_microfacet_setup_fresnel_dielectric_tint(), bsdf_microfacet_setup_fresnel_f82_tint(), and bsdf_microfacet_setup_fresnel_generalized_schlick().
| ccl_device_forceinline float3 microfacet_ggx_sample_vndf | ( | const float3 | wi, |
| const float | alpha_x, | ||
| const float | alpha_y, | ||
| const float2 | rand ) |
Definition at line 193 of file bsdf_microfacet.h.
References cross(), inversesqrtf(), len_squared(), make_float3(), mix, normalize(), safe_sqrtf(), sample_uniform_disk(), sqr(), T1, T2, float2::x, float3::x, float2::y, float3::y, and float3::z.
Referenced by bsdf_microfacet_sample(), and sample_wh().