You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mitsuba's implementation of the Disney BSDF disables the diffuse/sheen, clearcoat lobes for the interior (at 2 in the following diagram) as mentioned in this report: mmp/pbrt-v3#313. Presumably, this was done to avoid energy gain with several bounces as the Disney model is not strictly energy conserving.
However, the transmission lobe in the eval() function is scaled by bsdf = (1.0f - metallic) * spec_trans for the interior case, even though the interior is sampled as if it were a dielectric. This causes the transmission lobe to lose energy when spec_trans is set to a value other than 0 or 1.
The following image shows a furnace test with various spec_trans and metallic values. Roughness is set to 0 so that energy loss due to microfacet single scattering shouldn't be an issue. Ideally, the box should match the background, but it gets darker for some of the cases
Edit: Cycles does not appear to have significant issues with energy gain/loss even though it does not disable lobes for the interior.
Edit2: For the interior, I found Cycles evaluates the dielectric/metallic/clearcoat lobes as if the surface was hit from the outside i.e. eta is not flipped and fresnel is calculated accordingly, similar to how the twosided adapter handles backfaces. Only the specular BSDF closely couples reflection/transmission and the interface is properly handled, otherwise all other lobes just treat the inside the same way as the outer surface. I've tried doing it this way in my toy renderer and the energy gain issue mentioned in mmp/pbrt-v3#313 goes away, mainly due to the dielectric layer/lobe. Here is a .blend file and the corresponding OSL code if you wish to try it out: Principled BSDF OSL.zip.
Turns out I was very wrong about a couple of things:
After cranking up the bounces in Cycles and disabling clamping, it has all the same issues with the interior when clearcoat and sheen are used. Most likely people don't experience these issues as clamping is enabled and bounces are set to a fairly low amount.
My renderer wasn't handling fresnel coefficients correctly while sampling which is why I didn't have issues with fireflies (my implementation was incorrect). After spending a lot of time fixing all the issues, I have to come to the same conclusion as the project report and disabling lobes for the interior makes a lot of sense now :) Losing energy is much better than gaining more with each bounce and eventually blowing up the scene.
@knightcrawler25 Thanks for keeping this issue updated.
We've been getting quite a few issues concerning the principled plugin, and I've been meaning to take a deeper look into its implementation.
Summary
The Principled BSDF loses energy due to the way the transmission lobe is scaled for the interior case
System configuration
OS: Windows-10
CPU: AMD64 Family 23 Model 113 Stepping 0, AuthenticAMD
GPU: NVIDIA GeForce RTX 3060 Ti
Python: 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]
NVidia driver: 527.41
CUDA: 12.0.76
LLVM: 10.0.0
Dr.Jit: 0.3.2
Mitsuba: 3.1.1
Is custom build? False
Compiled with: MSVC 19.34.31933.0
Variants:
scalar_rgb
scalar_spectral
cuda_ad_rgb
llvm_ad_rgb
Description
Mitsuba's implementation of the Disney BSDF disables the diffuse/sheen, clearcoat lobes for the interior (at 2 in the following diagram) as mentioned in this report: mmp/pbrt-v3#313. Presumably, this was done to avoid energy gain with several bounces as the Disney model is not strictly energy conserving.
However, the transmission lobe in the eval() function is scaled by
bsdf = (1.0f - metallic) * spec_trans
for the interior case, even though the interior is sampled as if it were a dielectric. This causes the transmission lobe to lose energy when spec_trans is set to a value other than 0 or 1.Line 615:
mitsuba3/src/bsdfs/principled.cpp
Lines 613 to 619 in 7e7d7b9
Similarly,
F_dielectric
in the principled_fresnel code for the interior case is scaled the same way:mitsuba3/src/bsdfs/principledhelpers.h
Line 274 in 7e7d7b9
The following image shows a furnace test with various spec_trans and metallic values. Roughness is set to 0 so that energy loss due to microfacet single scattering shouldn't be an issue. Ideally, the box should match the background, but it gets darker for some of the cases
Edit: Cycles does not appear to have significant issues with energy gain/loss even though it does not disable lobes for the interior.
Edit2: For the interior, I found Cycles evaluates the dielectric/metallic/clearcoat lobes as if the surface was hit from the outside i.e. eta is not flipped and fresnel is calculated accordingly, similar to how the twosided adapter handles backfaces. Only the specular BSDF closely couples reflection/transmission and the interface is properly handled, otherwise all other lobes just treat the inside the same way as the outer surface. I've tried doing it this way in my toy renderer and the energy gain issue mentioned in mmp/pbrt-v3#313 goes away, mainly due to the dielectric layer/lobe. Here is a .blend file and the corresponding OSL code if you wish to try it out:
Principled BSDF OSL.zip.
Edit3 (hopefully my last edit lol): The thread here shows that Arnold handles the interior the same way as Cycles i.e. the surface is evaluated as if its hit from the outside: https://groups.google.com/a/arnoldrenderer.com/g/standard.surface/c/9agBPBEkMV4
Steps to reproduce
Following is the scene file for the furnace test
The text was updated successfully, but these errors were encountered: