Sign in to follow this  

Subsets vs multiple meshes

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

Hello, I'm working on a rendering system right now and I'm facing the following dilemma: should I represent complex objects, that use multiple vertex buffers to draw (like a teapot and its lid), using one mesh with multiple subsets or multiple meshes with 1 subsets each? What are the drawbacks of such approach? Is there a significant difference in memory space management if I use an entire mesh interface for every drawable object instead of just a vertex buffer?

Share this post


Link to post
Share on other sites
I would use one non indexed triangle list for all parts in an object. Indexing would complicate a lot and may also make it slower if you never reuse a vertice. Each part of the object has a bounding, a material and an interval of vertices to draw. Your vertex data should be in a readable struct instead of a raw dump of binary data to make debugging and editing simple.

Share this post


Link to post
Share on other sites
Quote:
Original post by Dawoodoz
I would use one non indexed triangle list for all parts in an object. Indexing would complicate a lot and may also make it slower if you never reuse a vertice.
Sorry but this just isn't true. Any object more complex than a single triangle *is* going to have shared vertexes and indexing *will* give you worthwhile performance improvements. In terms of complicating the code, indexing is not complicated at all, all you need to do is read the documentation and put in the time and effort required to understand how it works.

Share this post


Link to post
Share on other sites
I think management of subsets is a tricky one. But think about it this way, if you want something to be in the same position in space or want multiple textures on one complex object use subsets.

The real dilema here is how to manage passing textures, effects (if your doing advanced lighting) and linking these things to models as needed. It comes down to your choice of architecture for your game I think.

Generally if you want to draw a complex object or piece of geometry your going to hold its position, vertex data, lighting effects used and related rendering details (such as if the subset has a need for alpha transparency on a subset like a window). With a building provided your not a physics god hellbent on having the walls deform (at least not yet) your going to be able to keep all the components of your mesh together easily. The walls, windows and the sattelite dish are all going to share object space coordinates and are all related to one entity and are all effectively groupable as a mesh. But if you want to have variants of a model say some buildings dont have a satellite dish or a flag pole or blinds and thats a boolean of the object class, you can simply switch of the drawing of that variation.

So in the rendering for the object class you can use subsets to control textures applied (or handle that yourself through render details (if you want to use blends)) that way you can have primitive control over lighting effects per component of an object. Of course based on your game this is all scalable.

My main point is that if you are not using graphics shaders yet and still using the FVF try to use subsets per "object" because in the greater scheme of things grouping the details of one entity together is the only real practical use of such a function and it saves you having multiple objects to worry about when your talking about one thing and its verticies.

On an alternative approach another use based on what your doing might be in a complex scene this. To buffer levels of detail for afew objects (such as units on an RTS) so that you dont need to keep going in and out of hard drive memory you can store LOD in different subsets of a complex mesh. That way you can reduce the verticies thrown to the graphics card based on the viewers distance to the unit without a massive lag whenever you zoom in and out loading the different models in and out. That is probably a more common implementation of subsets. I guess it just shows that its a game dependent (but still useful) component of DX. I would probably use it for both of these things and have a value to dictate if it was a model that needed flexible detail (without realtime tesseltation) such as a basic RTS unit or if it was used to create variants of buildings in my game world without the need for alot of complex algorithms on my part.

Share this post


Link to post
Share on other sites

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