-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disney BSDF #313
Comments
@efylmzr : Not sure if this would help but RenderMan examples come with the source code for the Disney BSDF (PxrDisneyBsdf.cpp) and the code is generously commented. https://rmanwiki.pixar.com/display/REN24/PxrDisneyBsdf Perhaps you might find it a useful reference to see how they have implemented it in their production renderer. |
@PotatoPot6676 Would you mind sharing where this source code is available as of today? I can't manage to find it - neither on the linked website, nor PxrDisney Fridge example attached there. Thank you. |
@gracien-app Pixar provides the source code for some of their BSDF and Integrator plugins as part of the examples which can be downloaded from the RenderMan installer (You would need to register for an NCR license first). I'm unsure of the licensing that applies to the source code so you might want to steer clear of it if its not permissive. Also, Mitsuba 3 just released and @efylmzr's contributions are included in it. It might make more sense to check that repo instead as it pertains to the discussions in this thread: https://github.com/mitsuba-renderer/mitsuba3 |
@PotatoPot6676 Thank you so much. I wasn't aware Mitsuba 3 was released, and it seems that the Principled BSDF is the visual reference I was looking for. Sincerely, |
Hi, I am currently implementing the Disney BSDF in Mitsuba as a project, and I was using PBRT as my baseline implementation. Apparently PBRT has some issues, especially in transmission and thin sheet approximation. I will try to cover them all. Also there are some indetermined issues which are not explained well (or not explained at all) in Disney course notes. I saw in the comments of the code that you communicated with Brent Burley, maybe you know the correct answers.
Schlick Approximation
This is a small mistake, the ordering in
lerp()
function is wrong inFr_Schlick()
function.It should be
return Lerp(R0,SchlickWeight(cosTheta), 1);
. instead ofreturn Lerp(SchlickWeight(cosTheta), R0, 1);
Also this Schlick approximation is wrong if eta<1. It should be adjusted in case th rendering is done under water :).
BSDF Lobe
The rates for some lobes are different from what is explained in the paper. For example, the rate for Microfacet Transmission should be (1-metallic)*spec_trans . here is a rendering with metallic=1, spec_trans=1 :
The reason for the bad image is that transmission lobe is evaluated which should not be when metallic parameter is 1.
I created a flow chart for my report which can be useful.
Also sheen is not present in BSDF lobe (in PBRT implementation) which is explicitly mentioned in the course notes.
Well, from what I have understood from the 2015 Disney course notes, when all of the other lobes are turned of except BSDF , we should get the same thing as rough dielectric implementation with GGX distribution. When I render that configuration in PBRT, I get the following:
When I render the same scene with rough dielectric :
PBRT uniformly selects one of the active lobes while sampling so the convergence is pretty bad . But the main problem here is not taking care of the total internal reflection cases. Every time a total internal reflection occurs, half of the samples (in this configuration since only Microfacet reflection and transmission is turned on) are wasted, and paths can not reach anywhere for some points. After taking care of that issue in Mitsuba, I got the following (again equal probability between lobes) :
I also blended the brdf and bsdf lobe (metallic=0, spec_trans = 0 to 1) and created some renderings. With PBRT, I got this :
I was also getting the same thing with my implementation. The problem here is sampling and evaluating all of the lobes when the light is inside. (wi.z() < 0). Evaluating diffuse or retroreflection for internal reflection case did not seem right to me.(Course notes does not explain anything about this.) The most intuitive thing to do was only turning on BSDF minor lobes (MF Reflection, MF Transmission, Clearcoat and Sheen (I did not sample sheen though, just evaluated) ) when the light is inside. So when I tried that, I got the following in Mitsuba: (with importance sampling based on material parameters.):
The I used Fresnel coefficients while sampling. I got this:
Complete glass configuration was even better (it actually becomes same as the rough dielectric implementation in glass configuration):
Everything was converging quiet faster, I was getting nice looking images and it was passing most of the chi2 tests. The life was good :) until I did a rendering of a glass with clearcoat and sheen :
I do not know what is hapening here, but when I use clearcoat and sheen components for inside, everywhere is full of fireflies. (Sheen is understandable, I do not sample it.) Maybe sampling 2 different specular lobe for inside is too complicated due to internal reflections etc. In the end, I discarded sheen and clearcoat for inside case ...
Thin Model
There are only two paragraphs related to the thin model. So I am not sure about this part also but it seems that the paper is talking about a different model than the main BSDF. One thing they say in the paper is that spec_trans parameter fully blends between a fully diffuse model and a fully specular model. PBRT implementation is different from this info. When I render a thin sheet with PBRT with spec_trans = 0, I get this:
which still has specular parts. It uses the main BSDF model lobe coefficients. I think, the coefficients should be like this:
There is no mention to the clearcoat and metallic parts so I just excluded them.
When I render thin sheets with spec_trans = 0 .. 1, I get this with my implementation:
Another issue is that PBRT uses normal Microfacet Transmission implementation which is not the case. This creates bending when we are going through the thin sheet. For a thin glass, such effect is not present. Instead of that, MicrofacetReflection should be sampled and inverted to the back side of the sheet. And instead of asymmetric BRDF function, (1-F)* D * G / (4cos(i)cos(o)) must be used. To see the effect of bending, check this rendering (PBRT):
Also, instead of multiplying the square root of the color, we should multiply the true color value in bsdf evaluation when refracting. (Sqrt is for 3D case. After 2 refractions, true color value is multiplied. )
These are all the potential problems that I see. If you think that there is something wrong above, please share info.
The text was updated successfully, but these errors were encountered: