Home Technical Talk

Maya unlock normals without destroying smoothing information

Hey all,

I've been having a on-going issue with the whole process of editing or exporting models that have locked normals and importing them into 3DSMax where I use a plugin that is meant for quickly compiling the models to source without having to manually write and QCs or anything.

My biggest issue is that when I have a situation where I have locked normals (IE: importing any obj into maya which locks the normals automatically, a pain) the normals can't be edited unless you click "unlock normals" which completely resets all smoothing that was done and pretty much means if i want to edit the normals I will have to completely redo them all over again and this is VERY tedious on more complex models.

When the normals are locked they also dont ever want to export correctly in the final product when they are compiled into the source engine via the 3DS Max plugin (The normals appear to look fine in 3DS Max viewport but if you look into smoothing group info it shows it has none).

This brings me to my question of how would one go about unlocking normals on a model in Maya while retaining all the smoothing that was done to them before said unlock that destroys the smoothing. If this isn't possible, would anyone be kind enough to write a mel script that would successfully unlock normals while simultaniously assessing which edges were already soft or hard and reapplying them in an unlocked form and that works in Maya 2012/2011?

I would deeply appreciate this!

Additional info:
I do know someone by the name of Marcel Vijfwinkel had attempted to write such a plugin ( In this thread: http://forums.cgsociety.org/showthread.php?t=115872 ) but as I've tried it recently it no longer seems to work after it is done processing the model becuase the normals are still locked once the progress bar has went through and "done its thing".

Replies

  • throttlekitty
    Options
    Offline / Send Message
    I'm also curious about this. Maya handles soft/hard edges and vertex normals differently, and it's always been a pain.
  • KevinLongtime
    Options
    Offline / Send Message
    Hmm, this is how every other thread I've seen talking about mayas locked normals issue ends up. Nobody replys with any answers.

    It seems that either I'm skipping over some easy remedy (which if I am, please do tell) or not enough people are having this issue that they want to fix it. Or I guess that its simply currently too hard to do...idk :(
  • couette
    Options
    Offline / Send Message
    With the FBX format, you can import an object with the normals unlocked. By default they're locked on import, but there's an option in the geometry rollout of the importer to unlock them. This, however, may not have been the solution you're looking for.
    My biggest issue is that when I have a situation where I have locked normals (IE: importing any obj into maya which locks the normals automatically, a pain) the normals can't be edited unless you click "unlock normals" which completely resets all smoothing that was done and pretty much means if i want to edit the normals I will have to completely redo them all over again and this is VERY tedious on more complex models.

    If you don't mind me asking, what software are you exporting the .obj from and then importing to Maya? I'm trying to picture the situation where you would custom edit the normals in Maya or another app, export as an .obj, and then import the obj into Maya to tweak some of the normals.

    When the normals are locked they also dont ever want to export correctly in the final product when they are compiled into the source engine via the 3DS Max plugin (The normals appear to look fine in 3DS Max viewport but if you look into smoothing group info it shows it has none).

    There's aren't any smoothing group ids because the .obj format doesn't use smoothing groups. It uses explicit vertex normals. AFAIK, to have smoothing group ids assigned on import in 3DS Max, the file format needs to support it and the exporting app has to use it. In Max, you can have explicit normals, that's why it looks fine in the viewport. If it doesn't look correct in the Source Engine, perhaps the issue is with the plugin? Is it using smoothing groups to derive normals?
  • sprunghunt
    Options
    Offline / Send Message
    sprunghunt polycounter
    well my suggestion would be just to redo the normals in max. Or export the model directly from maya.
  • KevinLongtime
    Options
    Offline / Send Message
    couette wrote: »
    With the FBX format, you can import an object with the normals unlocked. By default they're locked on import, but there's an option in the geometry rollout of the importer to unlock them. This, however, may not have been the solution you're looking for.



    If you don't mind me asking, what software are you exporting the .obj from and then importing to Maya? I'm trying to picture the situation where you would custom edit the normals in Maya or another app, export as an .obj, and then import the obj into Maya to tweak some of the normals.




    There's aren't any smoothing group ids because the .obj format doesn't use smoothing groups. It uses explicit vertex normals. AFAIK, to have smoothing group ids assigned on import in 3DS Max, the file format needs to support it and the exporting app has to use it. In Max, you can have explicit normals, that's why it looks fine in the viewport. If it doesn't look correct in the Source Engine, perhaps the issue is with the plugin? Is it using smoothing groups to derive normals?

    I use OBJs with 3rd party software for ease of use uv-unwrapping and such. There are also many senarios where an OBJ format can come into play like old models you had exported to obj and then say your hard drive messed up and you have a bunch of OBJ's as the only copy and the normals are locked on them. Imagine if the said normals are rediculously complicated too. Also, when I am collaborating with people online and we had used the OBJ format. Importing SMD's. The list goes on.

    Also, I dont try to use OBJ for exporting to max from maya. I have been using the FBX format which works when the normals arnt locked just fine from Maya to Max. Its when the normals are locked is when I have issues. This is why I need to figure out how to successfully unlock the normals inside of maya on an already locked model *WHILE keeping the normals it had before the unlock*
    sprunghunt wrote: »
    well my suggestion would be just to redo the normals in max. Or export the model directly from maya.

    While I do appreciate the reply, this is the exact OPPOSITE of what I'm trying to do. The whole point was to try and get the locked normals back to unlocked so that exporting directly from maya isnt an issue.

    - When I export models directly from Maya that have unlocked normals it works perfectly.

    - When I export models directly from maya with locked normals it messes up.

    I can't justify having to learn a whole new app for normals and or to drastically change my workflow becuase of some very strange export issue. I'd like to try and solve it so that I can continue working pretty much solely in the Maya environment that I love and feel comfortable with. All except for this locked normals buisness. This is why I had made this thread.


    Am I not explaining myself that well? I feel im being sorta misunderstood lol.
  • couette
    Options
    Offline / Send Message
    I use OBJs with 3rd party software for ease of use uv-unwrapping and such. There are also many senarios where an OBJ format can come into play like old models you had exported to obj and then say your hard drive messed up and you have a bunch of OBJ's as the only copy and the normals are locked on them. Imagine if the said normals are rediculously complicated too. Also, when I am collaborating with people online and we had used the OBJ format. Importing SMD's. The list goes on.

    If you're using another program to unwrap after editing the normals, while using the .obj format between apps, you can transfer your UV data over. The Mesh->Transfer Attributes menu will allow you to transfer UV sets between objects.

    As for editing the normals of objects that only exist in .obj format, you can always import the obj, export as FBX, and then import the FBX with the unlock normals option checked.
    Also, I dont try to use OBJ for exporting to max from maya. I have been using the FBX format which works when the normals arnt locked just fine from Maya to Max. Its when the normals are locked is when I have issues. This is why I need to figure out how to successfully unlock the normals inside of maya on an already locked model.

    The FBX format doesn't retain 'locked' or 'unlocked' information, afaik. It should make no difference when you export. You can see this for yourself by creating a simple shape.

    Create an object with just a few polygons and custom edit the normals. Export it twice as an ASCII FBX; first with the normals unlocked, and then the normals locked. Compare both files. The object properties section of both files should be the same. Maya might re-order some of the indices on denser meshes, but the final result should be the same.
  • KevinLongtime
    Options
    Offline / Send Message
    If you're using another program to unwrap after editing the normals, while using the .obj format between apps, you can transfer your UV data over. The Mesh->Transfer Attributes menu will allow you to transfer UV sets between objects.

    Thanks, but yes, I have had to use this for all my models that still have havent been exported before and to transfer over the UVs from the newly imported obj with the unwrap to the unexported model.

    This however doesn't cover every other model I have that was an OBJ and imported into Maya. Which is why this issue is so aggrivating for me. Re-doing the normals on those would be WAY too time consuming as a I have a ton of OBJs laying around not just one or two.
    As for editing the normals of objects that only exist in .obj format, you can always import the obj, export as FBX, and then import the FBX with the unlock normals option checked.

    Correct me if i'm wrong, but in Maya wouldn't this be the same as selecting the object and clicking Normals>Unlock Normals? Which unlocks the normals, but destroys any smoothing that was done beforehand and sets them all back to a faceted state so that you would have to redo them all over again. I'm looking at the documentation of the FBX plugin for unlock on import and it looks like this is all its doing. (ill do some testing still anyhow)

    The KEY is for me to be able to unlock WHILE retaining any smoothing that was done beforehand but just in an editable state. Not destroy and redo all over again - that was the tedious unneeded part I was talking about earlier in my first posts which I shouldn't need to do if there was a simple unlock while retaining smoothing button or something.

    The FBX format doesn't retain 'locked' or 'unlocked' information, afaik. It should make no difference when you export. You can see this for yourself by creating a simple shape.

    Create an object with just a few polygons and custom edit the normals. Export it twice as an ASCII FBX; first with the normals unlocked, and then the normals locked. Compare both files. The object properties section of both files should be the same. Maya might re-order some of the indices on denser meshes, but the final result should be the same.

    You would think so yes, I'd hope it to be this simple where it shouldn't make a difference between locked and unlocked. However, when I use a plugin in 3DS Max that compiles to the Source Engine it says differently. I have done TONS of testing and it appears to really only point to unlocked vs locked normals as the cause.

    The unlocked normal models have no issue once compiled to the engine and looked at. The locked normal models have tons of issues and look nothing like they should as far as smoothing information goes when compiled and looked at in the engine. (i'll have to post some pictures in a bit if needed, got a few things to do ATM in the time of writing this)

    I'll again point towards a thread where a guy was making a script for what i'm trying to be able to do. Even though it was back in 2004, it shows how much of a pain it is for him to have to write a script for it (which, said script doesnt work anymore these days.)
    http://forums.cgsociety.org/showthread.php?t=115872
    (in this script i think he was doing vertex normals not edge normals. Idk the exact difference though - or if there even is a difference for that matter lol)

    The first guy who replied in this thread named "throttlekitty" might also have some more insight as to how annoying this issue is.
  • shawnolson
    Options
    Offline / Send Message
    shawnolson polycounter lvl 13
    Wunderboy is working on an update to his SMD exporter that will elliminate the problem altogether. In other words, you won't have to worry about it at all and the problem will magically disappear.

    Check your email for the test build.
  • KevinLongtime
    Options
    Offline / Send Message
    shawnolson wrote: »
    Wunderboy is working on an update to his SMD exporter that will elliminate the problem altogether. In other words, you won't have to worry about it at all and the problem will magically disappear.

    Check your email for the test build.


    Thanks again, Shawn!

    (Shawn is the creator of the tool I mentioned in my first post - if you need an extremely easy (and free) way to compile to the source engine from 3DSMax check his plugin out at http://wallworm.com/projects/utilities/docs/ . No more manually writing QC files or anything! They also got a nice forum over there too if you have any questions, feedback or feature requests. He's always willing to help - Good guy!)
  • c.buliarca
    Options
    Offline / Send Message
    c.buliarca polycounter lvl 9
    Hello I don't know if this will solve your problem, but I've made a python script for maya to transform the locked normals into hard and soft edge. This way when you export again in max the smoothing groups will be there.

    http://www.creativecrash.com/maya/downloads/scripts-plugins/polygon/c/lockednormals-to-hard-soft-edge

    Thank you.
  • JohnnyRaptor
    Options
    Offline / Send Message
    JohnnyRaptor polycounter lvl 15
    Can you not duplicate your mesh, unlock normals, then copy the smoothing information over from original unlocked mesh?
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    will experiment when I get home, but the reason why it fucks up when ulocking normals is with normals locked Maya reads normals directly from the mesh, but when there unlocked Maya needs to figure out how to display all spilt normals with its hard/soft edge system. Which it seems really bad at figuring out.

    if you need to re do normals I find doing uv splits to hard edges will give you a good starting point in one click.

    edit: and the lack of good source tools on Maya has me so pissed off that I actually started working on smd, and dmx translators and a script for writing qc's. But it will be pretty far down the road before that is full featured enough to distribute.
  • Ott
    Options
    Offline / Send Message
    Ott polycounter lvl 13
    Has anyone ever found an answer to this? I am currently facing this exact same issue. I'm a Maya noob, but I am in a similar situation where I absolutely must take my Max files into Maya and start the smoothing Harden / Soften all over again.

    Splitting by UV shells is an option, but not the most optimal. Even when I do it in Max, I typically optimize the mesh a little manually for cleanup.

    If anyone knows precisely how to preserve the Maya imported smoothing groups and retain them AFTER unlocking, I'm all ears!
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    locked normals should export over fine, just as long as you don't try to edit them in max.

    think your misunderstanding the purpose of locked vs unlocked normals.

    unlocked normals are compleatly generated by the 3d package, based on topology while locked normals exist so changes the user makes don't get overwritten by the calculation the 3d package makes.
  • SouthpawSid
    Options
    Offline / Send Message
    SouthpawSid polycounter lvl 7
    no Don. Just. No. ;)
  • c.buliarca
    Options
    Offline / Send Message
    c.buliarca polycounter lvl 9
    Hi everyone,

    did someone tried my script yet? I had this problem that I think I've solve it with the script. The idea is that when you are exporting some object that has smoothing groups on it from max in fbx or obj format, it will come in maya with the normals locked, and if you try to unlock the normals and edit the object, the smoothing information is lost and you have to create it again. To create it again you have two options, you either make it with hard and soft edges, or with the average face normals option. My script come in handy here, it will take your imported object with the locked normals and transform this information to soft and hard edges. This way you can make any changes to your object, and when you will export it in .fbx format and import it in max it will have the smoothing groups there.(of course you have to check in the max fbx importer window to import the smoothing groups as well). I've noticed that if you export from maya an object that has hard and soft edges the smoothing groups will be there in max, but if you exported it with the normals locked from maya you won't have any smoothing groups in max, it will only come with locked normals. And from my experience the engines ( I don't know if all of them, but Unreal yes) are looking for the smoothing groups not for the normal information. So please check out my script and tell me if that helped you.

    http://www.creativecrash.com/maya/downloads/scripts-plugins/polygon/c/lockednormals-to-hard-soft-edge

    Thank you.
  • HitmonInfinity
    Options
    Offline / Send Message
    HitmonInfinity polycounter lvl 11
    c.buliarca wrote: »
    did someone tried my script yet? I had this problem that I think I've solve it with the script.

    I'm a little late to the party... but yes, I tried the script. Worked great! You have no idea how helpful this will be around the studio.
  • Kon Artist
    Options
    Offline / Send Message
    Kon Artist polycounter lvl 8
    If Maya changes your normal information (hard and soft edges). Select one edge and reclassify that edge as either hard or soft... the rest of the normals on the mesh will pop back the way they should be.
  • c.buliarca
    Options
    Offline / Send Message
    c.buliarca polycounter lvl 9
    I'm a little late to the party... but yes, I tried the script. Worked great! You have no idea how helpful this will be around the studio.

    Hi HitmonInfinity, that's great, I am glad that the script helped you and I didn't worked on it in vane.
    Actually I've seen now that with the last version of FBX they add the option to import unlocked normals as well and they will come in Maya as hard and soft edges. This option is making the script obsolete now :(, or it can be used in case you are importing .obj files, but I don't know if anyone is using this format anymore.
  • birt
    Options
    Offline / Send Message
    Thank you, c.buliarca! this script has helped me alot!
  • c.buliarca
    Options
    Offline / Send Message
    c.buliarca polycounter lvl 9
    Your welcome birt, I'm glad it helped.
Sign In or Register to comment.