Blender V4.3
bsdf_util.h File Reference

Go to the source code of this file.

Functions

CCL_NAMESPACE_BEGIN ccl_device float2 fresnel_dielectric_polarized (float cos_theta_i, float eta, ccl_private float *r_cos_theta_t, ccl_private float2 *r_phi)
 
ccl_device_forceinline float fresnel_dielectric (float cos_theta_i, float eta, ccl_private float *r_cos_theta_t)
 
ccl_device_inline float3 refract_angle (const float3 incident, const float3 normal, const float cos_theta_t, const float inv_eta)
 
ccl_device float fresnel_dielectric_cos (float cosi, float eta)
 
ccl_device Spectrum fresnel_conductor (float cosi, const Spectrum eta, const Spectrum k)
 
ccl_device float ior_from_F0 (float f0)
 
ccl_device float F0_from_ior (float ior)
 
ccl_device float schlick_fresnel (float u)
 
ccl_device_forceinline Spectrum interpolate_fresnel_color (float3 L, float3 H, float ior, Spectrum F0)
 
ccl_device float3 ensure_valid_specular_reflection (float3 Ng, float3 I, float3 N)
 
ccl_device float3 maybe_ensure_valid_specular_reflection (ccl_private ShaderData *sd, float3 N)
 
ccl_device_inline float bsdf_principled_hair_albedo_roughness_scale (const float azimuthal_roughness)
 
ccl_device_inline Spectrum bsdf_principled_hair_sigma_from_reflectance (const Spectrum color, const float azimuthal_roughness)
 
ccl_device_inline Spectrum bsdf_principled_hair_sigma_from_concentration (const float eumelanin, const float pheomelanin)
 
ccl_device_inline Spectrum closure_layering_weight (const Spectrum layer_albedo, const Spectrum weight)
 
ccl_device_inline Spectrum iridescence_lookup_sensitivity (float OPD, float shift)
 
ccl_device_inline float3 iridescence_airy_summation (float T121, float R12, float R23, float OPD, float phi)
 
ccl_device Spectrum fresnel_iridescence (KernelGlobals kg, float eta1, float eta2, float eta3, float cos_theta_1, float thickness, ccl_private float *r_cos_theta_3)
 

Function Documentation

◆ bsdf_principled_hair_albedo_roughness_scale()

ccl_device_inline float bsdf_principled_hair_albedo_roughness_scale ( const float azimuthal_roughness)

◆ bsdf_principled_hair_sigma_from_concentration()

ccl_device_inline Spectrum bsdf_principled_hair_sigma_from_concentration ( const float eumelanin,
const float pheomelanin )

Definition at line 248 of file bsdf_util.h.

References make_float3(), and rgb_to_spectrum().

Referenced by svm_node_closure_bsdf().

◆ bsdf_principled_hair_sigma_from_reflectance()

ccl_device_inline Spectrum bsdf_principled_hair_sigma_from_reflectance ( const Spectrum color,
const float azimuthal_roughness )

Definition at line 241 of file bsdf_util.h.

References bsdf_principled_hair_albedo_roughness_scale(), and log().

Referenced by svm_node_closure_bsdf().

◆ closure_layering_weight()

ccl_device_inline Spectrum closure_layering_weight ( const Spectrum layer_albedo,
const Spectrum weight )

Definition at line 261 of file bsdf_util.h.

References reduce_max(), safe_divide_color(), and saturatef.

Referenced by flatten_closure_tree(), and svm_node_closure_bsdf().

◆ ensure_valid_specular_reflection()

ccl_device float3 ensure_valid_specular_reflection ( float3 Ng,
float3 I,
float3 N )

Definition at line 144 of file bsdf_util.h.

References b, dot(), I, kernel_assert, min, N, R, safe_normalize_fallback(), safe_sqrtf(), sqr(), and X.

Referenced by maybe_ensure_valid_specular_reflection().

◆ F0_from_ior()

ccl_device float F0_from_ior ( float ior)

◆ fresnel_conductor()

ccl_device Spectrum fresnel_conductor ( float cosi,
const Spectrum eta,
const Spectrum k )

Definition at line 95 of file bsdf_util.h.

References make_spectrum.

Referenced by bsdf_microfacet_setup_fresnel_conductor(), and microfacet_fresnel().

◆ fresnel_dielectric()

ccl_device_forceinline float fresnel_dielectric ( float cos_theta_i,
float eta,
ccl_private float * r_cos_theta_t )

◆ fresnel_dielectric_cos()

◆ fresnel_dielectric_polarized()

CCL_NAMESPACE_BEGIN ccl_device float2 fresnel_dielectric_polarized ( float cos_theta_i,
float eta,
ccl_private float * r_cos_theta_t,
ccl_private float2 * r_phi )

◆ fresnel_iridescence()

◆ interpolate_fresnel_color()

ccl_device_forceinline Spectrum interpolate_fresnel_color ( float3 L,
float3 H,
float ior,
Spectrum F0 )

Definition at line 125 of file bsdf_util.h.

References dot(), fresnel_dielectric_cos(), H, inverse_lerp(), L, mix, and one_spectrum.

◆ ior_from_F0()

ccl_device float ior_from_F0 ( float f0)

◆ iridescence_airy_summation()

ccl_device_inline float3 iridescence_airy_summation ( float T121,
float R12,
float R23,
float OPD,
float phi )

Definition at line 297 of file bsdf_util.h.

References iridescence_lookup_sensitivity(), make_float3(), one_float3(), R, sqr(), and sqrtf.

Referenced by fresnel_iridescence().

◆ iridescence_lookup_sensitivity()

ccl_device_inline Spectrum iridescence_lookup_sensitivity ( float OPD,
float shift )

Evaluate the sensitivity functions for the Fourier-space spectral integration. The code here uses the Gaussian fit for the CIE XYZ curves that is provided in the reference implementation. For details on what this actually represents, see the paper. In theory we should pre-compute the sensitivity functions for the working RGB color-space, remap them to be functions of (light) frequency, take their Fourier transform and store them as a LUT that gets looked up here. In practice, using the XYZ fit and converting the result from XYZ to RGB is easier.

Definition at line 284 of file bsdf_util.h.

References cos(), cosf, exp(), expf, M_2PI_F, make_float3(), pos, sqr(), sqrt(), and float3::x.

Referenced by iridescence_airy_summation().

◆ maybe_ensure_valid_specular_reflection()

◆ refract_angle()

ccl_device_inline float3 refract_angle ( const float3 incident,
const float3 normal,
const float cos_theta_t,
const float inv_eta )

◆ schlick_fresnel()

ccl_device float schlick_fresnel ( float u)

Definition at line 117 of file bsdf_util.h.

References clamp().