Sign in to follow this  

Normal Mapping Poblems

This topic is 3842 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 have implemented an directx effect file to do normal mapping and per-pixel lighting on my meshes. The problem is that the mesh I am implementing this on does not contain a tangent or binormal element in its vertex structure. Can I add this during the start-up of the program and store in the mesh?

Share this post


Link to post
Share on other sites
Yes, of course you can. D3DXComputeTangentFrameEx() does just this for ID3DXMesh data and implementing the algorithm yourself isn't particularly complicated (the equations are available online if you search for them).

In some cases you can get better results from offline algorithms, but its usually only in special cases (e.g. where your artist(s) have done some funky texturing) that this actually matters.

hth
Jack

Share this post


Link to post
Share on other sites
Thanks Jack!

One thing is that when I call it the function returns an HRESULT of D3DERR_INVALIDCALL. What am i doing wrong? Heres the full call:

D3DXComputeTangentFrameEx(g_pD3DXMesh, D3DDECLUSAGE_TEXCOORD, 0,   
D3DDECLUSAGE_BINORMAL, 0, D3DDECLUSAGE_TANGENT, 0,
D3DDECLUSAGE_NORMAL, 0,
D3DXTANGENT_GENERATE_IN_PLACE,
NULL, 0.01f, 0.25f, 0.01f, NULL, NULL);

Share this post


Link to post
Share on other sites

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