-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PMREM envMap bad performance #19498
Comments
@Ben-Mack Thanks for giving us some performance feedback! Any texture lookup with |
It's a quite heavy model with ~500k triangles, more than 100s MeshPhysicalMaterial, benchmarked on Samsung S7. |
@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. |
I am pretty sure texture interpolation, including even mipmap interpolation can be handled fully within a texture unit. By doing multiple non-interpolated requests and then manual interpolation, we are by passing full hardware accelaration. GPU technology keeps changing but this was at least the case at one point recently: https://www.iquilezles.org/www/articles/texture/texture.htm https://www.iquilezles.org/www/articles/hwinterpolation/hwinterpolation.htm I wouldn't be surprised if NVIDIA gpus handle this differently that mobile GPUs. |
@bhouston recently I also was working on I'm running on GPU GTX1060 6gb. When I was using cubemaps (I was getting warnings in the console) but |
Closing due to lack of a live example. |
Also notice that starting from The usage of PBR materials without PMREMs was never correct. |
...except for |
Recently 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 tobilinearCubeUV
, each call will access the envMap 4 times:three.js/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js
Line 118 in c1ea11e
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?
The text was updated successfully, but these errors were encountered: