Metropolia Ammattikorkeakoulu



Exporting models with Max – Metropolia / Ulla Sederl?fHere you can find all of the loaders provided in GitHub: are the examples I am using as an reference: guide covers how the models can be exported from MAX. Blender is a bit easier and a lot of online tutorials are provided, hence the need for a MAX tutorial The following formats / model loaders are covered:COLLADA Obj JSON Converting Obj -> JSON with PythonObjectLoader (multiple models)Three.js Online Editor loader / collada / loader / collada / keyframe loader / collada / skinningSupport for animation: YES, morph, skin and keyframeCOLLADA (*.dae) – The Digital Asset Exchange Format example: to export?Autodesk Collada Exporter (native, no install, but not so good) OR OpenCollada Exporter - Recommended1. Get OpenCollada from the exporter link.2. Save the plugin to your “3ds Max 2014/Plugins” folder. Start your max.3. You should now see the exporter whe you go to: Export -> OpenCOLLADA(*.DAE)4. Export:5. Use the loaders and look at the examples: “var loader = new THREE.ColladaLoader(); …”6. Check the examples how to access your animation data. This varies depending are you using morph targets, skinning or keyframing with your models.Problems – Missing textures:- Check and correct path to textures if needed in the COLLADA file- Multi/Sub-Object Materials don’t always work that well.. try something else.- Make sure the objects, materials and textures in the scene do not contain any spaces or weird charactersProblems – Other:- If your model is too small/big, scale it. Check my example of the alien - Hesus.BONED/RIGGED MESH If you want a boned / rigged mesh you need the openCollada exporter. The built in Autodesk Collada Exporter doesn’t work.READ: is my example of a model with skinned animation: 3ds Max Model using Physique ModifierStandard Material Unwrap UVW with one Diffuse map and one BumpmapMesh loaded with the colladaLoaderAnimation accessed with morphtargets / obj loader / obj / mtlAnimation: NO, OBJ is not an animation format OBJ (*.obj) – Loader: examples: to export?3ds max -> Export -> OBJExport:Use the loaders and look at the examples: “var loader = new THREE.OBJMTLLoader();…”If you don’t care about the material, look at the first obj loaderexample. If you want the export also the materials, please check the webgl_loader_obj_mtl example and check that you have also downloaded the OBJMTLLoader.js file. NOTE!!!- After you have exported the materials, first check where the exporter placed the materials. Then YOU MUST edit your file.mtl file paths to the material folder! —> change the path and check the material names!! – look at the XXXXX.mtl fileHere is my example Hesus – no material:Hesus exported to OBJ format – no materials in objLoaded with OBJLoaderTexture added in three is my example Hesus – with material:Hesus exported to OBJ format with materialsLoaded with OBJMTLLoader / json / (max)Animation: NO, but can be done with Blender threeJSExporter JSON (*.json/*.js): JavaScript Object Notation. Comes with the three.js no need to load separately.Exporter:! No animations can be exported with the max version of the exporter :/Loader examples: to export?3ds max -> Run Max Script 1. Download the exporter and save it on your computer2. MaxScript -> Run Script… -> ThreeJSExporter.ms3. Look at the examples: “var loader = new THREE.JSONLoader();Problem1 – Missing textures:Usually the textures are missing when exporting with the threeJSExporterUse the JSON exporter to export your geometry and uv mapping and handle loading textures yourself, by handIn the loader's callback, create your mesh using both the geometry and the material you created. Check out my code as an example.Problem 2 - Smoothing:Smoothing groups are not exported well with the exporter If you check the “use vertex normals” option smoothes the entire meshIf you unceck it, no smoothing is provided at allIf these options are not for you, the you have to: first export to OBJ in max, and then convert the OBJ to a Three.js JSON model using the python converter provided with Three. Check the next topic.Problem 3 – No Animation:No animation is provided with the max exporterTry COLLADAUse BlenderIf this options are not for you, the you have to: first export all of the morph targets to OBJ in max, and then convert the OBJ to a Three.js JSON model using the python converter provided with Three. Check the next topic.Here is my example of a model exported with the threeJSExporter: / json / objconverter Animation: YES, Morph Targets When exporting a mesh from Max to Three.js, the best workflow so far is to first export to OBJ in max, and then convert the OBJ to a Three.js JSON model using the python converter provided with Three.Max > OBJ > ThreeJs OBJ is not an animation format, you have to export each morph target object individually as a .obj file and populate the morph targets with the python converter. Loader:JSONLoader. Comes with the three.js no need to load separately. Loader examples: python interpreter if you are using Windows (Mac OS X has Python installed): run it: path where python.exe is and the optionsHow to export?Export the object as *.obj. If you have animations, export each morph target object individually as a *.obj file - also the unmorphed mesh! Remember to check the material paths!!To populate your morph targets, pass all of the files to the python converter script found in /utils/converters/obj: python convert_obj_three.py -i unmorphedmesh.obj -m 'morphmesh1.obj morphmesh2.obj' -o compiledTargets.jsor with just one object:python convert_obj_three.py -i yourMesh.obj -o yourMesh.js4. Check AGAIN the material paths agaian from the populated yourMesh.js file. Change the paths or move the textures to the correct path for the materials to work is missing.5. Look at the examples how to load the file: “var loader = new THREE.JSONLoader();6. The easiest approach in using morph animation is to use a THREE.MorphAnimMesh class + store the mesh in a morph array and animate.Here is my example Hesus – no animation:Hesus exported to one OBJ file– converted to JSONLoaded with JSONLoaderNo Morphs, just single is my example Hesus – morphing:Hesus exported to three OBJ filesEach of the files contain Hesus is a different pose (mouth open etc)all converted to one JSON fileMorphtargets populated with python and saves as one JSON fileMorphs Animated using the MorhAnimMesh class, BOTH SKINNED ANIMATION AND MORPHS at the same time?????It is currently impossible to have both a boned / rigged mesh and morph targets coming from 3ds max, with Blender it is possibile. Check: / scene loader / scene / blenderWhat about loading a whole scene at once. Can it be done? Yes. SceneLoader takes a JSON file and asynchronously loads the assets in it: three.js online editor to JSON format - ObjectLoaderEditor: Loader examples: sceneLoader = new THREE.ObjectLoader(); sceneLoader.load( './scene.js', function ( s ) { scene = s; init(); animate(); } ); How to use it?Create the model using online editor or import the model there and edit it. Please use ChromeFile – Export Scene (or Geometry or Object)Save the generated file - filename.js – my exampleThe generated file doesn’t store the textures Load with THREE.ObjectLoader() ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download

To fulfill the demand for quickly locating and searching documents.

It is intelligent file search solution for home and business.

Literature Lottery

Related searches