|
Blender V5.0
|
#include "kernel/closure/bsdf_util.h"#include "kernel/sample/mapping.h"#include "kernel/util/lookup_table.h"#include "util/math_fast.h"Go to the source code of this file.
Classes | |
| struct | FresnelDielectricTint |
| struct | FresnelConductor |
| struct | FresnelGeneralizedSchlick |
| struct | FresnelF82Tint |
| struct | MicrofacetBsdf |
Enumerations | |
| enum | MicrofacetType { BECKMANN , GGX } |
| enum | MicrofacetFresnel { NONE = 0 , DIELECTRIC , DIELECTRIC_TINT , CONDUCTOR , GENERALIZED_SCHLICK , F82_TINT } |
| 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 | ( | const float | alpha_x, |
| const float | alpha_y, | ||
| float3 | H ) |
Definition at line 566 of file bsdf_microfacet.h.
References BECKMANN, ccl_device_inline, expf, GGX, H, kernel_assert, len_squared(), M_1_PI_F, 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 | ( | const float | alpha_x, |
| const float | alpha_y, | ||
| const float3 | V ) |
Definition at line 531 of file bsdf_microfacet.h.
References bsdf_lambda_from_sqr_alpha_tan_n(), ccl_device_inline, sqr, and V.
Referenced by bsdf_microfacet_eval(), and bsdf_microfacet_sample().
| ccl_device_inline float bsdf_D | ( | const float | alpha2, |
| const float | cos_NH ) |
Definition at line 553 of file bsdf_microfacet.h.
References BECKMANN, ccl_device_inline, 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 | ( | const float | alpha2, |
| const float | cos_N ) |
Definition at line 539 of file bsdf_microfacet.h.
References bsdf_lambda(), and ccl_device_inline.
Referenced by bsdf_hair_huang_eval_r(), bsdf_hair_huang_eval_residual(), bump_shadowing_term(), and mnee_eval_bsdf_contribution().
| ccl_device_inline float bsdf_G | ( | const float | alpha2, |
| const float | cos_NI, | ||
| const float | cos_NO ) |
Definition at line 546 of file bsdf_microfacet.h.
References bsdf_lambda(), and ccl_device_inline.
| ccl_device_inline float bsdf_lambda | ( | const float | alpha2, |
| const float | cos_N ) |
Definition at line 525 of file bsdf_microfacet.h.
References bsdf_lambda_from_sqr_alpha_tan_n(), ccl_device_inline, 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 | ( | const float | sqr_alpha_tan_n | ) |
Definition at line 507 of file bsdf_microfacet.h.
References BECKMANN, ccl_device_inline, 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, |
| const ccl_private ShaderClosure * | sc, | ||
| const float3 | wi, | ||
| const float3 | wo, | ||
| ccl_private float * | pdf ) |
Definition at line 1071 of file bsdf_microfacet.h.
References bsdf_microfacet_eval(), ccl_device, and ccl_private.
Referenced by bsdf_eval().
| ccl_device int bsdf_microfacet_beckmann_glass_setup | ( | ccl_private MicrofacetBsdf * | bsdf | ) |
Definition at line 1060 of file bsdf_microfacet.h.
References bsdf_microfacet_eval_flag(), ccl_device, ccl_private, 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 1049 of file bsdf_microfacet.h.
References bsdf_microfacet_eval_flag(), ccl_device, ccl_private, 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, |
| const ccl_private ShaderClosure * | sc, | ||
| const float3 | Ng, | ||
| const 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 1080 of file bsdf_microfacet.h.
References bsdf_microfacet_sample(), ccl_device, and ccl_private.
Referenced by bsdf_sample().
| ccl_device int bsdf_microfacet_beckmann_setup | ( | ccl_private MicrofacetBsdf * | bsdf | ) |
Definition at line 1038 of file bsdf_microfacet.h.
References bsdf_microfacet_eval_flag(), ccl_device, ccl_private, 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, |
| const float | roughness ) |
Definition at line 997 of file bsdf_microfacet.h.
References MicrofacetBsdf::alpha_x, ccl_device, ccl_private, and fmaxf.
Referenced by bsdf_blur().
| ccl_device Spectrum bsdf_microfacet_estimate_albedo | ( | KernelGlobals | kg, |
| const ccl_private ShaderData * | sd, | ||
| const ccl_private MicrofacetBsdf * | bsdf, | ||
| const bool | eval_reflection, | ||
| const bool | eval_transmission ) |
Definition at line 423 of file bsdf_microfacet.h.
References ccl_device, ccl_private, DIELECTRIC, DIELECTRIC_TINT, dot(), F0_from_ior(), F82_TINT, fabsf, float, GENERALIZED_SCHLICK, is_zero(), kernel_data, lookup_table_read_3D(), make_spectrum, microfacet_fresnel(), mix, one_spectrum, sqrtf, THINFILM_THICKNESS_CUTOFF, 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, |
| const ccl_private ShaderClosure * | sc, | ||
| const float3 | wi, | ||
| const float3 | wo, | ||
| ccl_private float * | pdf ) |
Definition at line 587 of file bsdf_microfacet.h.
References average(), bsdf_aniso_D(), bsdf_aniso_lambda(), bsdf_D(), bsdf_lambda(), bsdf_microfacet_eval_flag(), ccl_device, ccl_private, CLOSURE_IS_GLASS, CLOSURE_IS_REFRACTION, common, 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 581 of file bsdf_microfacet.h.
References BSDF_ROUGHNESS_SQ_THRESH, ccl_device_forceinline, ccl_private, 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, |
| const ccl_private ShaderClosure * | sc, | ||
| const float3 | wi, | ||
| const float3 | wo, | ||
| ccl_private float * | pdf ) |
Definition at line 1005 of file bsdf_microfacet.h.
References bsdf_microfacet_eval(), ccl_device, 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 985 of file bsdf_microfacet.h.
References bsdf_microfacet_eval_flag(), ccl_device, ccl_private, 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 973 of file bsdf_microfacet.h.
References bsdf_microfacet_eval_flag(), ccl_device, ccl_private, 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, |
| const ccl_private ShaderClosure * | sc, | ||
| const float3 | Ng, | ||
| const 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 1015 of file bsdf_microfacet.h.
References bsdf_microfacet_sample(), ccl_device, and ccl_private.
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 961 of file bsdf_microfacet.h.
References bsdf_microfacet_eval_flag(), ccl_device, ccl_private, 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, |
| const ccl_private ShaderClosure * | sc, | ||
| const float3 | Ng, | ||
| const 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 678 of file bsdf_microfacet.h.
References average(), bsdf_aniso_D(), bsdf_aniso_lambda(), bsdf_D(), bsdf_lambda(), bsdf_microfacet_eval_flag(), ccl_device, ccl_private, common, D, dot(), fabsf, 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(), safe_divide(), sqr, to_global(), X, 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, | ||
| const ccl_private ShaderData * | sd, | ||
| ccl_private FresnelConductor * | fresnel, | ||
| const bool | preserve_energy ) |
Definition at line 825 of file bsdf_microfacet.h.
References average(), bsdf_microfacet_estimate_albedo(), ccl_device, ccl_private, CONDUCTOR, fresnel_conductor_Fss(), and microfacet_ggx_preserve_energy().
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, | ||
| const ccl_private ShaderData * | sd, | ||
| const Spectrum | color ) |
Definition at line 924 of file bsdf_microfacet.h.
References ccl_device, ccl_private, 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, | ||
| const ccl_private ShaderData * | sd ) |
Definition at line 937 of file bsdf_microfacet.h.
References average(), bsdf_microfacet_estimate_albedo(), ccl_device, ccl_private, DIELECTRIC, fresnel_dielectric_Fss(), make_spectrum, and microfacet_ggx_preserve_energy().
Referenced by svm_node_closure_bsdf().
| ccl_device void bsdf_microfacet_setup_fresnel_dielectric_tint | ( | KernelGlobals | kg, |
| ccl_private MicrofacetBsdf * | bsdf, | ||
| const ccl_private ShaderData * | sd, | ||
| ccl_private FresnelDielectricTint * | fresnel, | ||
| const bool | preserve_energy ) |
Definition at line 840 of file bsdf_microfacet.h.
References average(), bsdf_microfacet_estimate_albedo(), ccl_device, ccl_private, DIELECTRIC_TINT, fresnel_dielectric_Fss(), is_zero(), 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, | ||
| const ccl_private ShaderData * | sd, | ||
| ccl_private FresnelF82Tint * | fresnel, | ||
| const Spectrum | f82_tint, | ||
| const bool | preserve_energy ) |
Definition at line 901 of file bsdf_microfacet.h.
References average(), bsdf_microfacet_estimate_albedo(), ccl_device, ccl_private, F82_TINT, fresnel_f82_Fss(), fresnel_f82tint_B(), isequal(), microfacet_ggx_preserve_energy(), one_spectrum, 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, | ||
| const ccl_private ShaderData * | sd, | ||
| ccl_private FresnelGeneralizedSchlick * | fresnel, | ||
| const bool | preserve_energy ) |
Definition at line 862 of file bsdf_microfacet.h.
References average(), bsdf_microfacet_estimate_albedo(), ccl_device, ccl_private, F0_from_ior(), fresnel_dielectric_Fss(), 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 90 of file bsdf_microfacet.h.
References b, begin(), ccl_device_forceinline, expf, fabsf, fast_erff(), fast_ierff(), K, logf, M_2PI_F, make_float2, make_float3(), normalize, polar_to_cartesian(), signf(), sin_from_cos(), 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, |
| const ccl_private 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 226 of file bsdf_microfacet.h.
References ccl_device_forceinline, 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_f82(), fresnel_iridescence(), GENERALIZED_SCHLICK, GET_SPECTRUM_CHANNEL, i, inverse_lerp(), isequal(), kernel_assert, make_float3(), make_spectrum, min, mix, NONE, one_spectrum, powf, safe_sqrt(), saturatef, sqr, sqrt, sqrtf, THINFILM_THICKNESS_CUTOFF, and zero_spectrum.
Referenced by bsdf_microfacet_estimate_albedo(), bsdf_microfacet_eval(), bsdf_microfacet_sample(), and mnee_eval_bsdf_contribution().
| ccl_device_inline void microfacet_ggx_preserve_energy | ( | KernelGlobals | kg, |
| ccl_private MicrofacetBsdf * | bsdf, | ||
| const ccl_private ShaderData * | sd, | ||
| const Spectrum | Fss ) |
Definition at line 359 of file bsdf_microfacet.h.
References average(), ccl_device_inline, ccl_private, 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(), 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 189 of file bsdf_microfacet.h.
References ccl_device_forceinline, cross, disk_to_hemisphere(), inversesqrtf(), make_float3(), max, mix, normalize, safe_sqrtf(), sample_uniform_disk(), sqr, T1, T2, to_global(), float2::x, float3::x, float2::y, float3::y, and float3::z.
Referenced by bsdf_microfacet_sample(), and sample_wh().