Jump to content

RenderTargetTexture.renderList.push() very slow in version 3.3


Kesshi
 Share

Recommended Posts

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;

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...