- update help with now working multi-media and optimization pages - ad blender import help to manual git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9420 75d07b2b-3a1a-0410-a2c5-0572b91ccdca3.0
parent
5af42b37ce
commit
e2473c771c
@ -0,0 +1,91 @@ |
||||
|
||||
<h1><a>Creating jME3 models in Blender3D</a></h1> |
||||
<div> |
||||
|
||||
<p> |
||||
This section discusses how to create and import models from Blender3D (2.62+, see bottom of page for Blender 2.49 and before) to jME3. |
||||
</p> |
||||
|
||||
</div> |
||||
|
||||
<h2><a>Asset Management</a></h2> |
||||
<div> |
||||
|
||||
<p> |
||||
For the managing of assets in general, be sure to read the <a href="/com/jme3/gde/core/docs/jme3/intermediate/multi-media_asset_pipeline.html">Asset Pipeline Documentation</a>. It contains vital information on how to manage your asset files. |
||||
</p> |
||||
|
||||
</div> |
||||
|
||||
<h2><a>Creation Process</a></h2> |
||||
<div> |
||||
|
||||
<p> |
||||
To export an animated model in Blender make sure the following conditions are met: |
||||
|
||||
</p> |
||||
<ol> |
||||
<li><div> Apply Location, Rotation and Scate to the mesh on Blender: On 3D View editor on Blender, select the mesh in Object Mode and go to the 3D View Editor’s header → Object Menu → Apply → Location / Rotation / Location.</div> |
||||
</li> |
||||
<li><div> Apply Location, Rotation and Scate to the armature on Blender: On 3D View editor on Blender, select the armature in Object Mode and go to the 3D View Editor’s header → Object Menu → Apply → Location / Rotation / Location.</div> |
||||
</li> |
||||
<li><div> Set the mesh’s origin point in the bottom of the mesh (see the images bellow).</div> |
||||
</li> |
||||
<li><div> Set the armature’s origin point in the bottom of the armature (see the images bellow).</div> |
||||
</li> |
||||
<li><div> Armature’s origin point and mesh’s origin point must be in the same location(see the images bellow).</div> |
||||
</li> |
||||
<li><div> Use a root bone located in the armature’s origin. This root bone must be in vertical position (see the images bellow) and it is the root bone of the armature. If you rotate the root bone, the the entire armature might be rotate when you import the model into jMonkey (I’m just mentioning the result, I don’t know where is the problem (jmonkey importer or blender’s ogre exporter plugin)).</div> |
||||
</li> |
||||
<li><div> Uncheck “Bone Envelopes” checkbox on the Armature modifier for the mesh (see the images bellow).</div> |
||||
</li> |
||||
<li><div> Uncheck “Envelopes” checkbox on the armature (see the images bellow).</div> |
||||
</li> |
||||
<li><div> Use SkeletonDebugger to show the skeleton on your game in order to check if the mesh and the skeleton are loaded correctly:</div> |
||||
</li> |
||||
</ol> |
||||
<pre> final Material soldier2Mat = assetManager.loadMaterial("Materials/soldier2/soldier2.j3m"); |
||||
final Spatial soldier2 = assetManager.loadModel("Models/soldier2/soldier2.j3o"); |
||||
TangentBinormalGenerator.generate(soldier2); |
||||
soldier2.setMaterial(soldier2Mat); |
||||
|
||||
final Node soldier2Node = new Node("Soldier2 Node"); |
||||
|
||||
soldier2Node.attachChild(soldier2); |
||||
rootNode.attachChild(soldier2Node); |
||||
|
||||
final AnimControl control = soldier2.getControl(AnimControl.class); |
||||
control.addListener(this); |
||||
final AnimChanel channel = control.createChannel(); |
||||
|
||||
final SkeletonDebugger skeletonDebug = new SkeletonDebugger("skeleton", control.getSkeleton()); |
||||
final Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); |
||||
mat.setColor("Color", ColorRGBA.Green); |
||||
mat.getAdditionalRenderState().setDepthTest(false); |
||||
skeletonDebug.setMaterial(mat); |
||||
soldier2Node.attachChild(skeletonDebug);</pre> |
||||
|
||||
<p> |
||||
|
||||
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/external/blender_rootbone.png"> |
||||
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/external/blender_apply_mesh.png"> |
||||
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/external/blender_apply_bones.png"> |
||||
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/external/blender_envelopes.png"> |
||||
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/external/blender_finished.png"> |
||||
</p> |
||||
|
||||
<p> |
||||
Also check out these videos and resources: |
||||
|
||||
</p> |
||||
<ul> |
||||
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/import-assets/forum/topic/blender-2-61-animation-issues/?topic_page=2&num=15"><param name="text" value="<html><u>Forum: How to import animated models from Blender 2.6 correctly</u></html>"><param name="textColor" value="blue"></object> (<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="https://www.youtube.com/watch?v=QiLCs4AKh28"><param name="text" value="<html><u>Video</u></html>"><param name="textColor" value="blue"></object>)</div> |
||||
</li> |
||||
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.youtube.com/watch?v=NdjC9sCRV0s"><param name="text" value="<html><u>Video tutorial for animated models from Blender 2.6</u></html>"><param name="textColor" value="blue"></object></div> |
||||
</li> |
||||
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="https://docs.google.com/fileview?id=0B9hhZie2D-fENDBlZDU5MzgtNzlkYi00YmQzLTliNTQtNzZhYTJhYjEzNWNk&hl=en"><param name="text" value="<html><u>Exporting OgreXML scenes from Blender 2.49 to jME</u></html>"><param name="textColor" value="blue"></object></div> |
||||
</li> |
||||
</ul> |
||||
|
||||
</div> |
||||
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:external:blender?do=export_xhtmlbody">view online version</a></em></p> |
After Width: | Height: | Size: 147 KiB |
After Width: | Height: | Size: 151 KiB |
After Width: | Height: | Size: 153 KiB |
After Width: | Height: | Size: 346 KiB |
After Width: | Height: | Size: 285 KiB |
@ -0,0 +1,235 @@ |
||||
|
||||
<h1><a>Multi-Media Asset Pipeline</a></h1> |
||||
<div> |
||||
|
||||
<p> |
||||
|
||||
Assets are files that are not code. Your multi-media assets includes, for example, your textures (image files), models (mesh files), and sounds (audio files). |
||||
|
||||
</p> |
||||
<ul> |
||||
<li><div> You create textures in a graphic editor, for example Gimp, and export them as <acronym title="Portable Network Graphics">PNG</acronym> or <acronym title="Joint Photographics Experts Group">JPG</acronym>.</div> |
||||
</li> |
||||
<li><div> You create models in a 3D mesh editor, for example <a href="/com/jme3/gde/core/docs/jme3/external/blender.html">Blender</a>, and export it in Ogre Mesh <acronym title="Extensible Markup Language">XML</acronym> or Wavefront OBJ format. </div> |
||||
</li> |
||||
<li><div> You create sounds in an audio editor, for example Audacity, and export them as WAVE or OGG.</div> |
||||
</li> |
||||
</ul> |
||||
<div><table> |
||||
<tr> |
||||
<th>DO</th><th>DON'T</th> |
||||
</tr> |
||||
<tr> |
||||
<td> Save original models plus textures into <code>assets/Textures</code>. </td><td> Don't leave textures or models in a folder outside your JME project: The game cannot load or reference them from there. </td> |
||||
</tr> |
||||
<tr> |
||||
<td> Save sounds into <code>assets/Sounds</code>. </td><td> Don't leave audio files in a folder outside your JME project: The game cannot load or reference them from there. </td> |
||||
</tr> |
||||
<tr> |
||||
<td> Create simple, low-polygon models. </td><td> Don't create high-polygon models, they render too slow to be useful in games. </td> |
||||
</tr> |
||||
<tr> |
||||
<td> Only use Diffuse Map, Normal Map, Glow Map, Specular Map in your models. </td><td> Don't use unsupported material properties that are not listed in the <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a>.</td> |
||||
</tr> |
||||
<tr> |
||||
<td> Use UV texture / texture atlases / baking for each texture map. </td><td> Don't create models based on multiple separate textures, it will break the model into separate meshes.</td> |
||||
</tr> |
||||
<tr> |
||||
<td> Convert original models to .j3o format. Move .j3o files into <code>assets/Models</code>. </td><td>Don't reference original Blender/Ogre/OBJ files in your load() code, because these unoptimized files are not packaged into the final JAR.</td> |
||||
</tr> |
||||
</table></div> |
||||
<!-- EDIT1 TABLE [542-1593] --> |
||||
<p> |
||||
|
||||
Read on for details. |
||||
</p> |
||||
|
||||
</div> |
||||
|
||||
<h3><a>Use The Assets Folder</a></h3> |
||||
<div> |
||||
|
||||
<p> |
||||
|
||||
Store your assets in subfolders of your project's <code>assets</code> directory. The <code>assets</code> directory is the default path where a JME game's <a href="/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html">Asset Manager</a> looks for files to load. |
||||
</p> |
||||
<pre>jMonkeyProjects/MyGame/assets/Interface/ # .font, .jpg, .png, .xml |
||||
jMonkeyProjects/MyGame/assets/MatDefs/ # .j3md |
||||
jMonkeyProjects/MyGame/assets/Materials/ # .j3m |
||||
jMonkeyProjects/MyGame/assets/Models/ # .j3o |
||||
jMonkeyProjects/MyGame/assets/Scenes/ # .j3o |
||||
jMonkeyProjects/MyGame/assets/Shaders/ # .j3f, .vert, .frag |
||||
jMonkeyProjects/MyGame/assets/Sounds/ # .ogg, .wav |
||||
jMonkeyProjects/MyGame/assets/Textures/ # .jpg, .png; also .mesh.xml+.material, .mtl+.obj, </pre> |
||||
|
||||
<p> |
||||
Prepare the <code>asset</code> folder structure for your individual project: |
||||
|
||||
</p> |
||||
<ol> |
||||
<li><div> Agree on a directory structure with the graphic designers. </div> |
||||
</li> |
||||
<li><div> Create subfolders of <code>assets</code> in any way that suits your project (see example above). Stick with one system.</div> |
||||
<ul> |
||||
<li><div> If different assets belong together, create a parallel subdirectory structure for them. <br/> |
||||
Example: For car models, create <code>Textures/vehicles/car1/</code>, <code>Materials/vehicles/car1/</code>, <code>Models/vehicles/car1/</code>, , <code>Sounds/vehicles/car1/</code> (etc) directories now.</div> |
||||
</li> |
||||
</ul> |
||||
</li> |
||||
<li><div> Agree on a file naming and numbering scheme with the graphic designers. </div> |
||||
<ul> |
||||
<li><div> Are some assets used interchangeably? Systematic naming and numbering lets developers easily swap out assets by swapping out parts of the path String. </div> |
||||
</li> |
||||
<li><div> Decide on naming standards for naming interactive parts (arms/legs) of animated models.</div> |
||||
</li> |
||||
</ul> |
||||
</li> |
||||
</ol> |
||||
|
||||
<p> |
||||
|
||||
<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.youtube.com/all_comments?v=HFR4socSv_E"><param name="text" value="<html><u>Video: Horrible things happen if you mess up labeling your assets. Seriously. ;-)</u></html>"><param name="textColor" value="blue"></object> |
||||
</p> |
||||
|
||||
<p> |
||||
See also: |
||||
</p> |
||||
<ul> |
||||
<li><div> More details on <a href="/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html">Asset Manager</a>, including tips how to work with assets when using other IDEs.</div> |
||||
</li> |
||||
<li><div> Use <a href="/com/jme3/gde/core/docs/sdk/asset_packs.html">Asset Packs</a> to bundle, share, and manage assets!</div> |
||||
</li> |
||||
</ul> |
||||
|
||||
</div> |
||||
|
||||
<h3><a>Create Textures and Materials</a></h3> |
||||
<div> |
||||
|
||||
<p> |
||||
|
||||
Install a graphic editor such as Gimp or Photoshop. <strong>Consult the graphic editor's documentation for specific details how to do the following tasks.</strong> |
||||
|
||||
</p> |
||||
<ol> |
||||
<li><div> Create textures in a graphic editor.</div> |
||||
<ul> |
||||
<li><div> Save all textures to your prepared subfolders in the <code>assets/Textures</code> directory. </div> |
||||
</li> |
||||
</ul> |
||||
</li> |
||||
<li><div> (Optional) If you plan to use JME materials that you set programmatically from the code, create .j3m materials in the <acronym title="Software Development Kit">SDK</acronym>.</div> |
||||
<ul> |
||||
<li><div> Save these .j3m files into the <code>assets/Materials</code> directory.</div> |
||||
</li> |
||||
</ul> |
||||
</li> |
||||
</ol> |
||||
|
||||
<p> |
||||
|
||||
<p><div>Storing the textures inside your project directory is necessary for the paths in JME's binary model files (.j3o) to work. Treat the paths of your assets like class names of java classes, they define a specific asset. When you later generate .j3o files, compile class files, and distribute the project, paths and files need to be available in their final absolute form. It is imperative to keep the same directory structure from beginning to end. If you ever change the assets directory structure, you have to re-export all affected models, regenerate all affected .j3o files, and manually update all affected paths in your code. |
||||
</div></p> |
||||
</p> |
||||
|
||||
</div> |
||||
|
||||
<h3><a>Create 3D Models</a></h3> |
||||
<div> |
||||
|
||||
<p> |
||||
|
||||
Install a mesh editor such as <a href="/com/jme3/gde/core/docs/jme3/external/blender.html">Blender</a> or 3D Studio MAX. Reuse textures and materials as much as possible. <strong>Consult the mesh editor's documentation for specific details how to do the following tasks.</strong> |
||||
|
||||
</p> |
||||
<ol> |
||||
<li><div> Create 3D models in a mesh editor. </div> |
||||
<ol> |
||||
<li><div> Create simple <strong>low-polygon models</strong>. High-polygon models slow down the game.</div> |
||||
</li> |
||||
<li><div> Unwrap the model and generate a <strong>UV texture</strong> (i.e. one texture file that contains all the pieces of one model from different angles). <br/> |
||||
Don't use multiple separate texture files with one model, it will break the model into several meshes.</div> |
||||
</li> |
||||
<li><div> Create textures for the model: Only use <strong>Diffuse Map (minimum), Normal Map, Glow Map, and Specular Map.</strong> <br/> |
||||
Everything not listed in the <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a> is ignored by JME.</div> |
||||
</li> |
||||
</ol> |
||||
</li> |
||||
<li><div> Export the model mesh in one of the following formats: <strong>.blend, Wavefront .OBJ/.MTL, Ogre .mesh/.material/.scene</strong>.</div> |
||||
<ol> |
||||
<li><div> <strong>Bake</strong> each texture into one file when exporting. (Create a Texture Atlas.)</div> |
||||
</li> |
||||
<li><div> <strong>Save exported models to subfolders of the <code>assets/Textures</code> directory, together with their Textures.</strong> (for now)</div> |
||||
</li> |
||||
</ol> |
||||
</li> |
||||
</ol> |
||||
|
||||
<p> |
||||
|
||||
See also: <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.gamasutra.com/view/feature/2530/practical_texture_atlases.php"><param name="text" value="<html><u>Texture Atlases on gamasutra</u></html>"><param name="textColor" value="blue"></object> |
||||
</p> |
||||
|
||||
<p> |
||||
<p><div><strong>When I load the model in JME, why does it look different than in the 3D editor?</strong> <br/> |
||||
3D models will never look identical in a game engine and in a mesh editor. Mesh editors are optimized for high-quality offline rendering, and many of the material and texture options simply do not work in a live rendering context. Also, the shaders that render the materials in JME are different than in your mesh editor's renderer. Remind your graphic designers to only focus on features that game engines support. |
||||
</div></p> |
||||
</p> |
||||
|
||||
</div> |
||||
|
||||
<h3><a>Convert 3D Models to .j3o Format</a></h3> |
||||
<div> |
||||
|
||||
<p> |
||||
|
||||
Convert all models and scenes to jME3's binary .j3o format to load() them. You use the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> to do the conversion. |
||||
|
||||
</p> |
||||
<ol> |
||||
<li><div> Confirm that you exported the model into the <code>assets/Textures</code> directory (or subdirectories) together with all its textures.</div> |
||||
</li> |
||||
<li><div> In the <acronym title="Software Development Kit">SDK</acronym>, right-click the model and choose "Convert to j3o Binary". <br/> |
||||
The paths in the j3o now reference files with an absolute <code>assets/Textures/…</code> path.</div> |
||||
</li> |
||||
<li><div> Now, move the .j3o into the corresponding <code>assets/Models/</code> or <code>assets/Scenes/</code> directory. </div> |
||||
</li> |
||||
<li><div> Use the AssetManager to load() the .j3o files.</div> |
||||
</li> |
||||
</ol> |
||||
|
||||
<p> |
||||
|
||||
This process ensures that the texture paths are correct, and it also keeps your <code>assets/Models</code> folder free from textures. You can reuse your set of textures for many models. |
||||
</p> |
||||
|
||||
<p> |
||||
<strong>Must I convert to .j3o? – Yes!</strong> |
||||
</p> |
||||
<ul> |
||||
<li><div> .j3o is an optimized format to store parts of a jME3 scene graph. A .j3o file can contain one shape, one model, or a whole scene.</div> |
||||
</li> |
||||
<li><div> Only .j3o files can store all of jme3's material and other options, other formats can only be considered meshes with UV mapping data and always need to be worked on.</div> |
||||
</li> |
||||
<li><div> .j3o files work seamlessly across platforms and can also be automatically adapted for certain platforms on distribution.</div> |
||||
</li> |
||||
<li><div> (Optional) You can store the model's physical properties, materials, lights, particle emitters, and audio nodes, in the .j3o file. <br/> |
||||
Use the jMonkeyEngine SceneComposer to add these properties.</div> |
||||
</li> |
||||
<li><div> The default Ant build script copies .j3o / .j3m files, sounds, and textures, into the distributable JAR automatically.</div> |
||||
</li> |
||||
</ul> |
||||
|
||||
<p> |
||||
|
||||
<p><div>Important: Unoptimized external model files (.mesh.xml, .material, .obj, .mat, etc) are not bundled when you build your application! If you try to run the JAR with code referring to non-j3o models, you get a <strong>Runtime Error</strong> because the resource is not found. The final application code should only reference .j3o files. |
||||
</div></p> |
||||
</p> |
||||
|
||||
<p> |
||||
See also: <a href="/com/jme3/gde/core/docs/sdk/model_loader_and_viewer.html">Model Loader and Viewer</a> |
||||
|
||||
</p> |
||||
|
||||
</div> |
||||
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:intermediate:multi-media_asset_pipeline?do=export_xhtmlbody">view online version</a></em></p> |
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue