Any way to transfer explicit normals to smoothing groups in 3dsmax?

Polycount Sponsor
Offline / Send Message
gsokol Polycount Sponsor
Hey all!

I'm having a bit of an issue dealing with Maya fbxes imported into Max.  Meshes from Maya come in with explicit normals instead of smoothing groups, but the only way I know to change that essentially removes all smoothing info and I have to start over with smoothing groups.  I would like to avoid this and find a way to translate the explicit normals to matching smoothing groups.  Digging through the edit normals modifier, I only see ways to break or average smoothing...

Anyone have experience with this?  Any suggestions?  Figured maybe some sort of script might be floating around out there or something.

Replies

  • cptSwing
    Offline / Send Message
    cptSwing polycounter lvl 6
    So the regular FBX's that come in from Maya have just altered normals, and no smoothing group assignments at all? Or are there smoothing groups set, and the edited normals you import "sit on top" of the smoothing groups?
    If the latter, I think selecting all normals in the "Edit Normals" modifier and hitting "reset" should be enough..
  • Swordslayer
    Offline / Send Message
    Swordslayer greentooth
    Can you make a picture to illustrate what the imported mesh looks like? Closeup with edges on/off might be good. Even better if you attached a sample mesh or even a part of it. Also, are the verts welded or exploded on the imported mesh? 
  • monster
    Offline / Send Message
    monster Polycount Sponsor
    This might work.

    1. Import the fbx.
    2. Make sure it's an Editable Poly and run the script below to select hard edges' vertices.
    3. Convert selection to edges.
    4. Add Edit Poly modifier to remove explicit normals.
    5. In Edit Poly set everything to one smoothing group.
    6. Go into Edit Poly edge mode, selection should be preserved.
    7. Press Hard under Edit Edges to create smoothing groups.
    8. Collapse.

    --SELECT VERTICES WITH MORE THAN ONE VERTEX NORMAL
    (
    	if selection.count == 1 do
    	(
    	 	verts = #{}
    
    
    	 	obj = $
    	 	eMod = EditNormals()
    	 	ConvertVertexSelection = eMod.EditNormalsMod.ConvertVertexSelection 
    	 	addModifier obj eMod
    	 	modPanel.setCurrentObject eMod
    
    	 	vCount = eMod.GetNumVertices()
    	 	for v = 1 to vCount do
    	 	(
    	 	 	nIDs = #{}
    	 	 	ConvertVertexSelection #{v} nIDs
    	 	 	if nIDs.numberSet > 1 do verts[v] = true
    	 	)
    
    	 	deleteModifier obj eMod
    
    	 	modPanel.setCurrentObject obj.baseObject
    	 	subObjectLevel = 1
    	 	obj.SetSelection #Vertex verts
    	)
    )

  • gsokol
    Offline / Send Message
    gsokol Polycount Sponsor
    Thanks guys!

    @cptSwing - its the second one.  There are no smoothing groups assigned, but if you assign them, it doesn't change the explicit normals, they override the smoothing groups.  Resetting normals will remove the explicit normals, but then smoothing is based on whatever smoothing groups currently exist.  Since none come in with the mesh, that basically means I have to redo the smoothing, which I would like to avoid.

    @Swordslayer - Sorry, I'd like to show an example, but the instances I'm looking are work related :(.  Verts are not welded or exploded.  Mesh integrity is good, its just that the normals are set outside of smoothing groups and I can't transfer that info to smoothing groups.

    @monster - Thank you for posting this!!  Unfortunately, it didn't quite work 100 percent.  When converting selection to edges, I get a bunch of edges that I don't want selected.  Seems like it works well for quads, but triangles often select extra edges.  This is definitely the closest I've gotten to a solution though.  Saves most of the cleanup and re smoothing at least.
  • Eric Chadwick
  • kio
    Offline / Send Message
    kio polycounter lvl 10
    this issue pops up at work every now and then, so Im also looking for a solution.
    The proposed workflow by @monster seems to be the most promising approach, so I invested some time fixing it (the selection of hard edges just doesn't work like that).

    So, download and rename the attachment to .ms and select an object an run the script.
    First results are looking good so far - but it really needs some testing :) The algorithm max uses for setting up the hard eges creates some crazy smoothing group assignments tho ...




  • monster
    Offline / Send Message
    monster Polycount Sponsor
    @kio Glad you were able to complete this. It's a tool I didn't realize I needed. Because I just recreate the smoothing everytime I go from Max to Maya.

    I just thought of another solution. Check Split Per Vertex Normals when exporting from Maya. In Max select open edges, weld their verts, then press Hard. But kio's script works in more cases, like if your model is skinned or you don't have access to Maya source.


  • kio
    Offline / Send Message
    kio polycounter lvl 10
    @monster for the max -> maya direction we use https://www.highend3d.com/maya/script/lockednormals-to-hard-soft-edge-for-maya but the other way round has been a bummer :/

    on smaller props this isnt much of a problem, but once you have a few thousand polys at hand you really start thinking "why I'm doing this...?"

  • z01ks
    Offline / Send Message
    z01ks polycounter lvl 5
    @kio Thanks for the script. I've used it successfully to get an FBX exported from Blender to work in Max. The automatic smoothing groups option in the FBX import settings doesn't do a perfect conversion.

    However with the script I am getting a ton of smoothing groups, and some faces have like 6 different smoothing groups for no reason. So in game development this doesn't pass the quality checks :) I don't know anything about scripting but would it be possible to perfect the script by making it not take up too many SM groups?
  • pixelb
    Offline / Send Message
    pixelb polycounter lvl 7
    However with the script I am getting a ton of smoothing groups, and some faces have like 6 different smoothing groups for no reason. So in game development this doesn't pass the quality checks  I don't know anything about scripting but would it be possible to perfect the script by making it not take up too many SM groups?

    I'd also like this but I don't know that it's possible. Max must be doing some math behind the scenes and assigning groups in a way that makes it possible to have hard edges that don't loop all the way around a group of polys. 

    @kio, it's a great script, thank you. Any chance it will be turned into a modifier?

  • Yoji
    Offline / Send Message
    Yoji polycounter lvl 3
    OH YES! This saved the day! Thank you all! 
    The script worked magic! Sadly the many smoothing groups stands true.

    Since I bake with Marmo so all seams will be hard edges anyway.
    Is there any chance of a method like: "Make all UV islands different Smoothing Groups? " 


  • monster
    Offline / Send Message
    monster Polycount Sponsor
    The FWN script on my page has a Smoothing Groups from UV Seams button.

    http://portfolio.juantwo.com/maxscripts.html

  • Yoji
    Offline / Send Message
    Yoji polycounter lvl 3
Sign In or Register to comment.