How to determine for open edged objects if normals are facing outward?


#1

Hi everyone,

I’m looking for way to determine if the normals of objects are facing outward or inward.

The tricky thing is that the objects have open edges.

I have attached an example file (3ds max 2018) and a screenshot of the example object.

I came up with the following idea

  1. Get the normals of 10% of the object’s faces
  2. Extrapolate (locate) a new point from each face along its normal with a distance of 10% of the object’s smallest boundingbox axis value (x, y or z)
  3. Compare the 2 distances: a) from face position to center of object and b) from new point to center of object
  4. If the distance from the new points are overall shorter then the normals are facing inward.

But… this seems to be a crazy approach!

Isn’t there an easier way to do this with Maxscript? In any case, ‘resetting normals’ in the Edit Normals modifier doesn’t help.

Thank you for any thoughts and feedback!

normal_check.max (2.1 MB)


#2

add a cap holes modifier , launch a ray to the center of object from far away , check result , if the first face’s normal towards the ray point , normal inward , otherwise outward , if no result , use another point to launch ray
search for RayMeshGridIntersect , example below , replace i to your object

(
	i=objectfortest
	bb=[99999,888,777]
	rm = RayMeshGridIntersect () 
	rm.Initialize 10 
	rm.addNode i
	rm.buildGrid () 
	theface=#()
	theHitsCount = rm.intersectRay bb ( i.center - bb) true
	if theHitsCount > 0 then
	(
		theIndex = rm.getClosestHit () 
		theFace[1] = rm.getHitFace theIndex
	)
	theHitsCount1 = rm.intersectRay bb  ( i.center - bb) false
	if theHitsCount1 > 0 then
	(
		theIndex = rm.getClosestHit () 
		theFace[2] = rm.getHitFace theIndex
	)
	if theFace[1] != theFace[2] then
		print "inward "
	else print "outward "
)

#3

Awesome AEI, thank you so much!