We are happy to share with you a Max Script that will help you unwrap your meshes for light bake. With this script you can batch create a new map channel and unwrap selected meshes. The newly created UVs will be then used for lightmaps in Unreal when light baking.
When you install this script, you can add it in your toolbar by drag and dropping it from ІІCustomizeІІ > Customize User Interface > Toolbars > Main UI > VRay > Auto unwrapper.
The Auto unwrapper uses Max’s Flatten UV functionality so if the meshes have large amount of polys Max itself will not be able to handle it and will probably freeze/crash. With that in mind we added a threshold for amount of polygons and objects that have larger amount than the specified will be skipped in the unwrapping process. After the unwrap process is completed, all meshes that have been skipped are stored in a selection set for easier selection. The options in the dialogue box of the script have tooltips with descriptions of the functionality. Each time you execute the “Unwrap with flatten” option, an autoUnwrapper.lol file is generated in C:\Users\USER_NAME\AppData\Local\Autodesk\3dsMax\V ERSION - 64bit\ENU\en-US\plugcfg that lists all processed meshes, their location and timestamp for star/end of unwrap process for each mesh.
Feel free to modify the script in any way you see fit and all suggestions are welcomed for its polishing.
Thank you for the script, but everytime I try to run it I get an error “--unable to convert:false to type:integer” and it highlights the follwing line in the script :
---------------------------
MAXScript Rollout Handler Exception
---------------------------
-- Unable to convert: false to type: Integer
---------------------------
OK
---------------------------
Thanks for your feedback! Could you provide a bit more context please? What version of 3ds Max are you using? Are those all the messages in the MAXScript Listener? What steps do you perform to install and run the script? It looks like an error on my side, but I need more info to replicate it or at least find where it is.
Well, I was using Max 2019 with issues, but I’m now using 2020 and it seems to be working with out any issues…not sure what was going on. I’ll let you know if I run into any further problems.
When I use it on scenes with objects imported from/linked to AutoCAD I get an error from the addModifier on line 534. I looks like it doesn’t lke some of the classes brought in from AutoCAD. I modified line 515 to filter them out:515 for s in theSel where not iskindOf s LinkComposite doI don’t know if that’s the best place but it seems to work now.
The script is updated both in the link at the beginning and the attachment. For your convenience you can click here: autoUnwrapper_v4.zip. Please let us know if you encounter other issues.