Home Technical Talk

[HELP] Face Weighted Vertex Normals Maya

ZeroBiit
polycounter lvl 5
Offline / Send Message
ZeroBiit polycounter lvl 5
Hi,
I've been struggling trying to achieve the FWVN technique in Maya (2018), but I still get some bad result even on some simple shapes.
I've already tried various plugins like BNormal or ADN tool.

Example:



Has anyone found a good/fast way to achieve a good  in Maya?

Replies

  • kanga
    Offline / Send Message
    kanga quad damage
    OOOOps! Sorry, bad post.
  • ZeroBiit
    Offline / Send Message
    ZeroBiit polycounter lvl 5
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    Your screens are confusing . Left has no bevels necessary for FWVN  while right does have them
  • ZeroBiit
    Offline / Send Message
    ZeroBiit polycounter lvl 5
    gnoop said:
    Your screens are confusing . Left has no bevels necessary for FWVN  while right does have them
    In the left image, I'm showing the mesh before applying the bevels, in the right, there is the mesh with every edge bevelled.
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    Show you beveled mesh with VN visualized , that might help to give an idea
  • ZeroBiit
    Offline / Send Message
    ZeroBiit polycounter lvl 5
    gnoop said:
    Show you beveled mesh with VN visualized , that might help to give an idea

  • gnoop
    Offline / Send Message
    gnoop sublime tool
    Well,  sorry but I don't know why it looks that way.  Your mesh and normals are perfectly ok.  

    Maybe it's just how the shader forms highlight spot there.   Try another math method maybe.        Import to Blender and try there.

    Anyway  the idea behind FWVN is to transfer shading artifacts caused by shading gradients   from big flat polygons  to smaller tiny bevel ones where they are just less noticeable.  
  • ZeroBiit
    Offline / Send Message
    ZeroBiit polycounter lvl 5
    gnoop said:
    Well,  sorry but I don't know why it looks that way.  Your mesh and normals are perfectly ok.  

    Maybe it's just how the shader forms highlight spot there.   Try another math method maybe.        Import to Blender and try there.

    Anyway  the idea behind FWVN is to transfer shading artifacts caused by shading gradients   from big flat polygons  to smaller tiny bevel ones where they are just less noticeable.  
    In Blender there is the Weighted Normal Modifier which works awesome!

    By the way, what plugin/tool do you use to achieve the desired effect in Maya?

  • ZeroBiit
    Offline / Send Message
    ZeroBiit polycounter lvl 5
    So, I've exported the same mesh to Blender and I've added a Bevel modifier + Weighted Normal Modifier and the result is perfect:


    Then I've exported the same mesh from Blender to Maya and it is still perfect:


    So I guess that the tool AMT Normal Tools is not working properly in Maya 2018.
    Are there any modern tool/script to achieve this method in Maya 2018/2020?
    Any suggestion here?
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    I don't know, sorry.   Switched to Blender completely  years ago
  • Leksey
  • ZeroBiit
    Offline / Send Message
    ZeroBiit polycounter lvl 5
    Leksey said:
    So, apparently this tool works in most cases but not in every case.

    As you can see in the next image I've got a new example:
    The bottom mesh is the result of the tool, where some faces along the big curved part are not perfect.
    The upper mesh is what I should expect on the curved part in terms of shading.



    Apparently these tools kinda work only if do the bevel with the Mitering mode set to none, this means that, if you just forget to set just a single bevel with the Mitering=None, the whole model is screwed. 

    At this point, the weighted face vertex normal workflow doesn't seem a viable option in Maya...
  • Leksey
    Offline / Send Message
    Leksey polycounter lvl 6
    ZeroBiit
    The script automatically calculates the angle face and aligns the vertex of the normal. Cylindrical, spherical shapes do not require calculations. This script does not have such a function to control the process. It is necessary to select the faces and apply the script.

  • Leksey
    Offline / Send Message
    Leksey polycounter lvl 6
    In my arsenal, there is a python script.
    It calculates and cylindrical shapes too.

    <p># ---------------------------------------------------------------------------------------</p>
    <p># - pompVertNormFaceAvg</p>
    <p>#</p>
    <p># - Sets the vertex normals of a face selection,</p>
    <p>#   averaging normals shared by multiple selected faces.</p>
    <p>#</p>
    <p>#</p>
    <p># - by Pontus Karlsson 2013 (www.pomperi.com)</p>
    <p># ---------------------------------------------------------------------------------------</p>
    <p> </p>
    <p>import maya.cmds as cmds</p>
    <p> </p>
    <p>faces = cmds.filterExpand(sm=34, ex=True)</p>
    <p>verts = cmds.ls((cmds.polyListComponentConversion(faces, ff=True, tv=True)), flatten=True)</p>
    <p>normals = [[], [], []]</p>
    <p> </p>
    <p>for v in verts:</p>
    <p>    conFaces = cmds.ls(cmds.polyListComponentConversion(v, fv=True, tf=True), flatten=True)</p>
    <p>    shaFaces = list(set(conFaces).intersection(set(faces)))</p>
    <p>    faceNorm = cmds.polyInfo(shaFaces, fn=True)</p>
    <p>    </p>
    <p>    for normal in faceNorm:</p>
    <p>        label, vertex, x, y, z = normal.split()</p>
    <p>        normals[0].append(float(x))</p>
    <p>        normals[1].append(float(y))</p>
    <p>        normals[2].append(float(z))</p>
    <p>        </p>
    <p>    x_avg = (sum(normals[0]) / len(shaFaces))</p>
    <p>    y_avg = (sum(normals[1]) / len(shaFaces))</p>
    <p>    z_avg = (sum(normals[2]) / len(shaFaces))</p>
    <p>    </p>
    <p>    cmds.select(v)</p>
    <p>    cmds.polyNormalPerVertex(xyz = (x_avg, y_avg, z_avg))</p>
    <p>    </p>
    <p>    normals[:] = [[], [], []]</p>
    <p> </p>
    <p>cmds.select(cl=True)</p>


  • ZeroBiit
    Offline / Send Message
    ZeroBiit polycounter lvl 5
    Leksey said:
    ZeroBiit
    The script automatically calculates the angle face and aligns the vertex of the normal. Cylindrical, spherical shapes do not require calculations. This script does not have such a function to control the process. It is necessary to select the faces and apply the script.

    Okay, that makes sense now.

     It's kinda sand that you have to do some manual tweaking, it can be a huge waste of time.

    In Blender you can achieve the same effect just adding two modifiers:


    But, right know Maya is my main modeling application. I would pay for a fully automated script in Maya.
  • ZeroBiit
    Offline / Send Message
    ZeroBiit polycounter lvl 5
    Leksey said:
    In my arsenal, there is a python script.
    It calculates and cylindrical shapes too.

    <p># ---------------------------------------------------------------------------------------</p>
    <p># - pompVertNormFaceAvg</p>
    <p>#</p>
    <p># - Sets the vertex normals of a face selection,</p>
    <p>#   averaging normals shared by multiple selected faces.</p>
    <p>#</p>
    <p>#</p>
    <p># - by Pontus Karlsson 2013 (www.pomperi.com)</p>
    <p># ---------------------------------------------------------------------------------------</p>
    <p> </p>
    <p>import maya.cmds as cmds</p>
    <p> </p>
    <p>faces = cmds.filterExpand(sm=34, ex=True)</p>
    <p>verts = cmds.ls((cmds.polyListComponentConversion(faces, ff=True, tv=True)), flatten=True)</p>
    <p>normals = [[], [], []]</p>
    <p> </p>
    <p>for v in verts:</p>
    <p>    conFaces = cmds.ls(cmds.polyListComponentConversion(v, fv=True, tf=True), flatten=True)</p>
    <p>    shaFaces = list(set(conFaces).intersection(set(faces)))</p>
    <p>    faceNorm = cmds.polyInfo(shaFaces, fn=True)</p>
    <p>    </p>
    <p>    for normal in faceNorm:</p>
    <p>        label, vertex, x, y, z = normal.split()</p>
    <p>        normals[0].append(float(x))</p>
    <p>        normals[1].append(float(y))</p>
    <p>        normals[2].append(float(z))</p>
    <p>        </p>
    <p>    x_avg = (sum(normals[0]) / len(shaFaces))</p>
    <p>    y_avg = (sum(normals[1]) / len(shaFaces))</p>
    <p>    z_avg = (sum(normals[2]) / len(shaFaces))</p>
    <p>    </p>
    <p>    cmds.select(v)</p>
    <p>    cmds.polyNormalPerVertex(xyz = (x_avg, y_avg, z_avg))</p>
    <p>    </p>
    <p>    normals[:] = [[], [], []]</p>
    <p> </p>
    <p>cmds.select(cl=True)</p>


    Sorry, I missed your reply, I still can't get it to work correctly.
  • Leksey
    Offline / Send Message
    Leksey polycounter lvl 6
    @ZeroBiit
    Just select the faces and run the script. Use the tab in script editor for Python.

  • Leksey
    Offline / Send Message
    Leksey polycounter lvl 6
    I recorded a video on how to quickly make weighted vertex, 
    using transfer attributes.
    https://www.youtube.com/watch?v=xoRGiTQteQ4
  • ZeroBiit
    Offline / Send Message
    ZeroBiit polycounter lvl 5
    Leksey said:
    I recorded a video on how to quickly make weighted vertex, 
    using transfer attributes.
    https://www.youtube.com/watch?v=xoRGiTQteQ4
    Wow This is really helpful, thank you so much. 

    BTW, very nice tool bar. :) 
Sign In or Register to comment.