Kesshi 89 Posted September 20, 2018 Report Share Posted September 20, 2018 In my application i'm doing something like this: renderTarget.renderList = []; for (var mesh of myMeshes) { if(...) { renderTarget.renderList.push(mesh); } } After updateing to BJS version 3.3 i noticed a big performance issue if i do this because i have many meshes in my scene. It seems that this commit is the problem: https://github.com/BabylonJS/Babylon.js/commit/d40a5d75b461d13b5cee893a59e1a13a85b34829#diff-88a5439ab0e1c1dad3feb18bdfbc0b8c Currently everytime you call push, all meshes of the scene will be iterated. Is this intended? It takes about 250ms to update the renderList in my case. I changed my code like this to avoid that bottleneck. Now it takes about 8ms to update the renderlist. var myRenderlist = []; for (var mesh of myMeshes) { if(...) { myRenderlist.push(mesh); } } renderTarget.renderList = myRenderlist; Quote Link to post Share on other sites
Deltakosh 4315 Posted September 20, 2018 Report Share Posted September 20, 2018 This is kind of intended. The reason is that if you have meshes with materials that use this rendertarget for shadowmap, they have to regenerate the shaders. Your solution is fine but I will try to find a smarter way to deal with this problem Quote Link to post Share on other sites
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.