Jump to content

second camera render only specific meshes


haestflod
 Share

Recommended Posts

Hi, I'm outlining the silhouette of a mesh when mouseovering by using this technique:
http://www.babylonjs-playground.com/#24758V#1
 

I was originally only using 1 camera but I ran into antialiasing issues. The antialiasing was turned off when the postprocess was enabled on mouseover and then on when leaving creating a flicker on nearby meshes. So I am currently using 2 cameras like in that example. However after checking performance I noticed that adding the second camera doubles the draw calls going from (~70 -> ~140)

Is there a way to tell second camera to only render the mouseovered meshes?

Link to comment
Share on other sites

Thanks that worked.

For those wondering what I did:

// Main camera has default layerMask (0x0FFFFFFF)
// Outline camera has layermask 0x20000000;

// When adding mesh to outline
mesh.layerMask = 0x2FFFFFFF;

// When clearing the outline renderTarget (disabling outline)
for (let i = 0; i < renderList.length; ++i){
  renderList[i].layerMask = 0x0FFFFFFF;
}

 

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...