Home Technical Talk

Is there a tool to copy the vertex normal direction from one vertex to another in Maya?

polycounter lvl 8
Offline / Send Message
Glacierfox polycounter lvl 8
Hi. I'm often in situations where I need to manually alter the normal direction on individual verts to fix shading issues on my models. Is there a tool in Maya to copy the normal direction from one vert to another? I'm currently using a hacked together script to do it but I'm surprised there isn't something in Maya by default. 
The closest thing I can find is the 'Set Vertex Normal' in the 'Mesh Display' rollout but this tool only allows you to move the direction with the rotate manipulator which is very imprecise.

Thanks for any help! 

Replies

  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    Transfer attributes.
  • Glacierfox
    Options
    Offline / Send Message
    Glacierfox polycounter lvl 8
    Obscura said:
    Transfer attributes.
    I had a look at a that bit not sure how that allows me to copy the direction of a vertex normal from one vertex to another on the same model?

    The yellow ones are the ones I've done with my tool. Just wondering if there was something in Maya incase this stops working at some point. That surface is slightly curved and aligning those vertex normals stops them from pinching due to the triangles I've put there. This tool only seems to be able to transfer between meshes unless I'm mistaken?

    Thanks for your help!


  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    I misunderstood your question. I thought you want to transfer from one mesh to another.  Why don't you just set thos faces to use flat shading? It would solve the issue without a need of transfering normals. So there is a hard edge. That should make them pointing in the same direction.
  • jRocket
    Options
    Offline / Send Message
    jRocket polycounter lvl 18
    Should be pretty easy to make a script to do this.
  • neilberard
    Options
    Offline / Send Message
    neilberard polycounter lvl 17
    This script will copy normals from the first selected vertex to all the other vertices you have selected. Be sure to have ordered selection set in your Maya prefs.  

    import maya.cmds as cmds

    sel = cmds.ls(orderedSelection=True, flatten=True)
    nrm = cmds.polyNormalPerVertex(sel[0], query=True, xyz=True )

    for i in sel[1:]:
        cmds.polyNormalPerVertex(i, edit=True, allLocked=True)
        cmds.polyNormalPerVertex(i, edit=True, xyz=nrm[0:3])
  • Glacierfox
    Options
    Offline / Send Message
    Glacierfox polycounter lvl 8
    Obscura said:
    I misunderstood your question. I thought you want to transfer from one mesh to another.  Why don't you just set thos faces to use flat shading? It would solve the issue without a need of transfering normals. So there is a hard edge. That should make them pointing in the same direction.
    You can't really tell from the image but that surface is very slightly curved. It's a plastic cover on the front of a truck. I've had to make some adjustments to it to get the holes for the lights in there which messed up the normals due to the non-uniform topology. Any hard edges I put in there visibly show up due to it being slightly curved.

    Thanks for your help and I have managed to get the normals looking okay but I was just wondering if there was a more 'standard' way of doing it as this is something I have to tackle quite a lot. 
  • Glacierfox
    Options
    Offline / Send Message
    Glacierfox polycounter lvl 8
    This script will copy normals from the first selected vertex to all the other vertices you have selected. Be sure to have ordered selection set in your Maya prefs.  

    import maya.cmds as cmds

    sel = cmds.ls(orderedSelection=True, flatten=True)
    nrm = cmds.polyNormalPerVertex(sel[0], query=True, xyz=True )

    for i in sel[1:]:
        cmds.polyNormalPerVertex(i, edit=True, allLocked=True)
        cmds.polyNormalPerVertex(i, edit=True, xyz=nrm[0:3])



    This is gold! Thank you for this! 
  • gnoop
    Options
    Offline / Send Message
    gnoop polycounter
    I wonder how  Maya transfers UVs  currently?    Does it work?      I tried years ago and couldn't do it reliably.   I mean to a low poly mesh with different topology.    

    Such a feature exists in Max for decades but works only for pretty tessellated mid res meshes , same  in Blender.  
    Could be useful to fix UV on lods  but never works for too low res meshes
Sign In or Register to comment.