Jump to content
  • Advertisement
Sign in to follow this  

diffrent vertex format

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

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

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!