Jump to content
  • Advertisement
Sign in to follow this  
b3rs3rk

D3DXComputeTangent question

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

I've created a mesh with this:
struct CModelVertexFull{
	D3DXVECTOR3  pos;       // Vertex Position
	D3DXVECTOR3  normal;    // Vertex Normal
	D3DXVECTOR2  tex0;		// Texture Coord 0
	D3DXVECTOR2  tex1;		// Texture Coord 1
	D3DXVECTOR3  tangent;   // Tangent
	D3DXVECTOR3  binormal;  // Binormal
};
const DWORD CModelFVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX4 | 
					D3DFVF_TEXCOORDSIZE2(0) | D3DFVF_TEXCOORDSIZE2(1) | D3DFVF_TEXCOORDSIZE3(2)| D3DFVF_TEXCOORDSIZE3(3);

and now i'm trying to compute tangent and binomials. Is it possibile to use with FVF or should i write all the computations?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by b3rs3rk
and now i'm trying to compute tangent and binomials. Is it possibile to use with FVF or should i write all the computations?


The SDK hints at that it checks the mesh's vertex declaration to determine where to output it's tangent and binormal data. So in fact, you shouldn't be using FVF's here - instead create it with a vertex declaration. At that point, you should be good to go.

Remember that when creating your declaration, you want to use D3DDECLUSAGE_TANGENT and D3DDECLUSAGE_BINORMAL appropriately, instead of just texcoords like in your FVF.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!