D3DXComputeTangent question

Started by
0 comments, last by circlesoft 17 years, 5 months ago
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?
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.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )

This topic is closed to new replies.

Advertisement