Trying to Understand Issue w/ Vertex Normals and Blender
All  1-2  3-10

Previous
Next
 From:  Michael Gibson
4272.3 In reply to 4272.1 
Hi YHWH_777,

> My understanding is that MoI exports vertex normals
> in the OBJ file.

Correct.


> But then when Blender imports the OBJ file, it then ignores
> the vertex normals in the file and recalculates its own vertex
> normals, which can then lead to issues.

Yup, although for the older Blender 2.49 version you can get the vertex normals read in either by using Anthony's LWO import script here:
http://moi3d.com/forum/index.php?webtag=MOI&msg=979.1

Or by using this modified alternate OBJ import script from here:
http://moi3d.com/forum/index.php?webtag=MOI&msg=3164.11

But I think that the script interface has changed for the newest Blender release, so these scripts that run on 2.49 will not work on the latest 2.5x releases.


> - Why are the calculations of the vertex normals different
> between MoI and Blender?

MoI uses a method called "NURBS surfaces" to represent 3D objects. This kind of model data is made up of splines, which are actually mathematically smooth objects, not just a bunch of planar facets that are trying to approximate a smooth object by having a lot of little flat pieces like a polygon model.

So when MoI makes a vertex normal, it comes directly from the NURBS surface data, it basically represents the ideal shape and shading of the object, not just an approximation of it.


> I would think that the calculation of vertex normals would
> be the same for all 3D modeling apps.

No, there are actually a variety of different ways that 3D models can be represented, like polygons, NURBS, voxels, etc... each of these methods can structure data kind of differently so it's not like "3D" is just one single technology...

There are some common formats that are based around a particular technology though, like OBJ.

But one of the features of the OBJ format is that it can hold not just the polygons but also vertex normals that represent how the polygons should be shaded when rendered - renderers use vertex normals to shade a flat polygon to pretend that the polygon is actually a smooth surface even though it is really just a flat facet.

OBJ format allows storing vertex normal data along with the mesh, in addition to storing the 3D point location of each vertex and also a UV coordinate. When it is present, those vertex normals are supposed to be used to shade the polygons, but that's the part that does not happen with Blender.


> - How does MoI calculate vertex normals?

It takes the normal from the original smooth NURBS surface that the polygon was created from. When those normals are then used for rendering, it makes the polygon shading look the same as the original NURBS surface, regardless of whether the polygons are pretty rough or have some kind of non-uniform topology.


> - How does Blender calculate vertex normals?

Blender does not have the original NURBS surface data available to it, so it calculates vertex normals just by averaging all the flat polygon face normals of the polygons that share that vertex.

Since that normal is dependent just on the faceted polygon data, it is sensitive to things like the arrangement of polygons, things like long polygons next to short ones will kind of have equal weight on the averaging, sort of stretching the influence of the short polygon on the normal's position and basically leaving some hints of the polygon structure in the shading, since the shaded appearance is only being derived from polygons in that case and not from the actual smooth NURBS surface.


> - And does the calculation only differ for certain shapes,
> such as spheres vs cubes? Or curves vs flat surfaces? Or
> does the calculation differ for all object shapes?

Well, it doesn't differ for objects only made out of flat faces like a box or something like a faceted diamond shape, because those shapes are described exactly by the planar polygon facets.

But once you have some curved pieces in your model, the polygons are no longer exactly describing the curved surface, they're just some approximation of the ideal curved surface. That's when you'll see a difference.

It will be particularly noticeable with mechanical type models where you may have a mix of small and large polygons created in the output. In an organic polygon model where all the polygons are of the same shape and very evenly distributed it is not as noticeable because there isn't any areas in the model that have a sudden shift in shape like you have with a mechanical model.


> - Finally, is there a way that Blender could calculate the
> correct vertex normals from the information that it has?

No, because it doesn't have the NURBS surface data available to it - the NURBS data is basically the master definition of the model that contains its exact shape and therefore also generates exact shading normals.

One thing you can do is to try to produce a mesh that has more evenly sized and regularly spaced polygons in it, by using the "Divide larger than" setting when exporting, because if your polygons are all of the same general size it helps to make the shading glitches more localized to smaller zones and less noticeable.


However, in general for rendering mechanical CAD data is very important for the vertex normals that are stored in the file to be used for shading it, to ensure that your rendering looks the same as the actual original NURBS model. When they are used, it results in basically a perfect shading with no glitches of any kind. When they are not used you will not get the same shading as your original model.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
4272.4 In reply to 4272.1 
Hi YHWH,
When MoI creates the polygon data, it creates the vertex normals from the original NURBS surface.. Once it has been transformed into a poligonal object, the calculation then has to come from a faceted, non-curved surface (groups of flat polygons) and can lead to shading glitches.

A NURBS object is a mathematical representation of true curvature. A polygonal model is a group of flat surfaces that represent curvature (small or large facets determine the approxamation).
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
4272.5 
Updated importer for blender 2.5x from Anthony here:...................?......
http://chronosphere.home.comcast.net/~chronosphere/true-normals.htm
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
4272.6 In reply to 4272.5 
Hi bemfarmer - [.... EDIT: message about wrong link removed ... ]

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
4272.7 In reply to 4272.6 
Sorry, just fixed it.
I'm ignorant of vertex normals, so will say no more.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
4272.8 In reply to 4272.5 
Hi bemfarmer, the only thing is that unless Anthony has updated it, the 2.5 version mentioned on that page is an older release of 2.5 from 6 months or so ago, not the most recent 2.5x one.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
4272.9 In reply to 4272.8 
Thank You Michael.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  SteveMacc (STEVEH)
4272.10 
A good example of a shading error where the vertex normals are ignored is where a round fillet joins on to a flat section (a very common occurence in mechanical objects). The Phong shader will treat the flat section as an extension of the fillet and you will get some odd shading occurring across the flat part. Without vertex normals, the solution is to add a thin ring of co-planar polygons round the flat section to "protect" it. This is normal practice when modelling directly in polys but is not done when exporting from Nurbs, like MOI.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1-2  3-10