Calculating vertex normals - I'm doing something wrong

Started by
13 comments, last by ParanoiaComplex0 16 years, 1 month ago
In the old code, what outputs if you change

[source lang=cpp]if ((Vertex[Face[f].a] == Vertex[v]) || (Vertex[Face[f].b] == Vertex[v]) || (Vertex[Face[f].c] == Vertex[v]))


to

[source lang=cpp]if ((Face[f].a == v) || (Face[f].b == v) || (Face[f].c == v))


?
Advertisement
Exactly the same effect as I'm getting with the new code.

I think you're onto something.

"The right, man, in the wrong, place, can make all the dif-fer-rence in the world..." - GMan, Half-Life 2

A blog of my SEGA Megadrive development adventures: http://www.bigevilcorporation.co.uk

It might be that you have duplicates in the vertex list. If you're not storing each vertex uniquely, that would mean that normals would be added to the "same" vertex but in different places in the list. That might explain the problem.
Makes sense.

So for terrain I'll work out another way to calculate faces from the heightmap, and for my model format I'll look into implementing smoothing groups.

Thanks very much for your help!

"The right, man, in the wrong, place, can make all the dif-fer-rence in the world..." - GMan, Half-Life 2

A blog of my SEGA Megadrive development adventures: http://www.bigevilcorporation.co.uk

No problem :)

Check out my post over here about finding normals:

http://www.gamedev.net/community/forums/topic.asp?topic_id=486931&whichpage=1&#3181394

This topic is closed to new replies.

Advertisement