Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am writing a game in XNA 4 and I want to have something like a corridor. Do you think that is better to use one big and solid model, or to use multiple small parts (window, stairs, door...)?

share|improve this question
add comment

4 Answers

up vote 8 down vote accepted

In terms of graphics rendering, one large mesh is faster to draw than several smaller meshes.

If you're talking about something like a corridor, it's probably not going to be that intensive for the GPU if you send it in as a door and a floor and some walls. The smaller meshes also allow you to fiddle with positioning more easily.

If your drawing becomes a bottleneck, then consider it.

share|improve this answer
1  
It doesn't have to be faster. Take the world of Oblivion, rendering this as one would just be stupid and very slow since you can't choose what sections are visible to the player. You will end up wasting a ton of resources –  Psykocyber May 22 '11 at 14:27
1  
His example was a corridor. If he had said 'the entire world', I would've mentioned that. :P –  The Communist Duck May 22 '11 at 14:31
    
Well spoken, my bad –  Psykocyber May 22 '11 at 14:55
    
yes, my level scene is corridor link –  Vodáček May 23 '11 at 10:35
    
With that scene, definitely several elements. It would be a real pain to change the scene in 3DMax, blender or whatever. And as "The Communist Duck", if it becomes a bottleneck and you are sure its the model and not anything else, than maybe (if the performance is really that important) you can do it. –  Psykocyber May 23 '11 at 18:46
add comment

I'd suggest keeping the door as a separate model, unless you're certain you never want to be able to open it.

Windows if they are transparent also want to be separate models so they can be depth sorted appropriately for rendering.

Everything else should probably be a single model and texture for best performance, and to eliminate any cracks where they join together.

share|improve this answer
add comment

If your level has too much detail you should split it in parts and apply some frustum culling to draw only currently visible meshes.

share|improve this answer
    
I have alredy using this method, but I think that works only for whole model (not for meshes), but is posible that us depends on my drawing code. –  Vodáček May 23 '11 at 10:30
    
Whether it depends on the whole model or the meshes depends on your renderer, or how you have implemented the culling. Vertices are vertices. –  Daniel May 24 '11 at 12:19
add comment

in most cases using small parts are worth it because it gives your code reusability and flexibility; and in case of a corridor or something similar that does not include MANY (many would mean a number like at least 40) smaller parts, the performance gain of using a big and solid models is negligible(except if you are drawing the object many times per frame).

if you care about the performance i recommend precomputing the lighting or using some kind of vertex arrays(vertex buffers?) which would actually make a difference. ( if those things are possible in XNA - i dont know a lot about XNA )

p.s. : the first paragraph of this post is correct only about drawing ( not about for example using separate physics models for parts of the corridor )

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.