NVlabs / nvdiffrec

Official code for the CVPR 2022 (oral) paper "Extracting Triangular 3D Models, Materials, and Lighting From Images".
Other
2.13k stars 223 forks source link

Creating a new bsdf_256_256.bin #151

Open Contrail97 opened 9 months ago

Contrail97 commented 9 months ago

Hi there! I need to create a new envmap from the .hdr file I just downloaded, but I can't convert the .hdr file into .bin format, is there a code or paper for such things?

jmunkberg commented 9 months ago

Hello @Contrail97 ,

You can just replace the .hdr file in the config, no need to recompute the bsdf_256_256.bin file.

The bin file represents a lookup table for two terms in the split-sum shading model, tabulated based on cos(theta) and roughness, and is independent of the environment map. Please refer to "Real Shading in Unreal Engine 4", page 5-7 for details. https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf

The included bin file has been sufficient for all our tests, but if you want to recompute it, there is code for that in the document above, see float2 IntegrateBRDF( float Roughness, float NoV ) on page 7.

I hope this helps!

Contrail97 commented 9 months ago

Hello @Contrail97 ,

You can just replace the .hdr file in the config, no need to recompute the bsdf_256_256.bin file.

The bin file represents a lookup table for two terms in the split-sum shading model, tabulated based on cos(theta) and roughness, and is independent of the environment map. Please refer to "Real Shading in Unreal Engine 4", page 5-7 for details. https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf

The included bin file has been sufficient for all our tests, but if you want to recompute it, there is code for that in the document above, see float2 IntegrateBRDF( float Roughness, float NoV ) on page 7.

I hope this helps!

Now I understand, This reply helps me a lot, Thanks!

zhao-yiqun commented 8 months ago

Hello @Contrail97 ,

You can just replace the .hdr file in the config, no need to recompute the bsdf_256_256.bin file.

The bin file represents a lookup table for two terms in the split-sum shading model, tabulated based on cos(theta) and roughness, and is independent of the environment map. Please refer to "Real Shading in Unreal Engine 4", page 5-7 for details. https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf

The included bin file has been sufficient for all our tests, but if you want to recompute it, there is code for that in the document above, see float2 IntegrateBRDF( float Roughness, float NoV ) on page 7.

I hope this helps!

Hi @jmunkberg

I understand that this bsdf_256_256.bin is independent of the environment map. However, I notice that in the original pdf this is pre-computed for BRDF( IntegrateBRDF). However, in this paper and the implementation, the used lighting model is BSDF(bidirectional scattering distribution function). I wonder whether this will make some difference to the file?

Thanks in advance.

jmunkberg commented 8 months ago

Hello @zhao-yiqun ,

The lookup table represents an integration of the specular BSDF (or BRDF) of the GGX model, which is the same specular BSDF that is used in the nvdiffrec shading model.

Note that the nvdiffrec code does not handle (proper specular) transmission, only specular reflection so in our case the BSDF == BRDF. Does this answer your question?

zhao-yiqun commented 8 months ago

Thank you @jmunkberg , now I understand that.