Sign in to follow this  
beebs1

How many vertex formats do you use?

Recommended Posts

beebs1    398
Hiya, So far in my game I'm just using one format, which contains a position and UV coordinates - this is for my mesh objects. I'll probably need to add a normal vector to this and few other formats, for drawing the GUI overlay and possibly for shadowing and post-process effects if I can implement them. I'd be interested to hear how many you use, and what for - especially if you've gone the other way from me and use a lot of different formats. Thanks very much for any comments :)

Share this post


Link to post
Share on other sites
Yann L    1802
Quote:
Original post by beebs1
I'd be interested to hear how many you use, and what for - especially if you've gone the other way from me and use a lot of different formats.

Hard to say, since they're auto-generated from meta-shader permutations. I'd estimate around 200 to 300 for larger scenes.

The number of different vertex data layouts is highly dependent on how you design your 3D engine. Usually, there is a standard progression here. People start with a single format for simplicity, and then keep adding new vertex data streams as they progress with new features. That's what you're doing right now.

Once you'll get into more advanced shaders, you will quickly notice that some shaders require highly specific vertex data. If you're doing advanced lighting, this could be ambient occlusion factors, bent normals or PRT data. For character animation, you'll have vertex weights. For special materials, like brushed metal or glass, you'll need anisotropy factors, material thickness, and similar.

Not all of your shaders will require all of that data at once. Some data just won't make sense on certain models anyway, like bone weights on non-skinned models. So you'll need separate vertex layouts for each shader.

And it doesn't stop there. For optimal performance on large scenes, you'll start to introduce automatically generated meta-shaders. Suddendly, even meshes that use the same shader will need different vertex data layouts ! But then, these will be generated along with a certain shader permutation, so you won't even know about them anymore. In the end, everything will be automatically managed by the engine.

Also note that cutting edge engines usually need less vertex data than older ones. That's because they compute more data in the vertex or pixel shaders directly, rather than streaming it in over vertex data streams. In fact, when you reach a certain threshold on geometric complexity, vertex data can become a serious performance bottleneck and consume a lot of (precious) VRAM. It can also be worthwhile to use vertex data only as indices into a large storage area - such as a volume texture - that is accessed by the pixel shader. This is often done for high order spherical harmonics, for example.

Share this post


Link to post
Share on other sites
jpventoso    178
I only use 3 vertex formats:

- POSITION + TEXCOORD0 for ropes, full screen quads and GUI objects.
- POSITION + NORMAL + TANGENT + BINORMAL + TEXCOORD0 for dynamic objects.
- POSITION + NORMAL + TANGENT + BINORMAL + TEXCOORD0 + TEXCOORD1 for static objects (TEXCOORD1 is for radiosity lightmaps/ambient occlusion).

Like Yann L said, I use only these vertex formats because my engine is in development right now, I'll be adding BLENDINDICES and BLENDWEIGHTS to dynamic objects soon.

Share this post


Link to post
Share on other sites

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