Kai-46 / PhySG

Code for PhySG: Inverse Rendering with Spherical Gaussians for Physics-based Relighting and Material Editing
MIT License
221 stars 24 forks source link

Setting SG parameter for NDF #13

Closed HollyDQWang closed 2 years ago

HollyDQWang commented 2 years ago

Thanks for the great work and releasing the code!

A quick question for the renderer: in line 175 of sg_rendering.py, why did you use $\frac{1}{roughness ^4 \cdot \pi}$ instead of 1 as the value of $\mu$? Are you using Blinn-Phong's model for the shape of D?

Kai-46 commented 2 years ago

We use disney BRDF; and that \mu term is for energy conservation in this BRDF, I think.

HollyDQWang commented 2 years ago

I see, thanks so much for the reply! I realized that it is consistent with this Cornell paper on microfacet brdf..

May I ask if you have a source code reference for this part? I checked the Disney paper and I don’t think there’s official code released.

Kai-46 commented 2 years ago

You might want to check Eq. 8.9 on this page: https://www.pbr-book.org/3ed-2018/Reflection_Models/Microfacet_Models . Note that alpha in that equation equals roughness^2 in this PhySG codebase.

HollyDQWang commented 2 years ago

Thanks so much! I now see that the alpha term is consistent with definition in Disney brdf :)