Sign in to follow this  
hcmetal

Strange HDR reflection on PBR material

Recommended Posts

Hello everyone,

I have been trying to create my own hdr environment map and use it in Babylon.

A panorama is rendered in 3s Max 2019 using the V-Ray Next (4.02.04) sun system and saved as a .hdr file.

The .hdr file is then loaded into Lys and converted to a specular .dds file, following the instructions from https://doc.babylonjs.com/how_to/physically_based_rendering

Looks fine in Lys:

lysscr.thumb.jpg.6684846d9b3c4cfc11ceb9df1d5cafbd.jpg

However, in Babylon some strange things are happening

PG: https://playground.babylonjs.com/#FDQ594

Two things to notice:

1. Reflection on the sphere with chrome pbr material. The sun looks funky:

spherescr.jpg.b4283eedc6e31cba2e5fe4b3925dc635.jpg

2. Reflection on the ground with a none metallic pbr material. The sun looks funky too:

groundscr.jpg.9326fbf6de18e0f913ca2235b0bb7a2d.jpg

Both materials have very sensitive roughness behaviour. More detail can be found in the PG.

The .hdr output from Vray is here:

vrayhdrtest.hdr

I suspect something has gone wrong during the conversion in Lys, or the original render out of V-Ray has some problem.

Hope someone can point me to the right direction.

Thanks a lot!

Share this post


Link to post
Share on other sites

Hi @hcmetal

I took a look at your playground and HDR and noticed a couple of things. 

  • When you are generating a DDS in Lys, make sure to step through the MIPs in the MIP preview slider. The brute force method is failing on your image as you can see in the screen shot below. The easiest way to fix this is to uncheck "Render ground truth specular using brute force method" as there is something in the pixels of your HDR that is making the computation fail. I normally use OpenEXR for my renders and images coming into Lys, so I would love to see if you could try exporting your environment as an EXR and see if you have the same problem. It may give us some more clarity about best practices. 

HDR_BruteForceError.thumb.PNG.e94273f3c7c3bb40d897cecc5bdb9e09.PNG

 

  • You also want to set the gamma space to false because the DDS file is in linear color space as you exported it as a 32-bit float texture. Rendering it as gamma will cause it to render too dark. I updated your playground and added our test spheres glb so that you can see all of the MIP levels present in the DDS. This is a handy test mesh to use when testing environments as it has all of the roughness values on a chrome sphere which will render all of the MIP levels for you and you can see what breaks.
  • Another good practice if you are just creating a Babylon.js sphere is to use full white for material base color as that will reflect exactly what the environment texture is. Any other color will bias what  you see and can throw you off when trying to understand what the environment is doing. 

Please let me know if you have other questions or if any of this doesn't make sense. Take care.

Edited playground: https://playground.babylonjs.com/#FDQ594#2

Raw source for HDR environment sphere test asset: https://raw.githubusercontent.com/PatrickRyanMS/SampleModels/master/ENV_Spheres/ENV_Spheres.glb

Github repo of the test sphere asset: https://github.com/PatrickRyanMS/SampleModels/tree/master/ENV_Spheres

Share this post


Link to post
Share on other sites

@Sebavan @PatrickRyan, thanks for your help!

Unchecking "Render ground truth specular using brute force method" in Lys solves the problem. 

With both .hdr and .exr format, using brute force method produce broken MIP at level 2.

@PatrickRyan, I have adopted the best practices you recommended and the lighting is much more natural.

Thank you for sharing your wisdom and experience.

Cheers!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.