ChilliSkinner v1.0

See www.chilliweb.co.uk/chilliskinner for more details

Description
A small utility floater written in MAXScript for 3Dstudio 3.x that assists in the process of ‘skinning’ 3D models. 

Background
Having recently had occasion to work on some Unreal Tournament in-game models over at www.unrealfortress.com it became apparent to me that from a modeller’s perspective there are three stages involved in making a game model; 1) the actual modeling of the object in 3dStudio for example, 2) the preparation of the object so that it can use a bitmap ‘skin’ and finally 3) the actual painting of the bitmap.  Now stage 1 is great, lots of fun because you get to ‘shape’ the object in your imagination into something a little more tangible.  Stage 3 is also fun because now your object has shape and form you want it to look even better by creating a pretty skin to wrap around it.   That leaves us with stage 2…  the preparation of the model.   Hmmm…  could be I’ve missed something somewhere, but it seems to me that this stage is really laborious, non-creative, boring....  Typically if I take an hour to complete a model and an hour to do the bitmap for the model, then the bit in-between takes me at least two hours and is often trial and error because it’s easy to make a mistake and even then the end result isn’t perfect.  Finding this unacceptable I set about designing and writing this little piece of MAXScript to allow me (and hopefully others) to do this a lot, lot quicker.

What does ChilliSkinner do?
ChilliSkinner attempts to automatically go through the steps involved in preparing a 3D model for skinning.  It breaks the object down into polys that can be flat planar mapped.  It aligns them all into a single plane so they are all facing the same way.  It arranges all these pieces so that they don’t overlap and forms them into the shape of a square...  giving you a nice neat group of flat objects to apply your planar map too.  Not only all this but it also has quick step buttons that perform all the in-between steps for you too i.e. cloning and hiding the model, attaching pieces, applying the planar map, compound morphing the object back together and welding vertices.

Pros and Cons?
Well...  It can let you get a model ready for skinning very quickly, typically in less than ten minutes.  It lets you skin complex models that would be difficult to skin conventionally.  For example, try skinning the 'Torus Knot' object in MAX.  Also, every poly receives accurate and identical (unless you decide to scale polys up or down after the Align stage) UVW mapping coords. i.e. a bitmap pasted on any face of the 'ChilliSkinned' object will always show up the same size.. you won't get any pixel distortion that you often get with other skinning methods because 2D UVW mapping was applied to a 3D object.   With a little practice,  tweaking the settings a bit and the odd bit of manual assistance...  I reckon it works really well.

On the minus side....  The resultant bitmap is not as efficiently laid out as it would be if you'd done everything by hand (though you can intervene and just do this bit manually without relying on ChilliSkinner's Arange Polys function.  The problem that most people will spot is that the resultant bitmap can be confusing as to what bit goes where...  and so difficult to paint well..  to counter this I say...  I use a 3D paint package, Deep Paint 3D (or you could use Painter 3D)...  these packages allow you to paint directly on to your 3D model.  As you paint the model in 3D, it updates the bitmap. You don't really ever need to see the bitmap.  Not only that but DP3D allows you to send the skin to and from Photoshop and MAX dynamically as you work.  This really works well, and is IMHO the 'only way' to skin.  If you use a 3D paint package then you'll love ChilliSkinner (I hope) because it lets you get from the modelling stage to the skinning stage in minutes!

Disclaimer and License Stuff
This is only Version 1.0 and it's the only thing I've ever written in MAXScript sooo....  be forgiving please...  there's not much error trapping being done in there but everything works if you provide it with that which it requires.   I thought about making it in to a Plug-In and hiding the source code...  but decided against it..  so this release at least is Open Source covered by the General Public Licence.  All I ask is that you email me and tell me what you think about ChilliSkinner....   if you love/hate it...  what you think could be done better... etc.

Credits
Very special thanks go to Nathan 'Azm0' Fletcher for his excellent coding advice and fast typing (I will learn those keyboard short-cuts honest m8!) and James 'Pete The Cheat' Chapman for helping me resurrect Pythagoras, Trigonometry and  Vector Mathematics from the murk in my brain...

Also I'd like to thank casManG (http://www.cschell.com) for his superb model skinning tutorial...  this is the method on which ChilliSkinner was based...  I read a lot of these tutorials, from different sources, all basically the same....  yours is the best I've seen though. 

Chilli
29th May 2000

 

