Advertisement

How to get the point for the normal

Started by May 21, 2002 04:30 AM
4 comments, last by wingcom 22 years, 6 months ago
D3DXVECTOR3 vPoint = D3DXVECTOR3(0.0f, 0.0f, 0.0f); ok i setup a point, the problem is how to get the normal, D3DXVECTOR3 n = D3DXVECTOR3(...., ...., ....); D3DXVec3Normalize(&n, &n); I just dont know what the are the values that need to be fill in, can someone out the help me, thanks
Nothing to do, try complimenting someone, it will make you feel better!
What are you trying to do exactly? It seems you don''t fully understand what a normal is - you don''t just have a normal, it''s got to be normal to something.

Say you have a plane, then a line is said to be normal to the plane if it makes a 90o angle with every vector on that plane.

codeka.com - Just click it.
Advertisement
i do understand what is normal, i'm trying to get nonperpendicular normals to use in Gouraud Shading. I mean every vertex has a normal, i just dont know how to get the normal value for a particular vertex, must i calculate the value myself or what? thanks

[edited by - wingcom on May 21, 2002 7:02:54 AM]
Nothing to do, try complimenting someone, it will make you feel better!
Basically yes. Your vertex is used by more than one face, so for each face you take the vertex you''re looking (v) at and two other points on the face (the other two vertices are good) - v1 and v2. Then, you find the normal with this formular:

normal = (v1 - v) cross (v2 - v)

Now do that for all the other faces this vertex uses and add all the normals you get together, and normalize it. There you go!

codeka.com - Just click it.
thanks for the info, i will try to calculate and see, if i still have further problem i will post it here. Another question, are you the modifier for this thread, Mr. Dean Harding?
Nothing to do, try complimenting someone, it will make you feel better!
Modifier? Do you mean moderator? No, that''s Michalson.

codeka.com - Just click it.

This topic is closed to new replies.

Advertisement