# Defining a triangle and finding its face normal with CustomVertex?

This topic is 954 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites

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.

1. 1
Rutin
33
2. 2
3. 3
4. 4
5. 5

• 11
• 13
• 86
• 11
• 10
• ### Forum Statistics

• Total Topics
632971
• Total Posts
3009608
• ### Who's Online (See full list)

There are no registered users currently online

×