Jump to content
  • Advertisement
Sign in to follow this  

mesh sorting in render function (D3D)

This topic is 5456 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

Hi all, I'm rewriting my little game framework for the 3rd time and this time I want to get a good render function. I realize I have to sort my meshes and vertex buffers, if only to make sure transparent objects don't mess up the z-buffer. But to eliminate expensive pixel operations, cheap surfaces want to be rendered before expensive ones. Also, far away and really close meshes have lower priority for being rendered at all. Then again, really close meshes that are rendered -- as in the kind that blocks the camera for a frame -- want to be rendered first, because they fill the z-buffer. Actually, in general, the z-buffer wants meshes to be rendered front-to-back. Sigh. And then there's meshes that require special render modes that should not be switched to-and-back too often during one render. By those special modes I mean for example meshes using the effect classes or other shaders. Then there is highly detailed meshes, in which the amount of vertices is so high, it actually surpasses the texels in weight. Such a mesh, off course, you would like to render at a later point in the queue. So all this sounds like a few strict base rules and then a whole lot of 'fuzzy' rules. And I don't like fuzzy. So what's the best way? I was thinking of maybe giving points to each of these properties of a mesh and then adding all these up to arrive at a general how-bad-do-I-want-to-be-in-front-index for each mesh... but that would take a lot of testing. I'm hoping maybe there's some reading on this. Thanks, Stijn

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!