Sign in to follow this  

Question on vertex formats

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

This is probably a dumb question but i couldnt seem to find an answer elsewhere So lets say I have a vertex buffer with a position, normal, tangent, and maybe 2 texture coordinates in its data. Obviously, I will then have to make a vertex format that specifies these things. So, lets say I then want to render a shadow map. For the shadow map, I only need position, not any of the other stuff. So I make a new vertex format that just has position in it. But, now the vertex format for the shadow map no longer matches the data thats in my original vertex buffer! My question is, Do i have to make ANOTHER vertex buffer with just the position data so that i can render my shadow map since the original has stuff other than just position? Do I even have to make another vertex format or would it be less efficient not to? Thanks, Chris

Share this post


Link to post
Share on other sites
You don't say what you do to render the shadow map. However, you should be able to use just the position of the vertex and ignore the other parameters without creating another buffer.

If you're using a shader, just use the position data when you render the shadow.

If you're using FFP, you can use something like DrawPrimitiveUP with an FVF of D3DFVF_XYZ and set the stride to the full vertex size to skip over the other parameters.

Share this post


Link to post
Share on other sites
You shouldn't need a new buffer. You won't even need a new vertex format. The shader says it just needs position, so the rest of the data will just be ignored. As long as the format contains what the shader wants, everything is fine, regardless of how much extra data you may have.

Share this post


Link to post
Share on other sites
Even if you do want to use a subset of the data, that's not a problem. The stream stride is set in SetStreamSource, and need not be related to the vertex size.

Share this post


Link to post
Share on other sites

This topic is 3464 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.

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