Skip to main content
GameDev.net gamedev.net
🔒 Locked

diffrent vertex format

Started by giugio Apr 17, 2009 at 2:26 AM 2 replies 650+ views
Original Post
giugio
giugio
Hy. I must use different vertex format , because i have different mesh in my engine , and some are skinned mesh some static mesh ecc.... If i have a simple mesh i would use a simple vertex format , without binormal , tangents and index bones. I must declare all the vertex formats and then use they in different matter? thanks.
Zoner
Zoner
For most geometry types, you will need to implement a family of vertex shaders to support it. It is important to have as few different vertex formats as possible, so you aren't overwhelmed by having to do too many variations of shaders. Compiling them all can get quite slow, and they can quickly take up a lot of space as well. This should become much less of a problem in D3D11.


For example: The difference between a mesh and a mesh with pre-computed vertex lighting, would normally require 2 vertex shaders to handle. But you could make all meshes work as if they had precomputed vertex lighting, and for the meshes that do not have precomputed vertex lighting, you can provide a vertex stream containing a single vertex, set its stride to 0 bytes, and set the color to a constant black.
http://www.gearboxsoftware.com/
giugio
giugio
thanks.
I'm not understand all.
In the specific I have this problem:

I have a mesh without texture and a mesh with texture and i would display at the same time both.
The mesh with texture have a U and V and the mesh without texture not have U and V , but i use the same Vertex structure.
How i can resolve?
I must use two vertex format or is correct to use the same vertex format whith
U = 0 and V = 0 for the mesh without texture?
Thanks.
leet bix
leet bix
This is a matter of preference, you could set the uv coordinates for the non textured mesh to 0 if you like, but that would be increasing the data stream and having no benefit from it, another way is to have seperate shaders or, as you have said, seperate vertex formats, in this particular scenario I would create two differnet vertex formats and create 2 techniques, not effect files, then you can render textured objects with one vertex format and technique, then render the other with a different vertex format that does not contain uv coordinates, and render with a differnet technique, you wouldn't have to pass in as many values this way as there would already be the matricies required for transforming the verticies present in the shader.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.