Saturday, January 5, 2013

Exporting Multiple Materials from 3DS Max to Source

I was given the task of creating the fruit machine that Ed uses to alert the horde in Shaun of the Dead. Creating the machine was pretty simple, though we had a few requirements for this model.


Our goal was to have the model be activated in the game to alert the horde for one of the final end game sequences. Therefore, I had to create the model with both active states and an off state. The easiest way to achieve this was by making the model have 2 materials: one unchanging body material and one screen material that we can swap out with other textures.

The only problem was exporting this configuration out of Max for use within Source. I have been using the wonderful Wall Worm Modeling Tools, and I'll try to explain the process that was used to set up the scene in Max and export into Source. This will assume you have a basic understanding of the Wall Worm Modeling Tools and the most up-to-date version.

3DS Max Workflow

  1. Set up your model as a Wall Worm ready model. Open up the tools and pick the model that will have multiple materials. Go ahead and get it ready as if you were going to export it regularly (set paths, surface propery, collision, etc.) For my model, I used a multi-material that had the body texture as ID 1 and screen texture as ID 2.
  2. Now to create a proxy using WWMT. This will create a duplicate model that will be used for assigning another material to. Go to Wall Worm > Wall Worm Anvil. Once the new window opens, select the Models tab at the top. Select the WWMT helper text for your model and press the Create Proxies from WWMT button.
  3. This should create a proxy model that looks just like your original. Feel free to drag the proxy near your main model for convenience. Open up the Material Editor, select a blank material, and use the eyedropper tool to choose your main model. You should now have two materials that are identical. Change the name of the multi-materials so they are different. I named mine State_1 and State_2.
  4. Assign the new State_2 material to the proxy model. Change the texture in the material to the one that you want the model to swap to. The scene should look similar to this, with two identical models having different materials: 

     5.  You can repeat these steps to create as many proxies with alternate materials as possible. Each proxy
          will represent a new texture that the model can swap to.
     6.  Once all your proxies are set up, select your WWMT helper text, and press the Collect Skins from 
          Proxies button.
     7.  Select a blank material and use the eyedropper tool to select the WWMT helper text. You should 
          now see a material that has combined all the other materials into one.
     8.  Now export your model as usual using the WWMT. Check the QC file to make sure that the
          materials are written correctly. They should look similar to this:


Hopefully that proves helpful to anyone needing to create any objects with screens. I will end up using this same technique to the jukebox that will be needed in the near future. Feel free to post comments or questions!