Incorrectly weighted samples in PMREMGenerator

Description of the problem

I noticed some glb files using PBR materials looked much more metallic in three.js under a particular environment map compared to other viewers (Substance Painter and Unity). After some investigation I believe this is due to PMREMGenerator not weighting lighting samples correctly — each sample is weighted the same which causes HDR environment maps with large variations in intensity to become unsightly when convolved.

Here’s a tonemapped image that shows the problem (notice what happens to the sun in the bottom right of the bottom left face):

Here’s a screenshot of a line of sphere of increasing roughness using the map from that image:

Live examples (the assets here are rather large so it takes a bit to load):

Standalone project:

Is there a way to work around this?

Three.js version
  • Dev
  • r94
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
Hardware Requirements (graphics card, VR Device, …)

Author: Fantashit

1 thought on “Incorrectly weighted samples in PMREMGenerator

  1. Thanks for the replies y’all. @richardmonette I did try removing those values, but it didn’t make it obviously better. Bumping the number of samples up (as in helps with the visual artifacts, but I think causes over brightening.

    I may take a look at applying a better fix using the links in the thread and will send along a PR if I do.

Comments are closed.