Game Development Community

Maya MAP+MIS export melscript

by Carleton University (#0005) · in Torque Game Engine · 06/12/2007 (4:41 am) · 1 replies

Get it while it's hot, folks. This is the first release, so expect it not to work right away. When it doesn't, tell me how it failed- I need users to break this in and feedback for stability and useability.


www.scs.carleton.ca/~bells/MISexport_1.mel
www.scs.carleton.ca/~bells/MISheader.txt

Below is (some of) the header, give you an idea of the what and the how.

MIS and MAP Exporter

This script is designed to export a scene into a number of .MAP files and to
create an .MIS bringing the DIF files (which you would make from the MAP files)
into their proper locations in the Torque Engine.

For those interested in a dedicated MAP exporter, I'm gonna whip one of those up
in a bit if it looks like there'd be sufficient call, but you should be able to
make do with this in the meantime.

A MAP file is made for each locator, and any geometry parented to that locator
is converted to a brush in that MAP file.

So, here's things are meant to go down. You will have a single scene, which is
your entire mission in one scene. This will probably contain more than one
interior (DIF). Each interior that you want included in your world will have
a locator in your scene. Each peice of geometry that you want to become a brush
in your interior(s) will be parented to the appropriate locator. Good to go.

Generally how you set it up is, you make each interior separately and slap them
all in the worldscene when you're ready to export. Position them precisely with
the locators and export.

The result will be an MIS file and a number of MAP files. Convert the MAPs with
map2dif or something like it. Note that for this to work properly, all textures
should be in the folder with the MAPs.

SETUP REQUIRED:
Paths must currently be set in the script proper.
directly beneath the header text are two variables, MISfilepath
and MAPfilepath. These are the paths to which the exported files
will be saved. The paths must already exist.

MISheader.txt must be placed at the MISfilepath.

DON'T tinker with Maya_to_MAP_Scale or MAP_to_Torque_Scale.
until the next version comes out, this is the only planned
functionality that isn't working properly. Do not touch.


RULES FOR SUCCESSFUL EXPORT:

Don't scale the locators.
there were plans to allow the scaling of locators, but it isn't
working just yet. Keep them at 1 1 1

Geometry must be convex.
concave geometry will export without complaint, but will break on the
way into the engine, or will go in but be the wrong shape

UVs must be planar.
non-planar UVS could result in innacurate UVs, or could result in a
divide-by-zero error that halts the entire export. The error is being
looked into (nope!), but you should still have planar projection UVs.

UV projections must be at 45 degrees or less
projections at sharp angles will mess things up- as you start to get
close to 45 degrees, there will be a noticable drift (a couple of
texels). Above, the drift gets a lot worse, and the stretching changes
direction. This is the kind of issue that should have a good solution,
but I'm not in any hurry to find it. You got an idea? Get in touch, I
want to know it. Otherwise, I got other shit to do.

A kitten dies for every texel rendered 1 by 2 or skinnier. True fact.

Geometry must not have any rotation.
the locator can be rotated, no problem there, but if the geometry
itself has any rotation the brush will break. If you aren't sure,
select all your geometry and go Modify > Freeze Transformations

written by:
Ben Ells - Ben.Ells@gmail.com

with thanks to:
Brian Ewert and Marcel Vijfwinkel
( email? ) ( mvijfwinkel@gmail.com )

for the procedures to get a shape's texture file


scripted under Maya 7.0

Note that this is not the complete header. Read it in the script for full details