Home Technical Talk

[MaxScript] Average / Copy Seams' Vertex Normal

polycounter lvl 10
Offline / Send Message
trebor777 polycounter lvl 10
Hi everyone!

This is a little tool I made to fix the seams between 2 objects by averaging or copying the normals from one another's borders.
Quite useful when you split meshes, but need to have lighting consistency between them.

You need to select the same number of edges/borders on both mesh before using the tool.

The tool will compute the closest vertices from each other and uses those normals.

Tested on 2012 and 2014.
Enjoy ! :D!!

AverageBorderNormal.png



LINK

[ame]https://www.youtube.com/watch?v=SV42oZ9wxWo[/ame]

Replies

  • nyx702
    Options
    Offline / Send Message
    This is awesome. Saves me so much time! Thanks man.
  • trebor777
    Options
    Offline / Send Message
    trebor777 polycounter lvl 10
    You're very welcome!
    I'm always glad when someone is grateful to me ^^ :D
  • trebor777
    Options
    Offline / Send Message
    trebor777 polycounter lvl 10
    Updated! :)
    Fixed a few bugs !

    - Now works on any stack as its using its own EditPoly for the vertex selection (name it "VertSelect"). It's created automatically for you when you pick geometry.
    - Uses Vertex selection only now. (makes my life easier)
    - If current selection is made of 2 meshes when starting the tool, those are automatically picked.


    ONLY When Copying, Source/Destination vertices must only have 1 normal.
    Enjoy! :)
  • beefaroni
    Options
    Offline / Send Message
    beefaroni sublime tool
    Hmm. I'm assuming this was made to solve the problems of mirrored meshes for normal maps and stuff.

    I'm not really sure how to use this program though. If the meshes aren't attached to one another I'm confused how it will work for games.
  • Noors
    Options
    Offline / Send Message
    Noors greentooth
    Imagine you have a low poly sphere. You detach half of it, so you have 2 objects. You get the nasty hard edge where it's cutted off. With this script you can average the vertex normals on both object so the sphere looks "intact". I use this on terrain meshes for instance.

    Wanted to use this scirpt this very day, but the vertex count thingy couldn't work for me.
    But merci beaucoup !
  • trebor777
    Options
    Offline / Send Message
    trebor777 polycounter lvl 10
    Noors (you're welcome) explained it perfectly.
    It's quite useful for example if you have several heads that need to fit on a single torso,something that happen a lot in . actually. you need to hide that seam because of "broken" vertex normals.

    This script aims to resolve that issue.
    But in any case the normal map needs to be baked at the same time on both mesh else the normal map will still cause an issue.

    Hope that helped to understand. :)
  • Eric Chadwick
    Options
    Offline / Send Message
    Hey trebor777 thanks for sharing this!

    I was testing it out before I add it to our wiki, but I couldn't get it to work. I've probably got the steps wrong though.

    1. Make a teapot, collapse to Editable Poly.
    2. Deleted all elements except the lid. Select half the faces, Detach.
    3. Select the vertices along the seam, click the Create panel (to keep that SubObject in a selected state).
    4. Select the detached mesh, select the vertices along the seam, click the Create panel (to keep that SubObject in a selected state).
    5. Load each half in your script, press the Average Borders button.

    It adds the named Edit Poly modifier, with some modified normals, but they don't match the other object?

    http://ericchadwick.com/examples/images/AverageBorderNormals_TeapotLid.max (Max 2012)

    AverageBorderNormals_TeapotLid.png
    (here I added an Edit Normals modifier to both, to compare the normals)
  • trebor777
    Options
    Offline / Send Message
    trebor777 polycounter lvl 10
    THanks Eric :) Seems like the Average border has a little issue. Looking into it.

    THe copy feature works fine though :)



    EDIT: FIXED
    The issue was that after I "deinstanciate" the editNormals modifier on both object to make them unique, I delete the editNormals on the source object, which is wrong when you're averaging borders as both sides are affected.

    So I just added an IF for when i'm just copying or averaging and delete the modifier in that case or not. :)
  • skankerzero
    Options
    Offline / Send Message
    I can test this in 2010 when I get home.

    This is extremely useful when dealing with tons of parts across organic objects. Thanks!
  • trebor777
    Options
    Offline / Send Message
    trebor777 polycounter lvl 10
    Added a little tutorial as well, just in case.
    [ame]https://www.youtube.com/watch?v=SV42oZ9wxWo[/ame]


    Edit: Also fixed the little "bug" that placed the fixBorder above the EditNormals like in the video which made it look like the copying wasn't working. :D
  • beefaroni
    Options
    Offline / Send Message
    beefaroni sublime tool
    Oh damn I didn't think this thread would get a reply!! Thank you for doing an update. I'll give it another try soon.
Sign In or Register to comment.