Cycles: Remove MultiGGX code, replace with albedo scaling #107958
|
@ -240,7 +240,7 @@ ccl_device_forceinline Spectrum microfacet_fresnel(ccl_private const MicrofacetB
|
|||
float cosI = dot(wi, H);
|
||||
if (bsdf->ior < 1.0f) {
|
||||
/* When going from a higher to a lower IOR, we must use the transmitted angle. */
|
||||
float sinT2 = (1.0f - sqr(cosI)) / sqr(bsdf->ior);
|
||||
const float sinT2 = (1.0f - sqr(cosI)) / sqr(bsdf->ior);
|
||||
if (sinT2 >= 1.0f) {
|
||||
/* Total internal reflection */
|
||||
return refraction ? zero_spectrum() : fresnel->reflection_tint;
|
||||
|
|
|
@ -75,9 +75,9 @@ ccl_device Spectrum fresnel_conductor(float cosi, const Spectrum eta, const Spec
|
|||
return (Rparl2 + Rperp2) * 0.5f;
|
||||
}
|
||||
|
||||
ccl_device float ior_from_F0(Spectrum f0)
|
||||
ccl_device float ior_from_F0(float f0)
|
||||
{
|
||||
const float sqrt_f0 = sqrtf(clamp(average(f0), 0.0f, 0.99f));
|
||||
const float sqrt_f0 = sqrtf(clamp(f0, 0.0f, 0.99f));
|
||||
return (1.0f + sqrt_f0) / (1.0f - sqrt_f0);
|
||||
}
|
||||
|
||||
|
|
|
@ -318,7 +318,7 @@ ccl_device void osl_closure_generalized_schlick_bsdf_setup(
|
|||
bsdf->N = ensure_valid_specular_reflection(sd->Ng, sd->wi, closure->N);
|
||||
bsdf->alpha_x = closure->alpha_x;
|
||||
bsdf->alpha_y = closure->alpha_y;
|
||||
bsdf->ior = ior_from_F0(closure->f0);
|
||||
bsdf->ior = ior_from_F0(average(closure->f0));
|
||||
if (sd->flag & SD_BACKFACING) {
|
||||
bsdf->ior = 1.0f / bsdf->ior;
|
||||
}
|
||||
|
|
|
@ -310,7 +310,7 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
|
|||
#endif
|
||||
if (final_transmission > CLOSURE_WEIGHT_CUTOFF) {
|
||||
Spectrum glass_weight = weight * final_transmission;
|
||||
float3 cspec0 = base_color * specular_tint + make_float3(1.0f - specular_tint);
|
||||
Spectrum cspec0 = base_color * specular_tint + make_float3(1.0f - specular_tint);
|
||||
|
||||
/* Use single-scatter GGX. */
|
||||
if (roughness <= 5e-2f || distribution == CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID) {
|
||||
|
@ -332,7 +332,6 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
|
|||
if (bsdf && fresnel) {
|
||||
bsdf->N = valid_reflection_N;
|
||||
bsdf->T = zero_float3();
|
||||
bsdf->fresnel = fresnel;
|
||||
|
||||
bsdf->alpha_x = refl_roughness * refl_roughness;
|
||||
bsdf->alpha_y = refl_roughness * refl_roughness;
|
||||
|
@ -365,7 +364,6 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
|
|||
if (bsdf) {
|
||||
bsdf->N = valid_reflection_N;
|
||||
bsdf->T = zero_float3();
|
||||
bsdf->fresnel = NULL;
|
||||
|
||||
if (distribution == CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID)
|
||||
transmission_roughness = 1.0f - (1.0f - refl_roughness) *
|
||||
|
@ -392,7 +390,6 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
|
|||
|
||||
if (bsdf && fresnel) {
|
||||
bsdf->N = valid_reflection_N;
|
||||
bsdf->fresnel = fresnel;
|
||||
bsdf->T = zero_float3();
|
||||
|
||||
bsdf->alpha_x = roughness * roughness;
|
||||
|
@ -498,7 +495,6 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
|
|||
|
||||
bsdf->N = maybe_ensure_valid_specular_reflection(sd, N);
|
||||
bsdf->ior = 1.0f;
|
||||
bsdf->fresnel = NULL;
|
||||
|
||||
/* compute roughness */
|
||||
float anisotropy = clamp(param2, -0.99f, 0.99f);
|
||||
|
@ -558,7 +554,6 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
|
|||
if (bsdf) {
|
||||
bsdf->N = maybe_ensure_valid_specular_reflection(sd, N);
|
||||
bsdf->T = zero_float3();
|
||||
bsdf->fresnel = NULL;
|
||||
|
||||
float eta = fmaxf(param2, 1e-5f);
|
||||
eta = (sd->flag & SD_BACKFACING) ? 1.0f / eta : eta;
|
||||
|
|
Loading…
Reference in New Issue