Game Development Reference
In-Depth Information
The Python converters were written for Python 2.x
and may not work in 3.x.
The most common problems that arise when importing models are due to not
exporting all the required properties. In your modeling program's export dialog,
if given a choice, make sure to check the boxes for these properties:
• Vertices
• Faces
• Normals
• Skinning / Materials / Texture Maps / Texture Coordinates / UVs / Colors
• Flip YZ
• Morph animation (if applicable)
• All meshes (if applicable)
Your modeling software may not have all these options, and you may need to check
other boxes as well.
To be on the safe side, you may also want to make sure the model you're
exporting is a top-level object rather than grouped with other things, that the
model is not translated or rotated, that the scaling is set to 1 , and that you've
deleted the model's history.
Exporting from Three.js
Three.js provides several exporters in the examples/js/exporters folder that allow
saving scenes or objects in various formats, including OBJ, STL, and JSON. Like
with loaders, more or less any Three.js entity can be exported, but the most common
approach is to export a complete mesh or scene. The SceneExporter tool is the most
common tool here, and using it is fairly straightforward:
var exporter = new THREE.SceneExporter();
var output = JSON.stringify(exporter.parse(scene), null, "\t");
Then output value can be saved into a JSON file that SceneLoader can read later.
The one major issue to watch out for is that custom properties won't get exported.
That includes nonstandard properties added to object instances, properties provided
by subclasses of Three.js classes, custom classes that don't inherit from Three.js
classes, and anything that isn't part of the scene . If you need any of these things to
be exported, you may be better off writing a custom exporter and importer, possibly
starting with one of the ones Three.js provides.
 
Search WWH ::




Custom Search