Calculating vertex normals

Started by
12 comments, last by Fabbo 12 years, 11 months ago

[quote name='Fabbo' timestamp='1305470712' post='4811090']
If it's a sphere....then just normalise the vertex position - job done.


If its centered at the origin yeah, but is it?[/quote]

That does not make a big difference. Let's say you know the origin. Then you get the right normal by normalizing (Vertexposition-Origin).
[/quote]
There is nothing in the assignment that directly indicates where the origin is.
[/quote]
You are right that the origin is not given explicitly.

But if it is a sphere like shown above then the origin is known.
just fnd the two vertices with the highest face connections (top of sphere and bottom of sphere) and interpolate to the middle of them. There is the origin.
Finding the origin is something you have to do once for all vertices of the sphere. I'd say interpolating between the connected faces takes more time.
E=mc^2 + 2d6
Advertisement

[quote name='Brother Bob' timestamp='1305471330' post='4811092']
[quote name='Fabbo' timestamp='1305470712' post='4811090']
If it's a sphere....then just normalise the vertex position - job done.


If its centered at the origin yeah, but is it?[/quote]

That does not make a big difference. Let's say you know the origin. Then you get the right normal by normalizing (Vertexposition-Origin).
[/quote]
There is nothing in the assignment that directly indicates where the origin is.
[/quote]
You are right that the origin is not given explicitly.

But if it is a sphere like shown above then the origin is known.
just fnd the two vertices with the highest face connections (top of sphere and bottom of sphere) and interpolate to the middle of them. There is the origin.
Finding the origin is something you have to do once for all vertices of the sphere. I'd say interpolating between the connected faces takes more time.
[/quote]
But only one such point is given, the other one is not.

If you want to determine the center of the sphere, you would have to find a sphere that gives you the listed coordinates. It is possible, and assuming that the coordinates are not subject to rounding or otherwise are not fully accurate (for example, they are rounded to integers for the purpose of easy hand calculation, and I find it likely they are because sphere coordinates are rarely that nice looking), there is in fact a single unique solution for the center. However, I seriously doubt finding that center so you can normalize the center-to-point vector is easier than just calculating the face normals and averaging to find the vertex normal

Mentalpants:
I have sort of forgot to focus on your questions about your solution, sorry. Your approach is valid (not saying others aren't, there are many ways and interpretations of what a vertex normal actually is in the general sense and how to calculate it). Your vectors u1 and u2 spans the edges of a triangle, and its normal is the cross product between them. The vertex normal is then the average of the four face normals connecting to the vertex in question. So your approach is indeed valid.
Thanks for your help, gentlemen. It really makes a difference.


Unfortunately I am not done yet! Me and my fellow students seek your patience for one more question.
(Hope it doesn't look like I am pushing my luck here - just some of this stuff really wasn't explained very well at all to us, our notes are rubbish)

http://www.gamedev.net/topic/602133-ray-tracing-construction-and-finding-a-pixel/
But only one such point is given, the other one is not.

If you want to determine the center of the sphere, you would have to find a sphere that gives you the listed coordinates. It is possible, and assuming that the coordinates are not subject to rounding or otherwise are not fully accurate (for example, they are rounded to integers for the purpose of easy hand calculation, and I find it likely they are because sphere coordinates are rarely that nice looking), there is in fact a single unique solution for the center. However, I seriously doubt finding that center so you can normalize the center-to-point vector is easier than just calculating the face normals and averaging to find the vertex normal[/quote]

Okay, now i get it. =D I thought of a realistic case in which you have all vertices in a buffer. My fault.

But in case that there is a sphere in a vertex buffer, it should be a fast solution for a sphere. It is optimizable if you can assume that the model is not rotated.
E=mc^2 + 2d6

This topic is closed to new replies.

Advertisement