• Advertisement
Sign in to follow this  

Defining a triangle and finding its face normal with CustomVertex?

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

D3DXVec3BaryCentric(&hitVector3, &v1, &v2, &v3, U, V);

The v1, v2, v3 defines the triangle which is found by D3DXIntersect.

I am wondering do D3DX9 have any helpers for calculating the normal of it if there is one?

Or Do I just take the cross product of any clockwise vertexes and normalize them, is it better to do it that way?

Thanks

Jack

Edited by lucky6969b

Share this post


Link to post
Share on other sites
Advertisement

Do I just take the cross product of any clockwise vertexes and normalize them, is it better to do it that way?

 

You can do that, but it is not typical. Models are artistic data.

 

Where do you get your verts from?

 

When you have actual artists using real art tools to create models, the tools specify the surface normals and/or vertex normals. This lets your shaders and other systems know how to handle edges. Are they hard edges like facets on a gemstone or sides of a cube? Are they soft edges like the curve of skin or cloth? The vertex tells where a point is, the normal communicates the surface's orientation at that point.

 

If you are getting the verts from your own non-artistic sources, then yes you can do as you described.  You can use the normalized cross product, which will use the three values in the cross product for the direction of the normal. This will give a sharp, faceted edge. 

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement