How to troubleshoot Surface Normal Vectors

A bit of a strange phenomenon when I attempted to create a point attractor script for a divided surface. I didn’t even get to tackling that challenge because of the unpredictable nature of getting the surface normal vector. Dynamo for some reason randomly pointed 5 down with the rest pointing up as expected. The problem panels are in dark red with an overlay of the Gaussian Curvature of each panel on the surface. Green lines are the target vector with red representing the surface normal. There doesn’t seem to be an pattern to why some are pointing down unless someone can enlightening us? I guess one could create a checking step which reverses the vector up if necessary but I wanted to investigate the behaviour of the surface a bit more to understand its cause before moving to a workaround. I’m on Dynamo 2.0.2 on Revit 2018.3. Thanks,


1 Like

Personally, I would need the source geometry and how it was generated to figure out why.

Dang. I don’t appear to have saved my test project which is not like me at all.

The surface equation was: Math.Sin( (0.5 * Math.Pow(x,2)) - 0.25 * Math.Pow(y,2) + 3) * Math.Cos((2 * x) + 1 - Math.Pow(Math.E, y));
From range: -Math.PI…Math.PI

I will try to quickly rebuild it tomorrow with my screen cap and upload the node tomorrow but is there a chance you could give me some hints of where to look?

See if changing the spacing on the surface division alters the distribution of the normals. That is: if you were dividing into 10 segments before, try 8. That should give some insight into what is common to the inverted panels (va those not inverted).

Might be worth checking the edges elevation consistancy relative to the lowest divot too.

I was really hoping that remaking the script from above might clear my error but alas that was to no avail.

I’ve attached the script below. One reason I find this so concerning is that this discrepancy might be rooted in some type of model surfacing inconsistency? When there are surface errors like that, any sort of optimization algorithm I come up with will also spit out errors.

SURFACE v2.dyn (78.0 KB)

Seems to be that the normal is being flipped as a result of how you’re building the surface. The paneling is deforming as the point aren’t coplanar, and the exact method of deformation is going to be based on how the four points relate to each other in sequence. As such it’s being interpreted differently. Building a Nurbs surface from the grid of points is likely the most consistent method as it will maintain a consistent normal. This can be subdivided into panels, and new surfaces made in a way which will keep the normals being consistent.

That’s a really interesting methodology… Thanks for sharing. Let me build that in and see what geometry we get because ultimately - as I’m sure you’ve already assumed - I hope to do further processing on these panels.

I have not looked at the geometry, but, the normals for a face are usually defined based on the coedge directions, and the coedge directions are defined based on the edge directions and yada yada, based on which order you defined the start and end points of the edges in or the grid of points which defined the surface etc.

1 Like