Jump to content

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:


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:


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


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

The .hdr output from Vray is here:


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!

Link to comment
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. 



  • 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

Link to comment
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.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...