Home Technical Talk

Fusion -> Max normals artefacts

polycounter lvl 12
Offline / Send Message
Temppe polycounter lvl 12
Hi guys,

For a project I'm working on, I imported a model from Fusion to Max. I've done this workflow many times with Solidworks before so I'm in familiar territory so far. On this occasion, I'm converting to mesh on import as that gives me a water tight mesh, rather than welding the borders myself.

Anyway as part of the mesh clean up process I have to remove and weld various vertices (this is for a low poly game model). Now I'm aware that CAD files will have normals that are tweaked from their true values in some cases to get perfect looking surfaces. This usually occurs where one surface borders another, like on the interface between a flat surface and a fillet, the normal will be that of the flat surface (instead of averaging the flat and angled surface normals) to avoid shading the flat surface.

But... I've edited the vertices in the middle of surfaces that have compound curves, and I'm getting chunky artefacts in the shading. In the .gif below you can see the difference clearly between the unedited normals and the edited normals. Those edited normals are averaged between four faces, so as far as I can see they should be the same

In the second image you can see that the handles for the edited normals are a lot shorter. I can copy paste an unedited normal, but as soon as I rotate it, it shortens. If I select an unedited normal and click unify, it shortens. So somehow the normals coming in from the CAD file are "longer"...? And this somehow gives a super smooth sexy result... I'm just confused here.


Anyway all of this will be covered in a normal map so I don't know if it will matter, but I would like to get to the bottom of it.

Replies

  • pxgeek
    Offline / Send Message
    pxgeek greentooth
    Whenever I get shading or normal issues from imported geometry I always use the collapse utility to reset and unlock normals. (I do that regardless too, just as a precaution) Maybe that'll help.
    If this is for the lowpoly, I don't think you would need the normals coming from the external application anyway.
  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    the normals are locked  and probably have a weird transform - edit normals, select all, reset should fix it.  if not, turn to poly first and then do it

  • Temppe
    Offline / Send Message
    Temppe polycounter lvl 12
    So it turns out that all the traingles from CAD geometry don't have smoothing groups assigned, even though the normals separated along the hard edges and unified on smooth edges. Soooo.... I had already unwrapped the mesh, so just before resetting all the normals I ran a script I found here by RenderHJS that assigned SGs according to UV island, and then reset the normals. Problem solved, back to smooth and sexy all over.

    I think from now on I'll run that script as a matter of course on any geometry that I import from CAD, as all NURBS surfaces have their own UV island from the get-go.

    Even though I don't think it would have made a difference once the normal map was applied, I'm still chuffed that we got to the bottom of this.
  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    if the normals distorted when rotated it suggests that they either have a non-orthogonal transform or that they aren't normalised.   a normal map might compensate for that but it also might not and behaviour could well differ as you move the object from application to application. 

  • Temppe
    Offline / Send Message
    Temppe polycounter lvl 12
    I assume that the only way a normal could have a non orthogonal transform is that the parent object has been scaled non-uniformly, right? Strange, because I never scaled the object.

    Just to check this out I reset the xform and suddenly all the normals are the same "length" when I throw on Edit Normals (still with the ugly shading artefacts). But then when I reset the adjacent normals the artefacts go away.

    All of the normals on the edges are tweaked from their true values a bit, they change direction sightly when I reset them. But the center normals don't change. This is fairly standard behaviour for a mesh that comes from a CAD model.

    BTW what do you mean when you say the normals might not be "normalised"?

  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    they might not be non-orthogonal - I couldn't see what was happening when you rotate them so just a possibility.  The most likely reason for that happening is if the object was rotated and then scaled non-uniformly in world space.

    normalised means the vector has a length of 1.
    You saw that get fixed when you reset xform and the lengths all normalised - 
    that could mean that the object had a non-uniform scale on it somewhere in it's hierarchy but it could be to aid with clean looking rendering in the source application or even just a side effect of how the nurbs surface was converted to mesh. 
  • Temppe
    Offline / Send Message
    Temppe polycounter lvl 12
    Here's a .gif comparing the various imports options and how they affect the normals. I've no idea why the .stl came in at the wrong scale. At no point during the export from Fusion or the import in Max did it give an option to change the scale. But if we ignore this scaling and reset the transform on the oversized mesh as it is on import, the normals are unaffected.
    So it seems that converting to mesh on import to Max is where the confusion starts.
  • Eric Chadwick
    As noted, it is possible the CAD app is setting the lengths and angles of each of the vertex normals to specific directions and lengths, to suit its own preferences for how to shade a polygonal model.

    Removing those values in 3ds Max is a good idea if you’re going to be editing the vertices before baking, since Max won’t be transforming any new normals in the same way. 

    Depends on the exporter but most game engines will preserve any custom normals coming in with a model. So then pretty much what you see in Max is what you get. 

    It’s important to note that a tangent space normal map does rely on the vertex normals, and on the UVs. So those need to be kept consistent once you bake the map. It’s also important to triangulate before baking, to preserve consistency. Some info on that here http://wiki.polycount.com/wiki/Normal_Map_Modeling#Triangulation
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    Also you can always  export  a hi poly model  and  transfer/ borrow   normal directions  from it.   I do so with  model copy dynameshed in Zbrush   to tiny polygons.  Max doesn't have a native tool for normals transfer  but there are 3d party scripts starting with normal theft .   Or you can always do it with data transfer in Blender  which transfer normals on the fly  in real time.    Fixes all sort of shading errors/ gradients  even  on crazy mess  of  , totally un -subdividable geometry .    Good for keeping LODs  in same shading  more or less.
    Hi poly models are not just for baking  normal maps. Works for transfering vertex normals too.

Sign In or Register to comment.