Loading HDR texture directly makes the rendering result of gltf model look wired

Hi , im working on building a fidelity test tool to compare different renderers’ rendering fidelity. I don’t know whether it’s my mistake or not, but i found loading hdr texture directly makes the rendering result looks wired. For example, here’s a rendering result of using directly loaded hdr as environment texture:

Compared to using prefiltered hdr or other renderers(I put their screenshots below), loading hdr directly looks too shinny and metal.

(using prefiltered hdr in babylon)

(rendering result of the same scenario in model viewer).

Here’s another example:

(The screenshot “Babylon” here is using directly loaded HDR )

Here’s the code I use to load hdr:

const environment = new HDRCubeTexture(
scenario.lighting, this[$scene], 256, false, false, false);
this[$scene].environmentTexture = environment;

Could you give me some insight that why would loading hdr directly makes it so shinny and metal? Thank you !

Are your materials consistent across all renderers? If you have the Standard Material instead of the PBR Material on your object, that could be giving you the unexpected result.

Im using gltf models, correct me if im wrong, but I think all material information has already been specified in the gltf model and i don’t have to change that manully , right?

@Jiaxin_Sun you can not just load hdr like, they need to be prefiltered so in our latest version you can simply set to true the argument prefilterOnLoad of the hdrCubeTexture constructor to ensure your texture will be prefiltered before being used.


I update babylonjs to latest version and set to true the argument prefilterOnLoad, problem sovled! Just out of curiosity, how is prefilterOnLoad implemented? Do you call the environmentTools.createEnvTexture() function, and create an env file in memory or cache, and then load the env file? Thanks!

You should have a look at the sources as it is all Open source :slight_smile:

But no, we prefilter on the gpu in the texture itself the other part reads the gpu value to store on disk,

1 Like