| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width,initial-scale=1">
- <title>jMonkeyEngine SDK: Importing and Viewing Models :: jMonkeyEngine Docs</title>
- <link rel="canonical" href="https://wiki.jmonkeyengine.org/docs/sdk/model_loader_and_viewer.html">
- <meta name="keywords" content="documentation, sdk, tool, asset, scene">
- <meta name="generator" content="Antora 2.3.3">
- <link rel="stylesheet" href="../../_/css/site.css">
- <meta property="og:image" content="https://wiki.jmonkeyengine.org/_/img/iconx128.png">
- <meta property="og:description" content="jMonkeyEngine SDK: Importing and Viewing Models">
- <meta property="og:title" content="jMonkeyEngine Docs">
- <link rel="stylesheet" href="../../_/css/site-extra.css">
- <link rel="stylesheet" href="../../_/css/vendor/docsearch.min.css">
- <!-- fetched from https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css -->
- <link rel="icon" href="../../_/img/favicon.ico" type="image/x-icon">
- </head>
- <body class="article">
- <header class="header">
- <nav class="navbar">
- <div class="navbar-brand">
- <a class="navbar-item" href="https://wiki.jmonkeyengine.org">
- <img alt="" src="../../_/img/jMonkeyDocLogo.png" height="32" type="image/x-icon">
- </a>
- <div class="navbar-item hide-for-print">
- <input type="text" placeholder="Search docs..." id="search-input"/>
- </div>
- <button class="navbar-burger" data-target="topbar-nav">
- <span></span>
- <span></span>
- <span></span>
- </button>
- </div>
- <div id="topbar-nav" class="navbar-menu">
- <div class="navbar-end">
- <div class="navbar-item theme-switch-wrapper">
- <label class="theme-switch" for="checkbox">
- <input type="checkbox" id="checkbox" />
- <div class="slider round"></div>
- </label>
- </div>
- <a class="navbar-item" href="https://github.com/jmonkeyengine/wiki">Github</a>
- </div>
- </div>
- </nav>
- </header>
- <div class="body">
- <div class="nav-container" data-component="docs" data-version="master">
- <aside class="nav">
- <div class="panels">
- <div class="nav-panel-menu is-active" data-panel="menu">
- <nav class="nav-menu">
- <h3 class="title"><a href="../documentation.html">Docs</a></h3>
- <ul class="nav-list">
- <li class="nav-item" data-depth="0">
- <ul class="nav-list">
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="../documentation.html">Getting Started</a>
- </li>
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="https://javadoc.jmonkeyengine.org/v3.3.2-stable">JavaDoc</a>
- </li>
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <a class="nav-link" href="../jme3.html">jMonkeyEngine 3</a>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Beginner Tutorials</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../jme3/beginner/hello_simpleapplication.html">Hello SimpleApplication</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../jme3/beginner/hello_node.html">Hello Node</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../jme3/beginner/hello_asset.html">Hello Asset</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../jme3/beginner/hello_main_event_loop.html">Hello Main Event Loop</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../jme3/beginner/hello_input_system.html">Hello Input System</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../jme3/beginner/hello_material.html">Hello Material</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../jme3/beginner/hello_animation.html">Hello Animation</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../jme3/beginner/hello_picking.html">Hello Picking</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../jme3/beginner/hello_collision.html">Hello Collision</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../jme3/beginner/hello_terrain.html">Hello Terrain</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../jme3/beginner/hello_audio.html">Hello Audio</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../jme3/beginner/hello_effects.html">Hello Effects</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="../jme3/beginner/hello_physics.html">Hello Physics</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Intermediate Tutorials</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Concepts</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../jme3/intermediate/best_practices.html">Best Practices</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../jme3/intermediate/simpleapplication.html">Simple Application</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../jme3/features.html">Features</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../jme3/intermediate/optimization.html">Optimization</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../jme3/faq.html">FAQ</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="3">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Math Concepts</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../jme3/math_for_dummies.html">Math For Dummies</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../jme3/intermediate/math.html">Math</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../jme3/math.html">More Math</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../jme3/rotate.html">Rotate</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../jme3/math_video_tutorials.html">Math Video Tutorials</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="3">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">3D Graphics Concepts</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../jme3/intermediate/multi-media_asset_pipeline.html">Multi-Media Asset Pipeline</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../jme3/scenegraph_for_dummies.html">Scenegraph for Dummies</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../jme3/beginner/hellovector.html">Hello Vector</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../jme3/terminology.html">Terminology</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../jme3/intermediate/how_to_use_materials.html">How to Use Materials</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../jme3/intermediate/transparency_sorting.html">Transparency and Sorting</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../jme3/external/blender.html">Importing from Blender</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="../jme3/external/3dsmax.html">Importing from 3DS Max</a>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="../logo.html">Logo Usage</a>
- </li>
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="../bsd_license.html">License</a>
- </li>
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="../github_tips.html">Github Tips</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="0">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">SDK</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="../sdk.html">jMonkeyEngine SDK</a>
- </li>
- </ul>
- </li>
- </ul>
- </nav>
- </div>
- <div class="nav-panel-explore" data-panel="explore">
- <div class="context">
- <span class="title">Docs</span>
- <span class="version">master</span>
- </div>
- <ul class="components">
- <li class="component is-current">
- <span class="title">Docs</span>
- <ul class="versions">
- <li class="version is-current is-latest">
- <a href="../documentation.html">master</a>
- </li>
- </ul>
- </li>
- <li class="component">
- <span class="title">Wiki UI</span>
- <ul class="versions">
- <li class="version is-latest">
- <a href="../../wiki-ui/index.html">master</a>
- </li>
- </ul>
- </li>
- </ul>
- </div>
- </div>
- </aside>
- </div>
- <main class="article">
- <div class="toolbar" role="navigation">
- <button class="nav-toggle"></button>
- <nav class="breadcrumbs" aria-label="breadcrumbs">
- <ul>
- <li><a href="../documentation.html">Docs</a></li>
- <li><a href="model_loader_and_viewer.html">jMonkeyEngine SDK: Importing and Viewing Models</a></li>
- </ul>
- </nav>
- <div class="edit-this-page"><a href="https://github.com/jMonkeyEngine/wiki/edit/master/docs/modules/ROOT/pages/sdk/model_loader_and_viewer.adoc">Edit this Page</a></div>
- </div>
- <div class="content">
- <article class="doc">
- <h1 class="page">jMonkeyEngine SDK: Importing and Viewing Models</h1>
- <div id="preamble">
- <div class="sectionbody">
- <div class="paragraph">
- <p>The jMonkeyEngine SDK imports models from your project and stores them in the assets folder. The imported models are converted to a jME3 compatible binary format called .j3o. Double-click .j3o files in the jMonkeyEngine SDK to display them in the SceneViewer, or load them in-game using the AssetManager.</p>
- </div>
- <div class="paragraph">
- <p>Presently, <a href="http://www.blender.org/">Blender 3D</a> is the preferred modelling tool for jME3 as it is also Open-Source Software and an exporter for GLTF files exists. View the 3D model <a href="../jme3/features.html#supported-external-file-types" class="page">Supported External File Types</a> and their export/conversion options for more info.</p>
- </div>
- <div class="admonitionblock warning">
- <table>
- <tr>
- <td class="icon">
- <i class="fa icon-warning" title="Warning"></i>
- </td>
- <td class="content">
- <div class="paragraph">
- <p>Blender no longer supports Ogre exporting as of version 2.8. It’s highly recommended that you export and convert files using the GLTF type. Ogre will eventually be removed from this wiki.</p>
- </div>
- </td>
- </tr>
- </table>
- </div>
- <div class="paragraph">
- <p>Also, see this <a href="http://www.youtube.com/watch?v=nL7woH40i5c">demo video</a> on importing models.</p>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="installing-the-ogrexml-exporter-in-blender"><a class="anchor" href="#installing-the-ogrexml-exporter-in-blender"></a>Installing the OgreXML Exporter in Blender</h2>
- <div class="sectionbody">
- <div class="paragraph">
- <p>The jMonkeyEngine SDK includes a tool to install the correct exporter tools in Blender to export OgreXML files. To install the exporter, do the following:</p>
- </div>
- <div class="olist arabic">
- <ol class="arabic">
- <li>
- <p>Select <code><span class="menuseq"><b class="menu">Tools</b> <i class="fa fa-angle-right caret"></i> <b class="submenu">OgreXML</b> <i class="fa fa-angle-right caret"></i> <b class="submenu">Install</b> <i class="fa fa-angle-right caret"></i> <b class="menuitem">Blender OgreXML</b></span></code> in the jMonkeyEngine SDK Menu.</p>
- </li>
- <li>
- <p>If you are presented a filechooser, select the folder where your blender scripts reside.</p>
- </li>
- <li>
- <p>Press “Install” in the window that opens.</p>
- </li>
- </ol>
- </div>
- <div class="paragraph">
- <p>Also check out <a href="../jme3/external/blender.html" class="page">how to create compatible models in blender</a> and <a href="../jme3/intermediate/multi-media_asset_pipeline.html" class="page">how to organize your assets</a>.</p>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="using-the-model-files-directly"><a class="anchor" href="#using-the-model-files-directly"></a>Using the model files directly</h2>
- <div class="sectionbody">
- <div class="imageblock right">
- <div class="content">
- <img src="../_images/sdk/jmonkeyplatform-docu-2.png" alt="jmonkeyplatform-docu-2.png" width="421" height="298">
- </div>
- </div>
- <div class="olist arabic">
- <ol class="arabic">
- <li>
- <p>Create a separate folder for each model in the <code>assets</code> folder of your project.</p>
- </li>
- <li>
- <p>Export the model created in Blender <strong>to the <code>asset</code> folder of your project</strong>,</p>
- </li>
- <li>
- <p>Make sure all textures used in the .blend file are in the assets folder of the project.</p>
- </li>
- <li>
- <p>Double-click the model or right-click and select “Convert to JME binary” from the context-menu.</p>
- </li>
- <li>
- <p>In the Projects Explorer Assets node you should see your model j3o file.</p>
- </li>
- <li>
- <p>Double-click it to view it in the SceneViewer.</p>
- </li>
- <li>
- <p>Click on the lightbulb to turn on the light if you cannot see your model.</p>
- </li>
- </ol>
- </div>
- <div class="admonitionblock note">
- <table>
- <tr>
- <td class="icon">
- <i class="fa icon-note" title="Note"></i>
- </td>
- <td class="content">
- <div class="paragraph">
- <p>It is important that you export the model file and its textures to the correct assets folder before creating the j3o file because the paths for textures (and possibly other things) will be stored as absolute (to the assets folder root) when you convert that model. This means the texture location should not change after the import.</p>
- </div>
- </td>
- </tr>
- </table>
- </div>
- <div class="admonitionblock note">
- <table>
- <tr>
- <td class="icon">
- <i class="fa icon-note" title="Note"></i>
- </td>
- <td class="content">
- <div class="paragraph">
- <p>If the SceneViewer doesn’t work refer to <a href="troubleshooting.html" class="page">Troubleshooting jMonkeyEngine3 SDK</a>.</p>
- </div>
- </td>
- </tr>
- </table>
- </div>
- <div class="sect2">
- <h3 id="working-with-a-model"><a class="anchor" href="#working-with-a-model"></a>Working With a Model</h3>
- <div class="ulist">
- <ul>
- <li>
- <p>Open <code><span class="menuseq"><b class="menu">Windows</b> <i class="fa fa-angle-right caret"></i> <b class="menuitem">SceneExplorer</b></span></code> to view sub-nodes of the model.</p>
- </li>
- <li>
- <p>Open <code><span class="menuseq"><b class="menu">Windows</b> <i class="fa fa-angle-right caret"></i> <b class="menuitem">Properties</b></span></code> to view the properties of the model’s nodes.</p>
- </li>
- <li>
- <p>Click the cube button in the SceneViewer to toggle between Wireframe mode and Textured mode.</p>
- </li>
- <li>
- <p>Click the lightbulb to view Materials that require a light source</p>
- </li>
- </ul>
- </div>
- </div>
- <div class="sect2">
- <h3 id="notes-about-model-assets"><a class="anchor" href="#notes-about-model-assets"></a>Notes About Model Assets</h3>
- <div class="paragraph">
- <p>The original OgreXML <code>.mesh.xml</code>, <code>.scene</code>, <code>.material</code>, <code>.skeleton.xml</code> or <code>.gltf</code> model files <strong>will not be included</strong> in the distribution <code>assets.jar</code> file of your distributed game, they are only available in the assets folder so you are able to recreate the <code>.j3o</code> file from the original if you ever come to change it in blender and have to export it again.</p>
- </div>
- </div>
- <div class="sect2">
- <h3 id="about-the-sceneviewer-and-sceneexplorer-window"><a class="anchor" href="#about-the-sceneviewer-and-sceneexplorer-window"></a>About the SceneViewer and SceneExplorer window</h3>
- <div class="paragraph">
- <p>The SceneViewer and SceneExplorer windows are shared among plugins to save system resources. This means that you will have to keep an eye on what plugin is using the scene right now and what you are actually modifying in these windows.</p>
- </div>
- <div class="paragraph">
- <p>Most plugins will deliver their own UI elements to modify the scene so the SceneExplorer is more of a global tool. The simple SceneComposer however heavily relies on its functions as other plugins might too in the future.</p>
- </div>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="about-the-projects-assetmanager"><a class="anchor" href="#about-the-projects-assetmanager"></a>About the projects AssetManager</h2>
- <div class="sectionbody">
- <div class="paragraph">
- <p>Each jMonkeyEngine SDK project has its own internal AssetManager that has the projects assets folder registered as a FileLocator. When the project is run, the assets folder is compressed into a jar file and added to the projects main jar classpath. This way the editors in jMonkeyEngine SDK and the running game have the same asset folder structure.</p>
- </div>
- <div class="paragraph">
- <p>You might wonder why jMonkeyEngine SDK requires you to copy the model that is to be converted to j3o into the assets folder before. The Model Import Tool also copies the model and associated files to the project directory before converting. To load the model it needs to be in a folder (or jar etc..) that belongs to the projects AssetManager root. To load a model from some other folder of the filesystem, that folder would have to be added to the AssetManager root. If every folder that contains a model was in the root of the AssetManager, all textures named “hull.jpg” for example would be the same for the AssetManager and it would only deliver the texture of the first model folder that was added.</p>
- </div>
- <div class="paragraph">
- <p>To have a valid jME3 object, the paths to textures and other assets belonging to the model have to be read with the correct, final path that can then be stored in the j3o object. The j3o object will use those paths when it is loaded with the AssetManager and it requires the AssetManager to deliver the assets on those paths, this is why the folder structure while converting has to be the same as when loading.</p>
- </div>
- </div>
- </div>
- </article>
- <aside class="toc sidebar" data-title="Contents" data-levels="2">
- <div class="toc-menu"></div>
- </aside>
- </div>
- </main>
- </div>
- <footer class="footer">
- <p>Copyright 2020 jMonkeyEngine Wiki Contributors. Licensed BSD-3.</p>
- </footer>
- <script src="../../_/js/vendor/docsearch.min.js"></script>
- <!-- fetched from https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js -->
- <script>
- var search = docsearch({
- apiKey: 'a736b6d93de805e26ec2f49b55013fbd',
- indexName: 'jmonkeyengine',
- inputSelector: '#search-input',
- autocompleteOptions: { hint: false, keyboardShortcuts: ['s'] },
- algoliaOptions: { hitsPerPage: 10 }
- }).autocomplete
- search.on('autocomplete:closed', function () { search.autocomplete.setVal() })
- function focusSearchInput () { document.querySelector('#search-input').focus() }
- if (document.querySelector('.home-link.is-current')) window.addEventListener('load', focusSearchInput)
- </script>
- <script src="../../_/js/site.js"></script>
- <script async src="../../_/js/vendor/highlight.js"></script>
- </body>
- </html>
|