Home Technical Talk

[3DSMAX] Import multiple objects UVW's from FBX (Keep modifier stack) - use Unfold 3D for UVW

interpolator
Offline / Send Message
OccultMonk interpolator
Is there a script for 3dsmax that re-applies modifiers (or would it be possible to create one).

The workflow would be as follows:

1) Export Scene objects using FBX (Without the modifiers).
2) Unwrap and Pack in an external program like Unfold 3D
3) Re-import the FBX.
4) The Script should re-apply the modifier stack to each object (and delete the old scene object). *
* - Instances / References should also be taken into account

The advantage would be fast unwrapping and packing while maintaining the modifier stack.


Replies

  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter
    You can't maintain instances of the exported/imported object but the rest is possible -  although tbh it's hardly worth bothering since you can copy & paste modifiers. 
  • OccultMonk
    Options
    Offline / Send Message
    OccultMonk interpolator
    If you have more 100th or 1000th of objects cutting and pasting modifiers by hand would be a lot of work. Such a script should copy and paste the modifiers automatically and delete the original objects.

    Also, instance support could be built in. Just export only one instance and during import replace the instance object with the imported object. 
  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter
    You could certainly do that.

    As long as you don't need to insert objects into hierarchies it should be relatively straightforward to do the swaps. 

    You can get a list of instances easily, 
    You can get a list of modifiers on an  object easily,
    Instancing modifiers from object to object is easy
    You can copy/apply transforms easily

    You've designed your script already and theres no maths or weird shit required .  Half a day with maxscript help/Google should be enough to knock it up yourself :) 
  • OccultMonk
    Options
    Offline / Send Message
    OccultMonk interpolator
    In my experience, it takes longer to make something like this. I could certainly make this myself (I have quite extensive programming / maxscript experience). But I just don't have the time to create scripts anymore. If something like this already exists or if someone else can make it a lot faster because they code frequently. I learned that scripting is a great way to get off-tracked.
  • miauu
    Options
    Offline / Send Message
    miauu polycounter lvl 14
    Lets say that the name of your scene is "MyScene_01"

    1) save your scene with new name - "MyScene_01_temp"
    2) "MyScene_01_temp" is currently loaded so, delete all modifiers from all objects and add suffix to the names of all objects.
    3) export scene objects using FBX. There will be no modifiers at all
    4) Unwrap and Pack in Unfold 3d
    5) re-import the FBX
    6) merge "MyScene_01".
    7) now object by object(using the suffix applied in step 2) you can tranfer the UV from objects of re-improted FBX file to merged objects(your original objects in "MyScene_01"). Finally you will have all objects in "MyScene_01" with proper modifiers and unwrapped.
    8) delete all objects from re-imporeted FBX.

    Some modifeirs can't be copy-pasted using maxscript. Edit poly modifeir is one of them.

  • OccultMonk
    Options
    Offline / Send Message
    OccultMonk interpolator
    @miauu Thanks, That seems a much better way to transfer the UVW's. Unfortunately, I just don't have the time for programming this. Do you know if such a script exists? It seems like a very useful thing to have.
  • miauu
    Options
    Offline / Send Message
    miauu polycounter lvl 14
    @miauu Thanks, That seems a much better way to transfer the UVW's. Unfortunately, I just don't have the time for programming this. Do you know if such a script exists? It seems like a very useful thing to have.
    1) Create two teapots with names Teapot001 and Teapot002
    2) unwrap Teapot002 inside 3ds Max just to see how the code will work
    3) execute this

    (<br>&nbsp;&nbsp;&nbsp; originalObject = $Teapot001<br>&nbsp;&nbsp;&nbsp; unwrappedObj = $Teapot002<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; ChannelInfo.ClearChannel originalObject 1<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; channelInfo.CopyChannel unwrappedObj 3 1<br>&nbsp;&nbsp;&nbsp; channelInfo.PasteChannel originalObject 3 1<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; modPanel.setCurrentObject unwrappedObj<br>&nbsp;&nbsp;&nbsp; addModifier unwrappedObj (unwrap_uvw()) ui:true<br>&nbsp;&nbsp;&nbsp; unwrappedObj.modifiers[#unwrap_uvw].unwrap.edit()<br>)
    This code will copy the map channel 1 of unwrappedObj(Teapot002) and will paste it to originalObj(Teapot001)
    The last 3 rows are not important to the script that you need.


  • OccultMonk
    Options
    Offline / Send Message
    OccultMonk interpolator
    @miauu Thanks, but how would this be implemented together with the batch import of the meshes? It seems like it could be quite a simple script to make this work. Does something like this already exist?  It seems quite useful to me (especially since unfold 3d is such an awesome external unwarp software).
  • OccultMonk
    Options
    Offline / Send Message
    OccultMonk interpolator
    Does anyone know of a script that:

    1) Imports one or more FBX files.
    2) Apply the UVW of each FBX object to the corresponding object in the 3dsmax scene
    3) Delete imported FBX.

    The workflow would be:

    1) - Manually export FBX of multiple meshes from 3dsmax to Unfold 3D
    2) - Manually unwrap and pack in Unfold 3D
    3) - Manually export from Unfold 3D with FBX
    4) - Use the script to import FBX and transfer UVW's to the corresponding objects in the 3dsmax scene (based on name/object ID?)

  • OccultMonk
    Options
    Offline / Send Message
    OccultMonk interpolator
    A bit clearer workflow:

    1) - Use the script to export meshes to FBX *
          * With an option to only export the base object (without modifiers)

    2) - Manually unwrap and pack in Unfold 3D and export to FBX

    4) - Use the script to import FBX and transfer UVW's to the corresponding objects in the 3dsmax scene (based on name/object ID?) *
          * the existing modifier stacks of these objects should remain unchanged.
  • miauu
    Options
    Offline / Send Message
    miauu polycounter lvl 14
    Can you upload a test scene. One object with modifiers and no UVs, and other, unwrapped and imported to the scene with proper UVs?
  • OccultMonk
    Options
    Offline / Send Message
    OccultMonk interpolator
    For other people looking for something like this. MIAUU helped me out with a great script, that can export and import UVW's to and from FBX and import them to the base object. Making it easy to work with Unfold3D. Though it can only unwrap the base object and not at any place in the stack.

    Later I also found a separate script: Unfold3D Bridge that works great and leaves the modifier stack intact (though it seems to have some problems with instances for me): 
    http://forum.unfold3d.com/thread/186/3dsmax-import-export-bridge-addon?page=4&scrollTo=2017

Sign In or Register to comment.