Based
on the Mark Callow VRML exporter, which was based on original VRML
exporter that comes with the Max SDK.
Just click the following links and unzip the file into your Max's
“stdplugs” folder, and start up Max
Max Version 5 Max Version 6
Max Version 7: Reports from the field say that
the Version 6 exporter works in most cases in Max 7.
What
it has:
•
Backward-compatible with VRML97 scenes and helpers
• Classic VRML encoding and XML encoding flavors of X3D (VRML97
is NOT there)
• Multi-texture support - specifically: diffuse, self-illumination
(as shadows), and bump (as normals)
• More DEF's, notably on Inlines, ImageTextures, and others
• Some bug fixes, including memory leaks and crashers, that were
in the VRML97 exporter
• Can create a LoadSensor (which currently does nothing, but
IS accessible via SAI)
What
it lacks:
•
NURBS
• New X3D-specific nodes as helpers (such as arbitrary LoadSensors
etc)
• Multitextures when NGons or Quads are output (triangle-based
objects no problem)
On
the list of things to do:
•
NURBS
• 2D Coord interpolators for animated textures (UV's and texture
transforms)
• Multitextures for non-triangle-based objects
• Proto Interface
• Rip out all the old classic VRML97 file output code, override
the XML (DOM) serializer to output the classic VRML encoding. This
will GREATLY reduce, simplify, and cleanup this code.
Known Problems:
•
See above
• Can crash after 3 exports, need to restart Max
• Flux currently does not handle multiple coordinates for multitexture
nodes. But if all your texture maps use the same (or default) mapping,
should work ok.
• If you have problems with X3D (XML) encoding, try X3DV (VRML)
encoding (you may be missing some DLLs)
• If you're having problems witn NGons, try Triangles, and vice/versa
• Not all mapping modes are supported for doing multi-texturing. It
was designed to output one big light-map with different UV's from
the many diffuse maps (as you typically find in large world scenes
(as opposed to small objects or characters), see below for tips.
The Plan:
1.
Get some Alpha testing done by the good folks in the public. It's
a big spec, needs a lot of testing, I need help.
2. Fix as many new problems as possible. Put Beta code in open-source,
publish Beta version and get more testing.
3. Release final code and plugin to open-source
4. Ongoing fixes will include: cleanup of VRML/XML encoding process,
NURBS, etc.
Exporting multitextures:
This
exporter was written with the intent to export different UV's for
different channels. The idea is to allow diffuse textures to remain
unbaked, and bake lights to one bitmap per object. If you want are
having trouble with the method below, you might try baking diffuse
to a single bitmap per object. 'Course, what's the point, you might
as well bake diffuse and light together and put them in the diffuse
channel. Otherwise:
The trick:
1.
Use Max 6. The baking is done via a script, which is much better in
Max 6 than 5 (although it could probably be back-adapted to 5). Since
most multitextures will have a different set of UV's (or texture transforms)
per layer, you need to make everything that uses them Meshes (IFS's).
You may want to add a UV mapping to each such object, try UVWtoXYZ
or Face. You may need to collapse its stack. Or you could uncheck
the 'Primitives' option during Export (unless you have some primitives
you need to preserve).
2. Set up all lights etc exactly how you want them.
3. Select All
4. Save As the scene. This is so you can undo the entire baking process
quickly if you need to.
5. Render/Render To Texture:
a. Choose Map Channel 2 because the exporter only uses channel 1 for
diffuse and 2 for lights (3 for bump)
b. Set the file type to JPG if you can (I could not, this is a problem
in the max script, it defaults
to TGA and teases you that you could maybe change it. There is a workaround
posted on the 'net')
c. Choose 'light map' because we're going to reduce lights etc (if
baking light to diffuse, use 'complete map')
d. Choose 'lightmap' as the map slot
e. Choose 'Output to source' as we want to replace the UVW's and maps
with the newly baked ones
f. Choose a map size of 512 or better. Choosing 'auto size' makes
all the maps 32 pixels wide, I don't know why.
g. Render
6. Export to VRML (the one that ships with Max 6 at this point)
7. Since step 5b is problematic, it probably made a bunch of TGA files,
so batch convert them to JPG with your favorite
utility for doing such.
8. Edit the resulting WRL file, replace all .tga with .jpg (you may
also want to put in a NavigationInfo if needed) and Save
That's
it!
That baking script is editable. Would be nice to get a Max guru to
look at it, or see if Discreet can provide some support,
to fix a few little things, but otherwise, not too bad.