Sign in to follow this  
stino

mesh sorting in render function (D3D)

Recommended Posts

stino    122
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this