#### Archived

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

# Vertex Normals

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

## Recommended Posts

How to calculate Vertex Normals? I have to calculate Vertex normals for Lightning in D3D, but i only know how to create Triangle - Normals(DotProduct of all three Points). How can i Calculate the Vertex Normals, if i have the Triangle - Normals already? Or does anyone know, how i can get smooth lights with attenuation tricks? Thanks, for help.

##### Share on other sites
Hi,

Triangle-normals? do you mean plane-normals for triangles?
If you mean plane-normals, are you sure you calc them using the dot-product?
I think the correct way to calc normals is by using the cross-product. Dotproduct gives you a measure of the angle between two vectors (if you twiddle with the formula). While the cross-product gives you a vector perpendicular to the vector given (right-handed coordinate system).

So to calc fake-vertex-normals (which they are called), you calc the plane-normals of all planes "surrounding" the vertex and add there values together. Then you often normalise the vector to get a unit-vector.

cheers

/Mankind gave birth to God.

Edited by - silvren on September 22, 2001 2:18:14 PM

Edited by - silvren on September 22, 2001 2:19:27 PM

##### Share on other sites
hmm.. Right. I calculated the Normals with Cross - Product. But what are Planes?? Would u explain me the "Planes", please?
I will try ur suggestions and I hope, that the lights are Smooth now.

Many thanks for further helping,

Merlin.

##### Share on other sites
quote:
Original post by devMerlin
hmm.. Right. I calculated the Normals with Cross - Product. But what are Planes?? Would u explain me the "Planes", please?
I will try ur suggestions and I hope, that the lights are Smooth now.

Many thanks for further helping,

Merlin.

What I mean by planes is just an ordinary "linear 2d-surface". The equation for an infinite plane is:
a*X + b*Y + c*Z + d = 0 where not all a,b,c are zero
(every point that satisfies this equation lies on the plane)

So, what you do is that you calc two vectors from the three triangle points:
v1 = p2 - p1
v2 = p3 - p1

Then you calc the crossproduct:
vperp = v1 x v2 (You might need to switch the ordering, depending on your representation)

Then you normalise it:
vnorm = vperp / norm(vperp) norm is the length in this case.

Now you have a normalized "plane-normal" for the triangle.

Next you sum all these planenormals that has the vertex in question as a member, and you''ll get the vertexnormal.
Then you normalise that vector.

Any help?

/Mankind gave birth to God.

##### Share on other sites
Ok, the calculation of your "Plane - Normal" is exactly the same what i named "Triangle - Normal". And i created the Vertex Normals by adding each Plane-Normal to the Triangle Vertices and Converted the Normals to length == 1. It looks good!

Many thanks!!

But the difference between a "Plane" and a Triangle is open anyway. I dont understand what you mean with Plane.
What is the "practical" difference; or what is the deffinition for a triangle and a Plane?

Many thanks again,

Merlin.

##### Share on other sites
OK,

I'll try to explain.

When you calc cross-product of your two vectors from the triangle, you get a new vector that is perpendicular to these two, which you already knew. But that vector has no "center" in space, so you could view it as a vector pointing somewhere with its base at the origin. Now, you see that the vector is not only perp to your triangle. It is also perp to all vectors that lies in the subspace which is spanned by your two vectors. Therefore it makes no sense saying that it is a triangle-normal, since it's a normal to an infinite 2d-plane, and in that 2d-plane your triangle "exists".

It's only a matter of being strict when using mathterms.
Thus, planes are infinite 2d-linear-surfaces. While a tringle is, hmmm, a bounded "area". Imagine your tringle in space, now extend that surface in all directions and you'll get the "plane" which I'm talking about.

DEF:
The equation for an infinite plane is
a*X + b*Y + c*Z + d = 0 where not all a,b,c are zero

And a,b,c is the vector components of the normal-vector for the plane. That is, the normal vector is vn=(a,b,c)

regards

/Mankind gave birth to God.

Edited by - silvren on September 23, 2001 4:21:06 PM

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 9
• 9
• 9
• 14
• 12
• ### Forum Statistics

• Total Topics
633298
• Total Posts
3011256
• ### Who's Online (See full list)

There are no registered users currently online

×