OSDN Git Service

db43825c0415792d1f1ad07805674af2076b8c56
[mikumikustudio/MikuMikuStudio.git] / sdk / jme3-documentation / src / com / jme3 / gde / docs / jme3 / beginner / hello_asset.html
1
2 <h1><a>jMonkeyEngine 3 Tutorial (3) - Hello Assets</a></h1>
3 <div>
4
5 <p>
6
7 Previous: <a href="/com/jme3/gde/docs/jme3/beginner/hello_node.html">Hello Node</a>,
8 Next: <a href="/com/jme3/gde/docs/jme3/beginner/hello_main_event_loop.html">Hello Update Loop</a>
9 </p>
10
11 <p>
12 In this tutorial we will learn to load 3D models and text into the scene graph, using the jME <a href="/com/jme3/gde/docs/jme3/advanced/asset_manager.html">Asset Manager</a>. You will also learn how to determine the correct paths, and which file formats to use.
13 </p>
14
15 <p>
16 <img src="nbdocs:/com/jme3/gde/docs/jme3/beginner/beginner-assets-models.png">
17 </p>
18
19 <p>
20 <p><div><a href="/com/jme3/gde/docs/sdk/sample_code.html">Trouble finding the files to run this sample?</a> To get the assets (3D models) used in this example, add the included <code>jme3-test-data.jar</code> to your classpath. In project created with the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> (recommended), simply right-click your project, choose &quot;Properties&quot;, go to &quot;Libraries&quot;, press &quot;Add Library&quot; and add the preconfigured &quot;jme3-test-data&quot; library. 
21 </div></p>
22 </p>
23
24 </div>
25 <!-- EDIT1 SECTION "jMonkeyEngine 3 Tutorial (3) - Hello Assets" [1-838] -->
26 <h2><a>Code Sample</a></h2>
27 <div>
28 <pre>package jme3test.helloworld;
29 &nbsp;
30 import com.jme3.app.SimpleApplication;
31 import com.jme3.font.BitmapText;
32 import com.jme3.light.DirectionalLight;
33 import com.jme3.material.Material;
34 import com.jme3.math.Vector3f;
35 import com.jme3.scene.Geometry;
36 import com.jme3.scene.Spatial;
37 import com.jme3.scene.shape.Box;
38 &nbsp;
39 <span>/** Sample 3 - how to load an OBJ model, and OgreXML model, 
40  * a material/texture, or text. */</span>
41 public class HelloAssets extends SimpleApplication &#123;
42 &nbsp;
43     public static void main&#40;String&#91;&#93; args&#41; &#123;
44         HelloAssets app = new HelloAssets&#40;&#41;;
45         app.start&#40;&#41;;
46     &#125;
47 &nbsp;
48     @Override
49     public void simpleInitApp&#40;&#41; &#123;
50 &nbsp;
51         Spatial teapot = assetManager.loadModel&#40;&quot;Models/Teapot/Teapot.obj&quot;&#41;;
52         Material mat_default = new Material&#40; 
53             assetManager, &quot;Common/MatDefs/Misc/ShowNormals.j3md&quot;&#41;;
54         teapot.setMaterial&#40;mat_default&#41;;
55         rootNode.attachChild&#40;teapot&#41;;
56 &nbsp;
57         // Create a wall with a simple texture from test_data
58         Box box = new Box&#40;Vector3f.ZERO, 2.5f,2.5f,1.0f&#41;;
59         Spatial wall = new Geometry&#40;&quot;Box&quot;, box &#41;;
60         Material mat_brick = new Material&#40; 
61             assetManager, &quot;Common/MatDefs/Misc/Unshaded.j3md&quot;&#41;;
62         mat_brick.setTexture&#40;&quot;ColorMap&quot;, 
63             assetManager.loadTexture&#40;&quot;Textures/Terrain/BrickWall/BrickWall.jpg&quot;&#41;&#41;;
64         wall.setMaterial&#40;mat_brick&#41;;
65         wall.setLocalTranslation&#40;2.0f,-2.5f,0.0f&#41;;
66         rootNode.attachChild&#40;wall&#41;;
67 &nbsp;
68         // Display a line of text with a default font
69         guiNode.detachAllChildren&#40;&#41;;
70         guiFont = assetManager.loadFont&#40;&quot;Interface/Fonts/Default.fnt&quot;&#41;;
71         BitmapText helloText = new BitmapText&#40;guiFont, false&#41;;
72         helloText.setSize&#40;guiFont.getCharSet&#40;&#41;.getRenderedSize&#40;&#41;&#41;;
73         helloText.setText&#40;&quot;Hello World&quot;&#41;;
74         helloText.setLocalTranslation&#40;300, helloText.getLineHeight&#40;&#41;, 0&#41;;
75         guiNode.attachChild&#40;helloText&#41;;
76 &nbsp;
77         // Load a model from test_data (OgreXML + material + texture)
78         Spatial ninja = assetManager.loadModel&#40;&quot;Models/Ninja/Ninja.mesh.xml&quot;&#41;;
79         ninja.scale&#40;0.05f, 0.05f, 0.05f&#41;;
80         ninja.rotate&#40;0.0f, -3.0f, 0.0f&#41;;
81         ninja.setLocalTranslation&#40;0.0f, -5.0f, -2.0f&#41;;
82         rootNode.attachChild&#40;ninja&#41;;
83         // You must add a light to make the model visible
84         DirectionalLight sun = new DirectionalLight&#40;&#41;;
85         sun.setDirection&#40;new Vector3f&#40;-0.1f, -0.7f, -1.0f&#41;&#41;;
86         rootNode.addLight&#40;sun&#41;;
87 &nbsp;
88     &#125;
89 &#125;</pre>
90
91 <p>
92 Build and run the code sample. You should see a green Ninja with a colorful teapot standing behind a wall. The text on the screen should say &quot;Hello World&quot;.
93 </p>
94
95 </div>
96 <!-- EDIT2 SECTION "Code Sample" [839-3449] -->
97 <h2><a>The Asset Manager</a></h2>
98 <div>
99
100 <p>
101
102 <strong>By game assets we mean all multi-media files, such as models, materials, textures, whole scenes, custom shaders, music and sound files, and custom fonts.</strong> JME3 comes with a handy AssetManager object that helps you access your assets. 
103 The AssetManager can load files from:
104 </p>
105 <ul>
106 <li><div> the current classpath (the top level of your project directory), </div>
107 </li>
108 <li><div> the <code>assets</code> directory of your project, and</div>
109 </li>
110 <li><div> optionally, custom paths that you register.</div>
111 </li>
112 </ul>
113
114 <p>
115
116 The following is the recommended directory structure for storing assets in your project directoy: 
117 </p>
118 <pre>MyGame/assets/Interface/
119 MyGame/assets/MatDefs/
120 MyGame/assets/Materials/
121 MyGame/assets/Models/
122 MyGame/assets/Scenes/
123 MyGame/assets/Shaders/
124 MyGame/assets/Sounds/
125 MyGame/assets/Textures/
126 MyGame/build.xml            &lt;-- Ant build script
127 MyGame/src/...              &lt;-- Java sources go here
128 MyGame/...</pre>
129
130 <p>
131 This is just a suggested best practice, and it&#039;s what you get by default when creating a new Java project in the jMokeyEngine <a href="/com/jme3/gde/docs/jme3/beginner/sdk.html">SDK</a>. You can create an <code>assets</code> directory and technically name the subdirectories whatever you like.
132 </p>
133
134 </div>
135 <!-- EDIT3 SECTION "The Asset Manager" [3450-4573] -->
136 <h3><a>Loading Textures</a></h3>
137 <div>
138
139 <p>
140
141 Place your textures in a subdirectory of <code>assets/Textures/</code>. Load the texture into the material before you set the Material. The following code sample is from the <code>simpleInitApp()</code> method and loads a simple wall model:
142 </p>
143 <pre>// Create a wall with a simple texture from test_data
144 Box box = new Box&#40;Vector3f.ZERO, 2.5f,2.5f,1.0f&#41;;
145 Spatial wall = new Geometry&#40;&quot;Box&quot;, box &#41;;
146 Material mat_brick = new Material&#40; 
147     assetManager, &quot;Common/MatDefs/Misc/Unshaded.j3md&quot;&#41;;
148 mat_brick.setTexture&#40;&quot;ColorMap&quot;, 
149     assetManager.loadTexture&#40;&quot;Textures/Terrain/BrickWall/BrickWall.jpg&quot;&#41;&#41;;
150 wall.setMaterial&#40;mat_brick&#41;;
151 wall.setLocalTranslation&#40;2.0f,-2.5f,0.0f&#41;;
152 rootNode.attachChild&#40;wall&#41;;</pre>
153
154 <p>
155 In this case, you <a href="/com/jme3/gde/docs/jme3/beginner/hello_material.html">create your own Material</a> and apply it to a Geometry. You base Materials on default material descriptions (such as &quot;Unshaded.j3md&quot;), as shown in this example. 
156 </p>
157
158 </div>
159 <!-- EDIT4 SECTION "Loading Textures" [4574-5490] -->
160 <h3><a>Loading Text and Fonts</a></h3>
161 <div>
162
163 <p>
164
165 This example displays the text &quot;Hello World&quot; in the default font at the bottom edge of the window. You attach text to the <code>guiNode</code> ??? this is a special node for flat (orthogonal) display elements. You display text to show the game score, player health, etc.
166 The following code sample goes into the <code>simpleInitApp()</code> method.
167 </p>
168 <pre>// Display a line of text with a default font
169 guiNode.detachAllChildren&#40;&#41;;
170 guiFont = assetManager.loadFont&#40;&quot;Interface/Fonts/Default.fnt&quot;&#41;;
171 BitmapText helloText = new BitmapText&#40;guiFont, false&#41;;
172 helloText.setSize&#40;guiFont.getCharSet&#40;&#41;.getRenderedSize&#40;&#41;&#41;;
173 helloText.setText&#40;&quot;Hello World&quot;&#41;;
174 helloText.setLocalTranslation&#40;300, helloText.getLineHeight&#40;&#41;, 0&#41;;
175 guiNode.attachChild&#40;helloText&#41;;</pre>
176
177 <p>
178 <strong>Tip:</strong> Clear existing text in the guiNode by detaching all its children.
179 </p>
180
181 </div>
182 <!-- EDIT5 SECTION "Loading Text and Fonts" [5491-6336] -->
183 <h3><a>Loading a Model</a></h3>
184 <div>
185
186 <p>
187
188 Export your 3D model in OgreXML format (.mesh.xml, .scene, .material, .skeleton.xml) and place it in a subdirectory of <code>assets/Models/</code>. The following code sample goes into the <code>simpleInitApp()</code> method.
189 </p>
190 <pre>// Load a model from test_data (OgreXML + material + texture)
191 Spatial ninja = assetManager.loadModel&#40;&quot;Models/Ninja/Ninja.mesh.xml&quot;&#41;;
192 ninja.scale&#40;0.05f, 0.05f, 0.05f&#41;;
193 ninja.rotate&#40;0.0f, -3.0f, 0.0f&#41;;
194 ninja.setLocalTranslation&#40;0.0f, -5.0f, -2.0f&#41;;
195 rootNode.attachChild&#40;ninja&#41;;
196 // You must add a directional light to make the model visible!
197 DirectionalLight sun = new DirectionalLight&#40;&#41;;
198 sun.setDirection&#40;new Vector3f&#40;-0.1f, -0.7f, -1.0f&#41;.normalizeLocal&#40;&#41;&#41;;
199 rootNode.addLight&#40;sun&#41;;</pre>
200
201 <p>
202 Note that you do not need to create a Material if you exported the model with a material. Remember to add a light source, as shown, otherwise the material (and the whole model) is not visible!
203 </p>
204
205 </div>
206 <!-- EDIT6 SECTION "Loading a Model" [6337-7266] -->
207 <h3><a>Loading Assets From Custom Paths</a></h3>
208 <div>
209
210 <p>
211
212 What if your game relies on user supplied model files, that are not included in the distribution? If a file is not located in the default location (e.g. assets directory), you can register a custom Locator and load it from any path. 
213 </p>
214
215 <p>
216 Here is a usage example of a ZipLocator that is registered to a file <code>town.zip</code> in the top level of your project directory:
217 </p>
218 <pre>    assetManager.registerLocator&#40;&quot;town.zip&quot;, ZipLocator.class&#41;;
219     Spatial scene = assetManager.loadModel&#40;&quot;main.scene&quot;&#41;;
220     rootNode.attachChild&#40;scene&#41;;</pre>
221
222 <p>
223 Here is a HttpZipLocator that can download zipped models and load them:
224 </p>
225 <pre>    assetManager.registerLocator&#40;
226       &quot;http://jmonkeyengine.googlecode.com/files/wildhouse.zip&quot;, 
227       HttpZipLocator.class&#41;;
228     Spatial scene = assetManager.loadModel&#40;&quot;main.scene&quot;&#41;;
229     rootNode.attachChild&#40;scene&#41;;</pre>
230
231 <p>
232 JME3 offers ClasspathLocator, ZipLocator, FileLocator, HttpZipLocator, and UrlLocator (see <code>com.jme3.asset.plugins</code>). 
233 </p>
234
235 </div>
236 <!-- EDIT7 SECTION "Loading Assets From Custom Paths" [7267-8284] -->
237 <h2><a>Creating Models and Scenes</a></h2>
238 <div>
239
240 <p>
241
242 To create 3D models and scenes, you need a 3D Mesh Editor with an OgreXML Exporter plugin. For example, you can <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/UV_Map_Basics"><param name="text" value="<html><u>create fully textured models with Blender</u></html>"><param name="textColor" value="blue"></object>.
243 You use the <a href="/com/jme3/gde/docs/sdk.html">SDK</a> to <a href="/com/jme3/gde/docs/sdk/model_loader_and_viewer.html">load models</a>, <a href="/com/jme3/gde/docs/sdk/blender.html">convert models</a> and <a href="/com/jme3/gde/docs/sdk/scene_composer.html">create scenes</a> from them. 
244 </p>
245
246 <p>
247 If you use Blender, export your models as Ogre <acronym title="Extensible Markup Language">XML</acronym> meshes with materials as follows:
248 </p>
249 <ol>
250 <li><div> Open the menu File &gt; Export &gt; OgreXML Exporter to open the exporter dialog.</div>
251 </li>
252 <li><div> In the Export Materials field: Give the material the same name as the model. For example, the model <code>something.mesh.xml</code> goes with <code>something.material</code>, plus (optionally) <code>something.skeleton.xml</code> and some <acronym title="Joint Photographics Experts Group">JPG</acronym> texture files.</div>
253 </li>
254 <li><div> In the Export Meshes field: Select a subdirectory of your <code>assets/Models/</code> directory. E.g. <code>assets/Models/something/</code>.</div>
255 </li>
256 <li><div> Activate the following exporter settings: </div>
257 <ul>
258 <li><div> Copy Textures: YES</div>
259 </li>
260 <li><div> Rendering Materials: YES</div>
261 </li>
262 <li><div> Flip Axis: YES</div>
263 </li>
264 <li><div> Require Materials: YES</div>
265 </li>
266 <li><div> Skeleton name follows mesh: YES</div>
267 </li>
268 </ul>
269 </li>
270 <li><div> Click export.</div>
271 </li>
272 </ol>
273
274 </div>
275 <!-- EDIT8 SECTION "Creating Models and Scenes" [8285-9444] -->
276 <h3><a>Model File Formats</a></h3>
277 <div>
278
279 <p>
280
281 JME3 can load Ogre <acronym title="Extensible Markup Language">XML</acronym> models + materials, Ogre DotScenes, as well as Wavefront OBJ+MTL models. The loadModel() code works with these files when you run the code directly from the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>. 
282 </p>
283
284 <p>
285 If you build the executables using the default build script, then <strong>the original model files (<acronym title="Extensible Markup Language">XML</acronym>, OBJ, etc) are not included.</strong> When you run the executable, you get an error message if you try to load any models directly: 
286 </p>
287 <pre>com.jme3.asset.DesktopAssetManager loadAsset
288 WARNING: Cannot locate resource: Models/Ninja/Ninja.mesh.xml
289 com.jme3.app.Application handleError
290 SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
291 java.lang.NullPointerException</pre>
292
293 <p>
294 Loading the <acronym title="Extensible Markup Language">XML</acronym>/OBJ files directly is only acceptable during the development phase. If your graphic designer pushes updated files to the asset directory, you can quickly review the latest version in your development environment.
295 </p>
296
297 <p>
298 For testing and for the final release build, you use .j3o files exclusively. J3o is an optimized binary format for jME3 applications, and .j3o files are automatically included in the distributable JAR file by the build script. When you do QA test builds or are ready to release, use the <a href="/com/jme3/gde/docs/sdk.html">SDK</a> to <a href="/com/jme3/gde/docs/sdk/model_loader_and_viewer.html">convert</a> all .obj/.scene/.xml/.blend files to .j3o files, and only load the .j3o versions.
299 </p>
300
301 <p>
302 Open your JME3 Project in the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>.
303 </p>
304 <ol>
305 <li><div> Right-click a .Blend, .OBJ, or .mesh.xml file in the Projects window, and choose &quot;convert to JME3 binary&quot;. </div>
306 </li>
307 <li><div> The .j3o file appears next to the .mesh.xml file and has the same name. </div>
308 </li>
309 <li><div> Change all your loadModel() lines accordingly. For example: <pre>Spatial ninja = assetManager.loadModel&#40;&quot;Models/Ninja/Ninja.j3o&quot;&#41;;</pre>
310 </div>
311 </li>
312 </ol>
313
314 <p>
315
316 If your executable gets a runtime exception, make sure you have converted all models to .j3o!
317 </p>
318
319 </div>
320 <!-- EDIT9 SECTION "Model File Formats" [9445-11297] -->
321 <h3><a>Loading Models and Scenes</a></h3>
322 <div>
323 <div><table>
324         <tr>
325                 <th> Task? </th><th> Solution! </th>
326         </tr>
327         <tr>
328                 <td> Load a model with materials </td><td> Use the asset manager&#039;s <code>loadModel()</code> method and attach the Spatial to the rootNode. <pre>Spatial elephant = assetManager.loadModel&#40;&quot;Models/Elephant/Elephant.mesh.xml&quot;&#41;;
329 rootNode.attachChild&#40;elephant&#41;;</pre>
330 <pre>Spatial elephant = assetManager.loadModel&#40;&quot;Models/Elephant/Elephant.j3o&quot;&#41;;
331 rootNode.attachChild&#40;elephant&#41;;</pre>
332 </td>
333         </tr>
334         <tr>
335                 <td> Load a model without materials </td><td> If you have a model without materials, you have to give it a material to make it visible. <pre>Spatial teapot = assetManager.loadModel&#40;&quot;Models/Teapot/Teapot.j3o&quot;&#41;;
336 Material mat = new Material&#40;assetManager, &quot;Common/MatDefs/Misc/ShowNormals.j3md&quot;&#41;; // default material
337 teapot.setMaterial&#40;mat&#41;;
338 rootNode.attachChild&#40;teapot&#41;;</pre>
339 </td>
340         </tr>
341         <tr>
342                 <td> Load a scene </td><td> You load scenes just like you load models: <pre>Spatial scene = assetManager.loadModel&#40;&quot;Scenes/town/main.scene&quot;&#41;;
343 rootNode.attachChild&#40;scene&#41;;</pre>
344 <pre>Spatial scene = assetManager.loadModel&#40;&quot;Scenes/town/main.j3o&quot;&#41;;
345 rootNode.attachChild&#40;scene&#41;;</pre>
346 </td>
347         </tr>
348 </table></div>
349 <!-- EDIT11 TABLE [11335-12389] -->
350 </div>
351 <!-- EDIT10 SECTION "Loading Models and Scenes" [11298-12390] -->
352 <h2><a>Excercise - How to Load Assets</a></h2>
353 <div>
354
355 <p>
356
357 As an exercise, let&#039;s try different ways of loading a scene. You will learn how to load the scene directly, or from a zip file.
358 </p>
359 <ol>
360 <li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.googlecode.com/svn/trunk/engine/town.zip"><param name="text" value="<html><u>Download the town.zip</u></html>"><param name="textColor" value="blue"></object> sample scene. </div>
361 </li>
362 <li><div> (Optional:) Unzip the town.zip to see the structure of the contained Ogre dotScene: You&#039;ll get a directory named <code>town</code>. It contains <acronym title="Extensible Markup Language">XML</acronym> and texture files, and file called main.scene. (This is just for your information, you do not need to do anything with it.)</div>
363 </li>
364 <li><div> Place the town.zip file in the top level directory of your JME3 project, like so: <pre>jMonkeyProjects/MyGameProject/assets/
365 jMonkeyProjects/MyGameProject/build.xml
366 jMonkeyProjects/MyGameProject/src/
367 jMonkeyProjects/MyGameProject/town.zip
368 ...</pre>
369 </div>
370 </li>
371 </ol>
372
373 <p>
374
375 Use the following method to load models from a zip file:
376
377 </p>
378 <ol>
379 <li><div> Verify <code>town.zip</code> is in the project directory.</div>
380 </li>
381 <li><div> Register a zip file locator to the project directory: Add the following code under <code>simpleInitApp() {</code><pre>    assetManager.registerLocator&#40;&quot;town.zip&quot;, ZipLocator.class&#41;;
382     Spatial gameLevel = assetManager.loadModel&#40;&quot;main.scene&quot;&#41;;
383     gameLevel.setLocalTranslation&#40;0, -5.2f, 0&#41;;
384     gameLevel.setLocalScale&#40;2&#41;;
385     rootNode.attachChild&#40;gameLevel&#41;;</pre>
386
387 <p>
388 The loadModel() method now searches this zip directly for the files to load. <br/>
389 (This means, do not write <code>loadModel(town.zip/main.scene)</code> or similar!)
390 </p>
391 </div>
392 </li>
393 <li><div> Clean, build and run the project. <br/>
394 You should now see the Ninja+wall+teapot standing in a town. </div>
395 </li>
396 </ol>
397
398 <p>
399
400 <strong>Tip:</strong> If you register new locators, make sure you do not get any file name conflicts: Don&#039;t name all scenes <code>main.scene</code> but give each scene a unique name.
401 </p>
402
403 <p>
404 Earlier in this tutorial, you loaded scenes and models from the asset directory. This is the most common way you will be loading scenes and models. Here is the typical procedure:
405
406 </p>
407 <ol>
408 <li><div> Remove the code that you added for the previous exercise.</div>
409 </li>
410 <li><div> Move the unzipped <code>town/</code> directory into the <code>assets/Scenes/</code> directory of your project.</div>
411 </li>
412 <li><div> Add the following code under <code>simpleInitApp() {</code> <pre>    Spatial gameLevel = assetManager.loadModel&#40;&quot;Scenes/town/main.scene&quot;&#41;;
413     gameLevel.setLocalTranslation&#40;0, -5.2f, 0&#41;;
414     gameLevel.setLocalScale&#40;2&#41;;
415     rootNode.attachChild&#40;gameLevel&#41;;</pre>
416
417 <p>
418  Note that the path is relative to the <code>assets/???</code> directory.
419 </p>
420 </div>
421 </li>
422 <li><div> Clean, build and run the project. Again, you should see the Ninja+wall+teapot standing in a town. </div>
423 </li>
424 </ol>
425
426 <p>
427
428 Here is a third method you must know, loading a scene/model from a .j3o file:
429
430 </p>
431 <ol>
432 <li><div> Remove the code from the previous exercise.</div>
433 </li>
434 <li><div> If you haven&#039;t already, open the <a href="/com/jme3/gde/docs/sdk.html">SDK</a> and open the project that contains the HelloAsset class.</div>
435 </li>
436 <li><div> In the projects window, browse to the <code>assets/Scenes/town</code> directory. </div>
437 </li>
438 <li><div> Right-click the <code>main.scene</code> and convert the scene to binary: The jMoneyPlatform generates a main.j3o file.</div>
439 </li>
440 <li><div> Add the following code under <code>simpleInitApp() {</code><pre>    Spatial gameLevel = assetManager.loadModel&#40;&quot;Scenes/town/main.j3o&quot;&#41;;
441     gameLevel.setLocalTranslation&#40;0, -5.2f, 0&#41;;
442     gameLevel.setLocalScale&#40;2&#41;;
443     rootNode.attachChild&#40;gameLevel&#41;;</pre>
444
445 <p>
446  Again, note that the path is relative to the <code>assets/???</code> directory.
447 </p>
448 </div>
449 </li>
450 <li><div> Clean, Build and run the project. <br/>
451 Again, you should see the Ninja+wall+teapot standing in a town. </div>
452 </li>
453 </ol>
454
455 </div>
456 <!-- EDIT12 SECTION "Excercise - How to Load Assets" [12391-15725] -->
457 <h2><a>Conclusion</a></h2>
458 <div>
459
460 <p>
461
462 Now you know how to populate the scenegraph with static shapes and models, and how to build scenes. You have learned how to load assets using the <code>assetManager</code> and you have seen that the paths start relative to your project directory. Another important thing you have learned is to convert models to .j3o format for the executable JARs etc.
463 </p>
464
465 <p>
466 Let&#039;s add some action to the scene and continue with the <a href="/com/jme3/gde/docs/jme3/beginner/hello_main_event_loop.html">Update Loop</a>!
467
468 </p>
469 <hr/>
470
471 <p>
472 <strong>See also:</strong>
473 </p>
474 <ul>
475 <li><div> <a href="/com/jme3/gde/docs/jme3/external/blender.html">The definitive Blender import tutorial</a></div>
476 </li>
477 <li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.jmonkeyengine.com/forum/index.php?topic=14418.0"><param name="text" value="<html><u>Screenshots of a great loaded model</u></html>"><param name="textColor" value="blue"></object></div>
478 </li>
479 <li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.youtube.com/user/aramakara"><param name="text" value="<html><u>Video tutorials for getting OgreXML out of 3DS Max using OgreMax</u></html>"><param name="textColor" value="blue"></object></div>
480 </li>
481 <li><div> If you want to learn how to load sounds, see <a href="/com/jme3/gde/docs/jme3/beginner/hello_audio.html">Hello Audio</a></div>
482 </li>
483 <li><div> If you want to learn more about loading textures and materials, see <a href="/com/jme3/gde/docs/jme3/beginner/hello_material.html">Hello Material</a></div>
484 </li>
485 </ul>
486 <div><span>
487         <a href="/wiki/doku.php/tag:beginner?do=showtag&amp;tag=tag%3Abeginner">beginner</a>,
488         <a href="/wiki/doku.php/tag:intro?do=showtag&amp;tag=tag%3Aintro">intro</a>,
489         <a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
490         <a href="/wiki/doku.php/tag:lightnode?do=showtag&amp;tag=tag%3Alightnode">lightnode</a>,
491         <a href="/wiki/doku.php/tag:material?do=showtag&amp;tag=tag%3Amaterial">material</a>,
492         <a href="/wiki/doku.php/tag:model?do=showtag&amp;tag=tag%3Amodel">model</a>,
493         <a href="/wiki/doku.php/tag:node?do=showtag&amp;tag=tag%3Anode">node</a>,
494         <a href="/wiki/doku.php/tag:gui?do=showtag&amp;tag=tag%3Agui">gui</a>,
495         <a href="/wiki/doku.php/tag:hud?do=showtag&amp;tag=tag%3Ahud">hud</a>,
496         <a href="/wiki/doku.php/tag:texture?do=showtag&amp;tag=tag%3Atexture">texture</a>
497 </span></div>
498
499 </div>
500 <!-- EDIT13 SECTION "Conclusion" [15726-] -->
501 <p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_asset?do=export_xhtmlbody">view online version</a></em></p>