Cycles: Add thin film iridescence to Principled BSDF #118477

Merged
Lukas Stockner merged 18 commits from LukasStockner/blender:iridescence into main 2024-05-02 14:28:57 +02:00
1 changed files with 3 additions and 0 deletions
Showing only changes of commit 90926e8bcd - Show all commits

View File

@ -276,6 +276,9 @@ ccl_device_forceinline void microfacet_fresnel(KernelGlobals kg,
kernel_assert(fresnel->f90 == one_spectrum());
F = fresnel_iridescence(
kg, 1.0f, fresnel->thin_film.ior, bsdf->ior, cos_theta_i, fresnel->thin_film.thickness);
if (r_cos_theta_t) {
*r_cos_theta_t = -safe_sqrtf(1.0f - sqr(1.0f / bsdf->ior) * (1.0f - sqr(cos_theta_i)));
}
/* Apply F0 scaling (here per-channel, since iridescence produces colored output).
* Note that the usual approach (as used below) cannot be used here, since F may be below
* F0_real. Therefore, use a different approach: Scale the result by (F0 / F0_real), with