PMREM envMap bad performance
See original GitHub issueRecently I’ve been migrating my app from normal cubemap to PMREM and noticing 3-5x drop in performance (it was 50fps, but now is just 11fps using PMREM).
After looking around in the source code to find out the difference, I see in fragment shader, function textureCubeUV
has 1 to 2 calls to bilinearCubeUV
, each call will access the envMap 4 times:
https://github.com/mrdoob/three.js/blob/c1ea11e4ff7aaa41334cd8d2154a5cd55b94b641/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js#L118
So each pixel will access envMap texture 4 or 8 times per frame? I guess this is where the performance drop come from.
Could the PMREM code can be improved somehow to achieve better performance?
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
How to get higher resolution environment map reflections
Hi all, does anyone know how to get higher resolution reflections? Thanks! I get very pixelated reflections in a smooth metallic material, ...
Read more >AMD Cubemapgen for physically based rendering
A PMREM is an environment map (in our case a cubemap) where each mipmap ... due to their size (and cubemapgen badly export...
Read more >How can i render the PMREM environment map when copying ...
I'd like to know if there is a straightforward way to render the PMREM cubemap, in this particular material template and have it...
Read more >Environment-based lighting and reflections in three.js and ...
I used a relatively low resolution (640x480) to prioritize performance. ... PMREM stands for Prefiltered Mipmap Radiance Environment Map, ...
Read more >[Solved]-How can i render the PMREM environment map when ...
Coding example for the question How can i render the PMREM environment map when copying MeshStandardMaterial into a ShaderMaterial-three.js.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Ben-Mack 100s of different materials? The draw call overhead alone could be a bigger problem. Is there no way to combine them with texture atlasing? In any case, if you can share an example we can test with/without PMREM then we’ll have a much better chance of improving the performance.
…except for
CubeCamera.renderTarget
. See #22236.