Jump to content
  • Advertisement
Sign in to follow this  
JustChris

Skip meshes for rendering, using multiple instances

This topic is 3429 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

If I was using instanced geometry for a scene and only wanted to render certain instances of a mesh, which is updated as the program runs, how do I skip the ones I don't want to render? Changing the amount in SetStreamSourceFreq() just ignores the ones from the end of the list. Thinking about that further, my best idea for a solution is to mark each instanced mesh as renderable or non-renderable in some array-like structure. And for every set of instance data in the vertex buffer, use it if it's renderable or do a swap with the last vertex in the buffer if it's not. The idea for that is to move all the renderables' data to the beginning of the vertex buffer so that updating the amount of instaces in SetStreamSourceFreq() won't render those. Would this be a good solution, or are there easier/more efficient ways to achieve what I need? Or is instancing actually getting in the way of the "skip meshes to render" problem?

Share this post


Link to post
Share on other sites
Advertisement
Normally instancing has two buffers, one the geometry, the other the instance data. The instance data is normally dynamic, and would change every frame to include the relevant instances only.

Share this post


Link to post
Share on other sites
Quote:
Original post by ET3D
Normally instancing has two buffers, one the geometry, the other the instance data. The instance data is normally dynamic, and would change every frame to include the relevant instances only.


I know this already, which is why I came up with the idea of reordering the the instance data. But from what you are saying, do you mean that I can resize the vertex buffer as well?

Share this post


Link to post
Share on other sites
Yep, just rewrite the instance buffer each time a change occur inside the instance list with Map...UnMap / Lock...Unlock with Discard. (an instance has become invisibile)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!