Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


How to make DirectX calculate your normals ?

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

Somewhere in the DirectX SDK help it says 'For normals, you can either directly supply them to Direct3D or have Direct3D calculate them for you.' But this doesn't seem possible when you are drawing just a triangle list or triangle strip using a custom FVF. All samples use something like this:
  function GetTriangleNormal(vVertex1:PD3DXVECTOR3 ; vVertex2:PD3DXVECTOR3 ;  vVertex3:PD3DXVECTOR3) : TD3DXVECTOR3;

	D3DXVec3Subtract(v1,vVertex2^, vVertex1^);
	D3DXVec3Subtract(v2,vVertex3^, vVertex1^);

	D3DXVec3Cross(vNormal, v1, v2);

	D3DXVec3Normalize(vNormal, vNormal);

	result := vNormal;
Isn't there a D3D or D3DX function somewhere that takes 3 points and gives you the face normal of that triangle in one function ? That's so common, it must be simpler than this ... [edited by - Fidelio_ on August 31, 2002 7:33:51 AM]

Share this post

Link to post
Share on other sites

  • 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!