PDA

View Full Version : Questions about VertexBuffers



chronozphere
28-05-2006, 12:30 PM
Hi Guys. :)

I was wondering... what is the best way to manage your vertexbuffers in your game. How many Should you use to render a scene.

Here are just a few things you could do:

1. You can render a scene only using 2 or 3 very large vertexbuffers and put many meshes into one vertexbuffer. You just need to write a system wich manages and manipulates these meshes individualy.

2. You can give each mesh (like a skybox, a wall, or a character) in your scene its own vertexbuffer.

3. You can give each mesh more than one vertexbuffer. For example... If you make a robot you can make 6 vertexbuffers for legs, arms, torso and head.

Ok?© Here are my questions :razz: :

What is the best way??
How to get optimal render speed??
Should i use as less vertexbuffers as possible or not??
How do you guys do this??

Thanx in advance...

NecroDOME
28-05-2006, 01:24 PM
From microsoft:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/performance_optimizations.asp



# Minimize vertex buffer switches.
# Use static vertex buffers where possible.
# Use one large static vertex buffer per FVF for static objects, rather than one per object.

chronozphere
28-05-2006, 01:57 PM
Thanx Thats the info i needed. :D

So.. It looks like Method 1 is fastest.
That's great because my engine already supports method 1. Now I use 2 vertexbuffers.
One for the Console and one for the objects in my scene (so far.. Only a quad and a cube).

I still wonder what you guys do. :razz:

@NecroDome: How many vertexbuffer do you use to render SCAG??? (how many for the enviroment, enemy's, bosses etc... )

NecroDOME
28-05-2006, 02:51 PM
well, I use method 2.

Every object has it's own vertex buffer.
Objects can have a LOD, that has its own vertex buffer. So if you ave an mesh with 3 LOD's, you have 3 vertex buffers for that object.

Only the *ALL* particles share 1 vertex buffer wich hold only 1 square.

But it's still fast.
If you are wondering about the polygon count of my shi[s, it's around 500.
The orange ship has 800 :P
World has around 10.000 to 20.000

chronozphere
29-05-2006, 02:13 PM
Do those SCAG ships realy need different LOD's?? :?
Even while the models are rendered with an almost constant distance to the camera???



well, I use method 2.


Anyone using another method?? :)

NecroDOME
29-05-2006, 02:53 PM
I checked my code again, but I'm only using method 2 for the geometry. Meshes (like the ships and buildings) have per mesh a vertex buffer (and per LOD) but when I want to create 10 ships from the same mesh, it only take 1 vertexbuffer that is render multiple times. It's the same as textuers, load it once and use it as many times as you like.
I used method 2 befor, but with 500 differnt vertexbuffers it has a slotdown with creating new ones. (and it's also a bit slower with rendering).

And no, SCAG ships do not have LOD's :P , the engine was primairly created for a 3D shooter. So was the NecroSPACE 2 engine, but I never made a shooter with it (shame on me). Currenly we are busy to make more maps for SCAG and and if that's is finished, we maybe going to make a racing game or 3D shooter.