Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

AndrewSmart

Best approach for Direct3D...

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

Hi all, I''m working on a 3D engine for a RPG. The game map is cell based, each cell can be one of a different number of 3D models. The question is, which is the most efficient way to handle this for the Direct3D API ? I currently have 1 vertex buffer per cell which is within the "stage" area. The "stage" is the area of cells which are visible from the current viewpoint. Meshes of the respective models (from a model library) are copied into the stage cell vertex buffer as they come onto the stage. Models consist mostly of 1 texture each, and about 1000-1500 vertices each. The vertex buffer is in video RAM. This means that at any time there are around 170-200 vertex buffers, a selection of which could contain the same mesh geometry. I have to do some per model effects such as materials and lighting, and you have to bear in mind that the same model in different cells could have different properties. So at present, I have to make several RenderState changes per model, and also 1 separate call to the API to render each model. The total number of models which make up a scene would be around 170. I would also like to take advantage of HW T&L. Does anyone have any suggestions on how this could be done better, or more efficiently ? I would really like to get the frame rate up again !! Any ideas would be much appreciated Andrew

Share this post


Link to post
Share on other sites
Advertisement
Yep, generally the best plan.

You can improve on it with some "temporal coherence" knowledge though - if your game isn''t updating everything every frame, things like the lists Jim describes can be left calculated until they actually change, same for things like dynamic buffers etc.

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Thanks for those replies

The problem I see is that since each model is in it''s own vertex buffer, there needs to still be 1 Render call per cell, no matter if I build a sorted vertex list by material or not.. is this normal, or should I aim for fewer render calls ?

Agreed, if I build a sorted vertex list by material then this will keep the renderstate changes down, but I did actually start off doing this, with all models in 2 or 3 large vertex buffers, instead of 170 separate ones. This then required 1 Render call per texture basically. The performance was not as good as making 170 Render calls (1 per model) without the sorting. I suppose the overhead of doing all the sorting etc dragged it down..

I''ll play with it a bit more... it has to be more efficient to render in a texture/material sorted fashion..

Thanks again

Andrew

Share this post


Link to post
Share on other sites

  • 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!