PBR Reflection Levels

Yo @Deltakosh or @sebavan … Is there a way to control the reflection level for a material no matter if it was explicitly set via the material or picking up scene.enviromentTexture.

Unity Reference:

In Unity if you set the roughness levels higher or lower it looks like it blurs and fades the amount of the reflection texture…so the rougher the less you see of the reflection:

In BabylonJS I have them set wit the three different roughness levels (0, 0.33 and 0.66) and you can see the different roughness levels the material but you still see pretty much that same reflection level

Any suggestions on how I can tweak the materials to look unity material ?

The actual reflection is greatly controlled by the reflection texture / environment. The default environment.intensity is one.

One thing I do , that you did not mention, when I have gotten near mirror reflection is set the material.metal close to 1. Roughness & metal seem to be related.

cc @PatrickRyan to help on that front
That being said it should work like in Unity as we use the same PBR approach

@MackeyK24, the render you have in Babylon does look wrong when comparing to the model I test with. This is the model I usually test environments with which is metallic and two dielectric materials (black and white base colors) and roughness increasing from 0.0 to 1.0 by 0.1 per step.
ENV_Spheres_3Line.zip (205.9 KB)

You can see that a value of 0.6 roughness reflections should look much blurrier than in your example.

The question I have is how your IBL was processed. Since we are using an appropriate mip level of the IBL for reflections to represent the level of roughness, it seems like this could be a problem with the IBL.

Can you share how you are authoring the IBL for the scene?

Yo @PatrickRyan

I am using cmft cli (Cubemap Filter Tool) to create .dds files.
Default-Skybox_env.dds.zip (141.9 KB)

This is the command line args that are used (generate mip chain is true):

CMFT Command Line Args:  --input "tmp-input.hdr" --filter radiance --srcFaceSize 128 --dstFaceSize 128 --excludeBase true --glossScale 16 --glossBias 8 --lightingModel blinnbrdf --generateMipChain true --numCpuProcessingThreads 4 --inputGammaNumerator 2.2 --inputGammaDenominator 1 --outputGammaNumerator 1 --outputGammaDenominator 2.2 --edgeFixup none --useOpenCL false --clVendor anyCpuVendor --deviceType cpu --deviceIndex 0 --outputNum 1 --output0 "tmp-output.dds" --output0params dds,rgba16f,cubemap

Yo @PatrickRyan

I think you are correct, it does not like the .dds file generated using CMFT (at least with the options i have chosen)

I just renamed room.dds from the playground textures to my Default-Skybox.dds and use that and got the correct roughness result:

Do you know the proper settings with CMFT to create the dds correctly ?

@MackeyK24, I don’t use CMFT and even Lys does not work anymore as Knald has not released an update that works with Windows 11 (and maybe even versions of 10, I can’t remember). I have a different path for creating environments now, which is to use the sandbox. If you drop a model in the sandbox to load the scene and then drop an .hdr file onto the scene, we will do a prefilter of the .hdr to use as an environment light. You can then open the tools tab of the inspector and export the .env file under scene export.

image

From there, you can use the env file directly in scene which will be a much smaller asset than the DDS file.

Yo @PatrickRyan … I got my background CMFT CLI working to generate proper mip levels in the output dds. I also support env files for better compression. So if you load the inspector with the dds version and export the .env file you get a compressed env of the original dds loaded with the scene. If you then stick that file right next to original dds, the toolkit will detect the .dds has a .env version and use that.

Anyways… its all built in and automatic when you export scene from the Unity Toolkit.

Also the default LDR images i was using to dynamically create the dds on export was also an issue. But if i use the valid hdr for the skybox, that the toolkit generates its dynamic dds from…

These cubes are at roughness of 0, 0.33 and 0.66

Now they show the proper mip levels

2 Likes

Thanks @PatrickRyan

1 Like