Jump to content
  • Advertisement
Sign in to follow this  
gchewood

Most efficient way of rendering huge levels?

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

Simple question. Is there any difference in efficiency between rendering a scene (in XNA) of different 100 models as

 

1) 100 different "Model" objects.

2) 100 different meshes within 1 Model object?

 

Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement

It depends on what the models are and where they're positioned, etc

 

100 different "Model" objects should be faster because some of them might not be visible so there's no point in binding vertices and indices of meshes that won't be drawn.

 

If all models are really close (example a car in which all pieces are a different model) then they should probably be stored in a single model because they'll most likely be drawn all together so you just have to bind the vertex and index buffer once.

 

If some of the meshes also use the same material and are close to each other merge them in a single mesh so they're drawn in a single draw call.

 

PS: I'm assuming that the vertices/indices of all meshes inside a model are stored in the same vertex/index buffer (I don't have much experience with XNA).

Share this post


Link to post
Share on other sites

I agree with Tiago. Since you are referring to a "huge" level I suppose there is lot of space between the objects. When you are rendering each object independent from the other you can cull them before the render call to save gpu power and also sort them so you can avoid overdraw.

Additionally if you have many instances of one model try to use hardware instancing to save draw calls and state changes.

And yes meshparts share their vertex and indexbuffer in XNA unless they are getting to big.

Share this post


Link to post
Share on other sites

The 2 options you provide are not really related much to the final performance you will get.  Either way you will still need many draw calls each time you have to change materials, textures, shaders, etc.

 

Efficient rendering is a higher-level process and very involved.  You need to keep updated AABB’s for each object and use them for frustum culling, which can be further improved via an oct-tree.

Once you have a list of things you want to draw you need to sort them by shader, texture, and possibly depth in order to reduce the number of redundant state changes.

Then render them in sorted order.  Of course that does no good if you don’t also have a system in place for eliminating redundant state changes.  That is if the same shader is set twice in a row, the second time should be a do-nothing call.

 

If you are really worried about performance, be prepared to put in a lot of effort.

Good luck!  smile.png

 

 

L. Spiro

Edited by L. Spiro

Share this post


Link to post
Share on other sites
Sorry, I should've been clearer in explaining that all of the models would be visible at once. I was thinking about grass billboards at the time.
Hardware instancing would probably be the best solution, now I think of it. It's just easier for level-editing if you can group them into bunches of
50 (for example) billboards along a flat plane and then copy and paste to cover the map. I know it's probably better to do grass procedurally,
so I might consider that instead.

Efficient rendering is a higher-level process and very involved. You need to keep updated AABB’s for each object and use them for frustum culling, which can be further improved via an oct-tree.

Once you have a list of things you want to draw you need to sort them by shader, texture, and possibly depth in order to reduce the number of redundant state changes.

Then render them in sorted order. Of course that does no good if you don’t also have a system in place for eliminating redundant state changes. That is if the same shader is set twice in a row, the second time should be a do-nothing call.


Yeah I realised the majority of my work is ahead of me. Was just focusing on this specific problem first.

Thanks for the info people. Edited by gchewood

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!