UVW / Map Channel Script Needed

Hi all,

We need to export some of our 3ds max files to another format. Most of our files are arch viz interiors. No characters, rigging, etc. Here's our current workflow:

A. Create the 3ds max file (using max 2009 x64 right now with V-Ray.

B. Bake the textures/lighting using VRayCompleteMap. This creates a shell material with the original material and the baked material. The original Map Channel is 1. The baked Map Channel is 3.

Our destination format supports only Map Channel 1. We do not need the original materials. We do not need the UVW coordinates on Map Channel 1.

#1. We need to clear all of the original materials from the shell, leaving us with only the "Standard" material (which is our baked material).

#2. We need to copy or paste all UVW coordinates from Map Channel 3 to Map Channel

#3. We need to change the Map Channel in all scene materials from Map Channel 3 to Map Channel 1.

(#1 is something that we can quickly do in the Render to Texture dialog right now)
(#2 may be solved by existing scripts on scriptspot.com...haven't tried them yet)
(#3 is currently unsolved)

It would be great to have a plugin or script that could do this with one click of a button. If it works as requested, we would be willing to pay someone for the script or plugin.

Thanks,
Tim

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Christopher Grant's picture

Replied to you via email...

Replied to you via email...

Tim's picture

Hi Christopher,         I am

Hi Christopher,

        I am now using the script on more complex files.  The script now seems to be corrupting any file on which it is used.

        In an effort to determine what may be causing the problem, I split the script into two parts:

1. Copy UV

2. Set Bitmap Channel

       Set Bitmap Channel seems to work like a charm.

       It appears that the Copy UV portion corrupts the file.  When I check File/Summary Info, it is completely blank.  Everything on screen appears fine. If I save the file, it also appears fine.  However, I am unable to open the resulting file.

        Any suggestions?

        Please note that I have NEVER written a maxscript.  In your script, can you tell me what the "o" and the "3" signify?  Perhaps I could add more of the "clearchannel" lines?  Maybe specify a number after the "o" ???

 try (
  channelinfo.copychannel o 3 srcUV
  channelinfo.pastechannel o 3 destUV
  channelinfo.clearchannel o srcUV
 )
 catch()

Tim's picture

Beautiful! Works

Beautiful! Works great!

Thanks so much!

Christopher Grant's picture

Here you go. This will solve

Here you go. This will solve issue 2 & 3 for you.

It's pretty simple - it just takes all geometry in the scene, copies uv3 to uv1, clears uv3 then sets all the bitmaps in the scene that use uv3 to use uv1.

Usage: Bake your textures as usual. Use the RTT dialog to clear your shell materials but keep the baked ones. Now run this script via Maxscript / Run Script and select this file.

** Note ** - this will clear your UV map from channel 3 and overwrite the map data you had previously set in UV channel 1. Thus this script should only be run on a copy of your scene not on your original file.

AttachmentSize
cg_CopyUVandSetBitmapChannel.ms 1.53 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.