Sign in to follow this  

Sorting vertices ?

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

Hey guys! Currently in my engine, i'm collecting the geometry during the render calls of my engine. And then in the end, I execute one big renderloop and render all the collected geometry. Currently I'm sorting according to textures. But I'm having some trouble with the design. Iäm not entirely sure how, to handle the vertexdata/vertexbuffer the best way using my described method. Currently I just get a pointer to each Geometry, which contains it's own vertexdata. Then when I have sorted the the vertices according to texture, I copy all the vertices from the Geometry's with the same sort of vertices into one big vertexbuffer. Then I render this buffer with only one SetStream(....) call. I would like to ask you ppl how this should be handled. Is there really any point in copying my vertices to one big vertexbuffer or should I stick with a SetStream for each Geometry? Any articles on this would really be appreciated :) If you feel like describing how you do this, hell I'll be more than happy. C ya!

Share this post


Link to post
Share on other sites
I'm not an expert on this, but most engines that I'm aware of - specifically Q3 and various derivatives - handle it much like you describe, i.e. push the triangle data to a buffer and flush it when it becomes full or the renderstate changes.

Q3 is fairly old technology now, though, and to be honest I really don't know how it's handled in modern engines like Doom3 and HL2.

But unless things have changed recently I would say you're on the right track. The amount of data associated with one geometry is usually less than the optimal amount to submit in one API call, so in general it's preferable to batch it together and submit it all at once.

Share this post


Link to post
Share on other sites
What you're essentially asking about is something known as batching. I wouldn't recommend copying your vertices into a large vertex buffer every frame. The driver can do a better job of optimization if it knows that the vertex data is static.

You'll find countless sources of information about batching simply by doing a google search. I hope this helped and if you need further information don't hesitate to ask.

Share this post


Link to post
Share on other sites
Thx, I'll be searching with google. ( btw, anyone know when the search function will be up again? )

There is one more thing I'm wondering about. Currently when I load a mesh, I create the vertexbuffer in the graphics memory. Mainly because I though it would be faster copying between two vertexbuffers in graphics memory?

But I'm concerned about when the scene grows, the graphics memory will just not be enough.

So is there any difference in copying from system memory to vertexbuffer in graphics memory? (I guess there should be, since the copying needs to be done across the agp bus?)

Share this post


Link to post
Share on other sites

This topic is 4714 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.

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