How To Use

Getting started….  unzip ChilliSkinner.zip to your 3DSMAX/Scripts folder.  Run MAX and from the Utilities panel, click the MAXScript button and run the ChilliSkinner.ms script.

In order for everything to work properly you should only have one object, the object you want to skin in the workspace of 3Dstudio.  The (source) object should be visible and there shouldn’t be any hidden objects in the scene.  Select source object and proceed to go through the buttons on the floater according to the explanation of each given below. 

 

1. Poly Finder/Detacher
Splits selected object into 'flat' polys that can be accurately planar mapped.  Changing Tolerance value affects poly size and number, use higher values (e.g. 0.8) for larger polys..
Important:  Requires an object to be selected.  Polys are identified based on face normal and adjacent vertex information.  When done it deletes the original (now empty) source object.  Depending on how many polys in your object, this could process can take some time, so please be patient. 

Following step 1, if you are not happy with the results, either try a different Tolerance setting or, if it's close to what you want, you can manually 'attach' and 'weld vertices'  or 'detach' polys

2. Clone & Hide
This is a time saver step that simply makes a clone of source object’s detached pieces called the target object, and hides them.  Now is a good time to save a copy of the scene

3. Align Polys #Z
Takes all the detached polys and aligns them so as they are all facing the same way.  If you have your MAX viewports set to the default then they should appear facing you in the ‘Top’ viewport.
Important:  If two vertices are in exactly the same location on the poly to be aligned, the align routine will not be able to align that poly.   It will leave it in it's original position and show you an error message.  See the MAX listener for exact details of offending Objects/Vertex numbers.  These problems with the object will need to be fixed by 'welding or deleting before you continue.

4a. Optimise Polys
This is an optional step that rotates each detached poly so that it's bounding box takes up the least amount of space.

4b. Autocalc Scaling
Works out a 'best guess' scaling value for the detached polys.  Tells 'Arrange Polys' what size square to try to fit all the pieces in.

4c. Arrange Polys
Takes all the polys and attempts to arrange them without overlaps in the shape of a square the size of which is determined by the Scaling spinner.  If this fails to work i.e. the status bar remains on red and not all of the pieces appear arranged then you should manually increase the scaling value and try again until you achieve success.  Conversely if it succeeds first time you might want to decrease Scaling to attempt to find a more optimal setting. 

At this point you are free to move any of the pieces around in the X and Y planes.  You can rotate them, scale them, you might want to align pieces that you know are next to each other on the model etc..  What you must not do though is overlap any face areas or change the number of faces/vertices by any method such as welding, deleting etc.  OK you’re on your way…  the rest of the steps are quick and easy.

5. Attach Src Objs
This simply ‘attaches’ all of the pieces together making them a single object.

6. Apply Planar Map
This does what it says…  applies a planar map to the flat source object.
Important:  If you have used the 'Optimise Polys' function you might find that at this point the 'bounding box' of the object is not tightly fitting around the object edges.  If this is the case, then you must manually apply the planar mapping by making the Top viewport the active viewport, using the 'UVW Mapping' modifier in MAX, at the bottom of the rollout, choose 'Align to Viewport', then use 'Region Select' and draw a square around your object in the Top viewport.

7. Toggle Objs
This hides the flat source object and un-hides the target object pieces that we created and hid earlier on.

8. Attach Tgt Objs
This does the same as step 5, but does it to the detached pieces of the target object.

9. Morph Src Tgt
This uses MAX’s Compound Object Morph to morph the flat source object to the shape of the target object.  It then deletes the target object.

10. Weld Vertices
Ok now we have what looks like our original object.  However, all those polys are not really joined together, they are simply very closely aligned.  This last step ‘weld’ all close vertices to leave us with our original model again.  The difference is that every face of the model now has precise UVW mapping coordinates.

 

That’s that last step using ChilliSkinner, to progress from here you’ll want to use one of the UV unwrapping plug-ins for MAX (I use the excellent Texporter) this will create the bitmap that when added to a material in MAX and placed on the object will exactly line up with the object faces.  You can then use a paint program of your choice to work on that bitmap and create the skin for you model.  Note. As I mention in the More Info section, to get the most benefit from this utility you should probably use a 3D paint program such as Painter 3D or Deep Paint 3D these partly eliminate the need to ever see the bitmap as they allow you to paint directly on to a model, as long as it has mapping coords.