Recalculating Normals

Post: #1
I'm trying to read in a lightwave file that was generated from the 3d program Blender. I'm reading in all the geometry alright but am having a problem when it comes to calculating the normals.

It seems that some of the polys have their normals facing outward with respect to the mesh and some are facing inward. This has to do with the way the cross product is being calculated and the order of the vertexes in the poly. But I don't really have control over the order of the vertexes. They're being read in from a file.

Is there a way to calculate normals of a mesh so that they are all facing the correct way? So that they are all facing outside the mesh if you will?
Quote this message in a reply
Posts: 1,403
Joined: 2005.07
Post: #2
You should try and resave your model with just ccw ordered polygons,
but you can check in 2D if a point is inside a polygon by counting how many edges a line from that point moving in a(ny) straight line passes though, and odd number means inside and an even number means outside.
The same applies for 3D but check for polygon intersections, so check this for the moving along the normal 0.000001 units or smaller and if theres and even number invert the normal.
You should really re-save if you calculate them this way, because all polygons should be ccw ordered or at least all ordered the same.

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Posts: 529
Joined: 2003.03
Post: #3
If most of them are facing the "right" way, you could check to see if it faces the same way as its neighbors and invert it if necessary.

"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
Quote this message in a reply
Posts: 269
Joined: 2005.04
Post: #4
Blender will flip normals for you.

Select the polys you want to flip, hit "w" and select "Flip Normals". You can tell Blender to draw normals if you're having a hard time seeing which ones are wrong. Just select "Draw Normals" on the editing panel (F9) while in Edit Mode.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Normals Nick 20 10,172 Mar 25, 2005 09:31 AM
Last Post: tigakub
  Normals? Quicksilver 3 3,578 Jan 13, 2003 05:31 PM
Last Post: henryj