BlackMojito Posted April 8, 2018 Share Posted April 8, 2018 I have two questions. 1. On the first screenshot, why do I have such enormous "idle" time? It seems that it is even longer than the "render" function itself. How can I improve that? 2. On the second screenshot, it seems that PBRBaseMaterial is too much time-consuming. How can I reduce that? Is this time related to frequent shader program switch? Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted April 8, 2018 Share Posted April 8, 2018 1. because the engine loop calls rendering on requestAnimationFrame, so it's synced to a 60Hz monitor. So its a good thing, the rendering is faster than needed. Try it on a slower machine or add some few hundred meshes and physics, you quickly run out of that idle time 2. This looks really fast to me, the graph is 0.7ms from left to right... at 60Hz you have 16.777ms for every frame, so it's nice. You will only now what to optimize when you got a really high load. I try to test everything on my 3yrs old PC with GTX970 and i7 4790K, and my 6yrs old PC with Radeon 7970 and Phenom II X6 1090T. So older and older machines, new and old phones etc. Quote Link to comment Share on other sites More sharing options...
BlackMojito Posted April 8, 2018 Author Share Posted April 8, 2018 I found one thing we might be able to optimize. In PBRBaseMaterial.bindForSubMesh(), we do this._afterBind(mesh); while in StandardMaterial.bindForSubMesh(), we do this._afterBind(mesh, this._activeEffect); The active effect is actually never cached for PBR materials. So for PBR materials, var mustRebind = this._mustRebind(scene, effect, mesh.visibility); returns always false. Which leads to wasting a lot of time on rebinding stuff... Dad72 and BitOfGold 2 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted April 8, 2018 Share Posted April 8, 2018 @BlackMojito Want to submit your patch to GitHub ? Quote Link to comment Share on other sites More sharing options...
BlackMojito Posted April 9, 2018 Author Share Posted April 9, 2018 17 hours ago, Dad72 said: @BlackMojito Want to submit your patch to GitHub ? Done Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.