|
@@ -1,6 +1,6 @@
|
|
|
= Creating assets in Blender3D
|
|
|
-:author:
|
|
|
-:revnumber:
|
|
|
+:author:
|
|
|
+:revnumber:
|
|
|
:revdate: 2016/03/17 20:48
|
|
|
:relfileprefix: ../../
|
|
|
:imagesdir: ../..
|
|
@@ -8,7 +8,7 @@
|
|
|
ifdef::env-github,env-browser[:outfilesuffix: .adoc]
|
|
|
|
|
|
|
|
|
-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. Furthermore it explains how you can create various typical game-related assets like normal maps of high-poly models and baked lighting maps.
|
|
|
+This section discusses how to create and import models from Blender3D (2.78+, see bottom of page for Blender 2.49 and before) to jME3. Furthermore, it explains how you can create various typical game-related assets like "`Normal`" maps of high-poly models and "`Baked Lighting`" maps.
|
|
|
|
|
|
|
|
|
== Asset Management
|
|
@@ -18,17 +18,19 @@ For the managing of assets in general, be sure to read the <<jme3/intermediate/m
|
|
|
|
|
|
== Creating Models
|
|
|
|
|
|
-Game-compatible models are models that basically only consist of a mesh and UV-mapped textures, in some cases animations. All other material parameters or effects (like particles etc.) can not be expected to be transferred properly and probably would not translate to live rendering very well anyway.
|
|
|
+Game-compatible models are models that basically only consist of a mesh and UV-mapped textures, in some cases animations. All other material parameters or effects (like particles, etc.) cannot be expected to be transferred properly and probably would not translate to live rendering very well anyway.
|
|
|
|
|
|
|
|
|
=== UV Mapped Textures
|
|
|
|
|
|
-To successfully import a texture, the texture *has to* be UV-mapped to the model. Heres how to assign diffuse, normal and specular maps:
|
|
|
+To successfully import a texture, the texture *has to* be UV-mapped to the model. Heres how to assign "`Diffuse`", "`Normal`" and "`Specular`" maps:
|
|
|
|
|
|
-* image:jme3/external/blender-material-4.png[blender-material-4.png,width="300",height=""] image:jme3/external/blender-material-3.png[blender-material-3.png,width="350",height=""]
|
|
|
-** image:jme3/external/blender-material-2.png[blender-material-2.png,width="300",height=""] image:jme3/external/blender-material-1.png[blender-material-1.png,width="150",height=""]
|
|
|
+image::jme3/external/blender-material-4.png[blender-material-4.png,width="",height=""]
|
|
|
+image::jme3/external/blender-material-3.png[blender-material-3.png,width="",height=""]
|
|
|
+image::jme3/external/blender-material-2.png[blender-material-2.png,width="",height=""]
|
|
|
+image::jme3/external/blender-material-1.png[blender-material-1.png,width="",height=""]
|
|
|
|
|
|
-Its important to note that each used texture will create one separate geometry. So its best to either combine the UV maps or use a premade atlas with different texture types from the start and then map the uv coords of the models to the atlas instead of painting on the texture. This works best for large models like cities and space ships.
|
|
|
+It's important to note that each used texture will create one separate geometry. So it's best to either combine the UV maps or use a pre-made atlas with different texture types from the start and then map the uv coords of the models to the atlas instead of painting on the texture. This works best for large models like cities and space ships.
|
|
|
|
|
|
|
|
|
=== Animations
|
|
@@ -37,23 +39,26 @@ Animations for jME3 have to be bone animations, simple object movement is suppor
|
|
|
|
|
|
To create an animation from scratch do the following:
|
|
|
|
|
|
-* Create the model.
|
|
|
-** Make sure your models location, rotation and scale is applied and zero / one (see “Model Checklist below).
|
|
|
-** (Did you know? You can make any model from a box by only using extrusion, this creates very clean meshes.)
|
|
|
+. Create the model.
|
|
|
+.. Make sure your models location, rotation and scale is applied and zero / one (see "`Model Checklist`" below).
|
|
|
++
|
|
|
+TIP: Did you know? You can make any model from a box by only using extrusion, this creates very clean meshes.
|
|
|
|
|
|
-* Create the armature bones, don't forget to have one root bone!
|
|
|
-** Start by placing the cursor at zero.
|
|
|
-** Go to the `menu:Add[Armature > Single Bone]` menu and create the root bone.
|
|
|
-*** image:jme3/external/blender-add-bone.png[blender-add-bone.png,width="",height=""]
|
|
|
+. Create the armature bones, don't forget to have one root bone!
|
|
|
+.. Start by placing the cursor at zero.
|
|
|
+.. Go to the `menu:Add[Armature > Single Bone]` menu and create the root bone.
|
|
|
++
|
|
|
+image::jme3/external/blender-add-bone.png[blender-add-bone.png,width="",height=""]
|
|
|
|
|
|
-** Select the bone and go to edit mode (press kbd:[Tab]).
|
|
|
-** Select the root bone end and press kbd:[E] to extrude the bone, then start rigging your model this way.
|
|
|
-** *Make sure your armatures location, rotation and scale is applied (see “Model Checklist below) before continuing*.
|
|
|
+.. Select the bone and go to edit mode (press kbd:[Tab]).
|
|
|
+.. Select the root bone end and press kbd:[E] to extrude the bone, then start rigging your model this way.
|
|
|
++
|
|
|
+IMPORTANT: Make sure your armature's location, rotation and scale is applied (see "`Model Checklist`" below) before continuing.
|
|
|
|
|
|
-* Make the armature the parent of the model.
|
|
|
-** Make sure you are back in object mode (press kbd:[Tab] again).
|
|
|
-** First select the model object then select the armature object with kbd:[Shift] pressed, then press kbd:[Ctrl] + kbd:[P].
|
|
|
-** When you do this, you can select how the bone groups will be mapped to the model vertices initially. Select btn:[With Automatic Weights].
|
|
|
+. Make the armature the parent of the model.
|
|
|
+.. Make sure you are back in object mode (press kbd:[Tab] again).
|
|
|
+.. First select the model object then select the armature object with kbd:[Shift] pressed, then press kbd:[Ctrl] + kbd:[P].
|
|
|
+.. When you do this, you can select how the bone groups will be mapped to the model vertices initially. Select btn:[With Automatic Weights].
|
|
|
+
|
|
|
[NOTE]
|
|
|
====
|
|
@@ -61,79 +66,92 @@ When you parent your mesh to the armature, Blender automatically adds the `Armat
|
|
|
|
|
|
image:jme3/external/blender-make-armature.png[blender-make-armature.png,width="",height=""]
|
|
|
====
|
|
|
++
|
|
|
+Voila, your model should move when you move the bones in pose mode.
|
|
|
|
|
|
-* Voila, your model should move when you move the bones in pose mode.
|
|
|
-* From the `Info` header, press the btn:[Choose Screen Layout] button and select the `Animation` layout.
|
|
|
-* In the `Dope Sheet Editor` window, press the btn:[Context] button and select `Action Editor`.
|
|
|
-** image:jme3/external/blender-action-editor.png[blender-action-editor.png,width="",height=""]
|
|
|
+. From the `Info` header, press the btn:[Choose Screen Layout] button and select the `Animation` layout.
|
|
|
+. In the `Dope Sheet Editor` window, press the btn:[Context] button and select `Action Editor`.
|
|
|
++
|
|
|
+image::jme3/external/blender-action-editor.png[blender-action-editor.png,width="",height=""]
|
|
|
|
|
|
-* Add an action by pressing the btn:[+] button.
|
|
|
-* Set the rotationmode of the bone to Quaternion or switch later from your rotationmode to Quaternion and make a keyframe.
|
|
|
-** image:jme3/external/blender-switch-rotationmode.png[blender-switch-rotationmode.png,width="",height=""]
|
|
|
-* Create the keyframes (select the model armature and press kbd:[I]) along the timeline.
|
|
|
-** image:jme3/external/blender-add-keyframes.png[blender-add-keyframes.png,width="",height=""]
|
|
|
+. Add an action by pressing the btn:[+] button.
|
|
|
+. Set the "`Rotation Mode`" of the bone to `Quaternion` or switch later from your "`Rotation Mode`" to `Quaternion` and make a `Keyframe`.
|
|
|
++
|
|
|
+image::jme3/external/blender-switch-rotationmode.png[blender-switch-rotationmode.png,width="",height=""]
|
|
|
+. Create the ``Keyframe``s (select the model armature and press kbd:[I]) along the timeline.
|
|
|
++
|
|
|
+--
|
|
|
+image::jme3/external/blender-add-keyframes.png[blender-add-keyframes.png,width="",height=""]
|
|
|
|
|
|
-* Each action will be an animation available via the animation control in jME after the import.
|
|
|
-* *Press the btn:[F] button next to the action so it will be saved even if theres no references.*
|
|
|
-** The animation would else be deleted if its not the active animation on the armature and the file is saved.
|
|
|
+Each action will be an animation available via the animation control in jME after the import.
|
|
|
|
|
|
+IMPORTANT: Press the btn:[F] button next to the action so it will be saved even if there's no references. The animation would else be deleted if its not the active animation on the armature and the file is saved.
|
|
|
+--
|
|
|
|
|
|
|
|
|
-== Model Checklist
|
|
|
+=== Model Checklist
|
|
|
|
|
|
-Sometimes you do not create the model yourself and often times models from the web are not really made for OpenGL live rendering or not completely compatible with the bone system in jME.
|
|
|
+Sometimes you do not create the model yourself and often models from the web are not really made for OpenGL live rendering or not completely compatible with the bone system in jME.
|
|
|
|
|
|
To export an animated model in Blender make sure the following conditions are met:
|
|
|
|
|
|
-* The animation has to be a *bone animation*.
|
|
|
-* Apply Location, Rotation and Scale to the mesh in Blender: In the `3D Viewport` in Blender, select the mesh in `Object Mode`, from the `3D View Editor` header, click `menu:Object[Apply > Location / Rotation / Scale]`.
|
|
|
-** image:jme3/external/blender_apply_mesh.png[blender_apply_mesh.png,width="300",height=""]
|
|
|
+TIP: This checklist is interactive for your convenience.
|
|
|
|
|
|
-* Apply Location, Rotation and Scale to the armature in Blender: In the `3D Viewport` in Blender, select the armature in `Object Mode`, from the `3D View Editor` header, click `menu:Object[Apply > Location / Rotation / Scale]`.
|
|
|
-** image:jme3/external/blender_apply_bones.png[blender_apply_bones.png,width="300",height=""]
|
|
|
+[%interactive]
|
|
|
+* [ ] The animation has to be a *bone animation*.
|
|
|
+* [ ] Apply Location, Rotation and Scale to the mesh in Blender: In the `3D Viewport` in Blender, select the mesh in `Object Mode`, from the `3D View Editor` header, click `menu:Object[Apply > Location / Rotation / Scale]`.
|
|
|
++
|
|
|
+image::jme3/external/blender_apply_mesh.png[blender_apply_mesh.png,width="300",height=""]
|
|
|
|
|
|
-* Set the mesh’s origin point in the bottom of the mesh (see the image below).
|
|
|
-* Set the armature’s origin point in the bottom of the armature (see the image below).
|
|
|
-* Armature’s origin point and mesh’s origin point must be in the same location(see the image below).
|
|
|
-* Use a root bone located in the armature’s origin. This root bone must be in vertical position (see the image below) 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)).
|
|
|
-* Uncheck "`Bone Envelopes`" checkbox on the Armature modifier for the mesh (see the image below).
|
|
|
-** image:jme3/external/blender_envelopes.png[blender_envelopes.png,width="300",height=""]
|
|
|
+* [ ] Apply Location, Rotation and Scale to the armature in Blender: In the `3D Viewport` in Blender, select the armature in `Object Mode`, from the `3D View Editor` header, click `menu:Object[Apply > Location / Rotation / Scale]`.
|
|
|
++
|
|
|
+image::jme3/external/blender_apply_bones.png[blender_apply_bones.png,width="300",height=""]
|
|
|
+
|
|
|
+* [ ] Set the mesh’s origin point in the bottom of the mesh (see the image below).
|
|
|
+* [ ] Set the armature’s origin point in the bottom of the armature (see the image below).
|
|
|
+* [ ] Armature’s origin point and mesh’s origin point must be in the same location (see the image below).
|
|
|
+* [ ] Use a root bone located in the armature’s origin. This root bone must be in vertical position (see the image below) and it is the root bone of the armature. If you rotate the root bone, the entire armature might be rotated when you import the model into jMonkey.
|
|
|
+* [ ] Uncheck:
|
|
|
+** [ ] Bone Envelopes
|
|
|
++
|
|
|
+--
|
|
|
+on the Armature modifier for the mesh (see the image below).
|
|
|
|
|
|
-* Under the armature data tab, make sure the bone type is `Octahedral` (see image below).
|
|
|
+image::jme3/external/blender_envelopes.png[blender_envelopes.png,width="300",height=""]
|
|
|
+--
|
|
|
+* [ ] Under the armature data tab, make sure the bone type is `Octahedral` (see image below).
|
|
|
//* Uncheck "`Envelopes`" checkbox on the armature (see the image below).
|
|
|
-** image:jme3/external/blender_rootbone2.png[blender_rootbone2.png,width="",height=""]
|
|
|
++
|
|
|
+image::jme3/external/blender_rootbone2.png[blender_rootbone2.png,width="",height=""]
|
|
|
|
|
|
|
|
|
-You can use SkeletonDebugger to show the skeleton on your game in order to check if the mesh and the skeleton are loaded correctly:
|
|
|
+You can use `SkeletonDebugger` to show the skeleton on your game in order to check if the mesh and the skeleton are loaded correctly:
|
|
|
|
|
|
[source,java]
|
|
|
----
|
|
|
-
|
|
|
- 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 animControl = soldier2.getControl(AnimControl.class);
|
|
|
- animControl.addListener(this);
|
|
|
- final AnimChannel animChannel = animControl.createChannel();
|
|
|
-
|
|
|
- final SkeletonDebugger skeletonDebug =
|
|
|
- new SkeletonDebugger("skeleton", animControl.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);
|
|
|
-
|
|
|
+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 animControl = soldier2.getControl(AnimControl.class);
|
|
|
+animControl.addListener(this);
|
|
|
+final AnimChannel animChannel = animControl.createChannel();
|
|
|
+
|
|
|
+final SkeletonDebugger skeletonDebug = new SkeletonDebugger("skeleton", animControl.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);
|
|
|
----
|
|
|
|
|
|
-* image:jme3/external/blender_finished.png[blender_finished.png,width="500",height=""]
|
|
|
+image::jme3/external/blender_finished.png[blender_finished.png,width="500",height=""]
|
|
|
|
|
|
Also check out these videos and resources:
|
|
|
|
|
@@ -142,101 +160,145 @@ Also check out these videos and resources:
|
|
|
* link:https://docs.google.com/fileview?id=0B9hhZie2D-fENDBlZDU5MzgtNzlkYi00YmQzLTliNTQtNzZhYTJhYjEzNWNk&hl=en[Exporting OgreXML scenes from Blender 2.49 to jME]
|
|
|
|
|
|
|
|
|
-=== NormalMap baking
|
|
|
-
|
|
|
-Models for live rendering should have a low polygon count. To increase the perceived detail of a model normal maps are commonly used in games. This tutorial will show how to create a normalmap from a highpoly version of your model that you can apply to a lowpoly version of the model in your game.
|
|
|
-
|
|
|
-
|
|
|
-== Blender modeling lowPoly & highPoly
|
|
|
-
|
|
|
-* If you use the multiresolution modifier you only need one object. Lets look at this example:
|
|
|
-** image:jme3/external/1.gif[1.gif,width="150",height=""]
|
|
|
+== Normal Map baking
|
|
|
|
|
|
-* Add a multiresolution modifier:
|
|
|
-** image:jme3/external/3.1.gif[3.1.gif,width="300",height=""]
|
|
|
+Models for live rendering should have a low polygon count. To increase the perceived detail of a model, Normal maps are commonly used in games. This tutorial will show how to create a Normal map from a "`HighPoly`" version of your model that you can apply to a "`LowPoly`" version of the model in your game.
|
|
|
|
|
|
-* There are two types of modifiers: Catmull-Clark and Simple.
|
|
|
-** Simple is better for things like walls or floors.
|
|
|
-** Catmull-Clark is better for objects like spheres.
|
|
|
|
|
|
-* When using Catmull-Clark with a higher “subdivide value (more than 3) its good to have the “preview value above 0 and less than the subdivide level. This is because Catmull-Clark smoothes the vertices, so the normalMap is not so precise.
|
|
|
-* Here is an example of Prewiew 1, it's more smooth than the original mesh:
|
|
|
-** image:jme3/external/2.gif[2.gif,width="150",height=""]
|
|
|
+=== Blender Modeling LowPoly & HighPoly
|
|
|
|
|
|
-* Enable “Sculpt Mode in blender and design the highPoly version of your model like here:
|
|
|
-** image:jme3/external/3.gif[3.gif,width="150",height=""]
|
|
|
+.Method 1
|
|
|
+If you use the `Multiresolution` modifier you only need one object. Let's look at this example, the Blender object Monkey, with an applied `Triangulate` modifier:
|
|
|
|
|
|
-* Now go into Render Tab, and bake a normalMap using same configuration as here:
|
|
|
-** image:jme3/external/4.gif[4.gif,width="300",height=""]
|
|
|
+image::jme3/external/monkey.png[monkey.png,width="50%",height=""]
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-[NOTE]
|
|
|
-====
|
|
|
-Remember! The actual preview affects the baking output and mesh export!
|
|
|
+. Add a "`Monkey`" object by selecting the btn:[Monkey] button located on the "`Create Tab`".
|
|
|
+.. While in `Object Mode`, in the `Properties` panel under the `Modifiers` tab, add a `Triangulate` modifier and apply it:
|
|
|
+.. While in `Object Mode`, in the `Properties` panel under the `Modifiers` tab, add a `Multiresolution` modifier:
|
|
|
++
|
|
|
+--
|
|
|
+image::jme3/external/3.1.gif[3.1.gif,width="300",height=""]
|
|
|
+
|
|
|
+There are two types of modifiers: Catmull-Clark and Simple.
|
|
|
+
|
|
|
+* Simple is better for things like walls or floors.
|
|
|
+* Catmull-Clark is better for objects like spheres.
|
|
|
+
|
|
|
+When using Catmull-Clark with a higher "`subdivide`" value (more than 3), it's good to have the "`Preview`" value above 0 and less than the subdivide level. This is because Catmull-Clark smooths the vertices, so the Normal map is not so precise.
|
|
|
+
|
|
|
+Regardless of the choice, the larger the difference is between "`Render`" and "`Preview`", the deeper the detail is on the Normal map.
|
|
|
+
|
|
|
+* Here is an example of `Preview 1`, it's more smooth than the original mesh:
|
|
|
+
|
|
|
+image::jme3/external/monkeyprev1.png[monkkeyprev1.png,width="50%",height=""]
|
|
|
+--
|
|
|
+. From the `File` header at the top of the 3d View, click the btn:[Choose Screen layout] button and select "`UV Editing`".
|
|
|
+. In the `3d View`, select the Monkey and kbd:[Tab] into "`Edit Mode`".
|
|
|
+. If the Monkey vertices are not already highlighted, press the kbd:[A] key until all vertices are highlighted.
|
|
|
+. From the `3d View` header, select `menu:Mesh[UV Unwrap>Smart UV Project]`.
|
|
|
+.. Click the btn:[Island Margin] button once to advance the value to .03.
|
|
|
+.. Click btn:[OK] when ready.
|
|
|
+. In the `UV Image Editor`, click the btn:[New] button.
|
|
|
+.. Change the name to something like "`monkey_bump`".
|
|
|
+.. Optionally, change the `Generated Type` to "`UV Grid`".
|
|
|
+.. Uncheck:
|
|
|
+** [ ] 32 Bit
|
|
|
+.. Click btn:[OK] when ready.
|
|
|
+. From the `File` header at the top of the `UV Image Editor`, click the btn:[Choose Screen layout] button and select "`Default`".
|
|
|
+. With your mouse inside the `3D View`, tab into `Object Mode`.
|
|
|
+. Now go into the `Render` tab, and bake a `Normal` map using the same configuration as here:
|
|
|
++
|
|
|
+--
|
|
|
+image::jme3/external/4.gif[4.gif,width="300",height=""]
|
|
|
+
|
|
|
+IMPORTANT: Remember! The actual preview affects the baking output and mesh export!
|
|
|
+--
|
|
|
+
|
|
|
+. Navigate back to the `UV Editing` layout and save your image by selecting `menu:Image*[Save As]` from the `UV Image Editor` header.
|
|
|
+
|
|
|
+TIP: The asterisk kbd:[*] next to the `Image` menu item means the image has not yet been saved.
|
|
|
+
|
|
|
+.Normal map from Method 1
|
|
|
+image::jme3/external/monkey_bump.png[monkey_bump.png,width="50%",height=""]
|
|
|
+
|
|
|
+This second method produces the best results by far:
|
|
|
+
|
|
|
+.Method 2
|
|
|
+. Follow the steps for "`Method 1`" but before baking, uncheck:
|
|
|
+** [ ] Bake from Multires
|
|
|
+. Make a copy of your mesh (kbd:[SHIFT]+kbd:[D]).
|
|
|
+. Remove the Multires modifier from the copied model.
|
|
|
+. Remove any materials from the copied model.
|
|
|
+. Remove the armature modifier from the copied model.
|
|
|
+. Select the original (HighPoly) model.
|
|
|
+. Go into pose mode, clear any pose transformations.
|
|
|
+. The "`HighPoly`" and "`LowPoly`" models should be on top of each other now.
|
|
|
+. Select the original (HighPoly) model.
|
|
|
+. Hold kbd:[SHIFT] and select the copied (LowPoly) model.
|
|
|
+. In the `Properties` panel, in the `Render` tab:
|
|
|
+.. Bake Mode: `Normal`
|
|
|
+.. check:
|
|
|
+** [x] Selected to Active
|
|
|
+.. Use a reasonably high value for "`Margin`" (4+ pixels at least for 1024x1024 maps).
|
|
|
+. Bake and don't forget to save the Normal map image.
|
|
|
+
|
|
|
+[IMPORTANT]
|
|
|
====
|
|
|
+Keep in mind that when you duplicate the model, you are also duplicating its UV mapping. What this means is your "HiPoly" model and "`LowPoly`" model are both assigned to an image.
|
|
|
|
|
|
+If you ever see this error:
|
|
|
|
|
|
+"No objects or images found to bake to"
|
|
|
|
|
|
-[NOTE]
|
|
|
-====
|
|
|
-Be careful: The steps above lead to terrible normal maps - use this procedure instead:
|
|
|
+You are either missing the image for the "`LowPoly`" model, or in the Outliner, the camera symbol (Restrict Render) is off (grayed out).
|
|
|
====
|
|
|
|
|
|
+.Normal map from Method 2
|
|
|
+image::jme3/external/monkey_bump2.png[monkey_bump2.png,width="50%",height=""]
|
|
|
|
|
|
-* uncheck “[ ] Bake from Multires
|
|
|
-* switch to object mode
|
|
|
-* make a copy of your mesh (SHIFT+D)
|
|
|
-* remove the Multires modifier from the copied model
|
|
|
-* remove any materials from the copied model
|
|
|
-* remove the armature modifier from the copied model
|
|
|
-* select the original (highres) model
|
|
|
-* go into pose mode, clear any pose transformations
|
|
|
-* the highres and lowres models should be on top of each other now
|
|
|
-* select the original (highres) model
|
|
|
-* hold SHIFT and select the copied (lowres) model
|
|
|
-* in the properties menu go to render
|
|
|
-* use Bake > Normal
|
|
|
-* check “[x] Selected to Active
|
|
|
-* use a reasonably high value for “Margin (4+ pixels at least for 1024x1024 maps)
|
|
|
-* don't forget to safe the normal map image
|
|
|
+=== Fixing the Normal colors in Blender
|
|
|
|
|
|
+There are two "`standards`" for Normal maps:
|
|
|
|
|
|
-[NOTE]
|
|
|
-====
|
|
|
-Be careful: in the Outliner the camera symbol (Restrict Render) must be on!
|
|
|
-====
|
|
|
-
|
|
|
+* DirectX
|
|
|
+* OpenGL
|
|
|
|
|
|
+The difference between them is that the green channel is inverted. One would expect that JME supports the OpenGL way, but actually JME supports the DirectX way because it’s what Blender supports and the developers of JME thought it would be easier in the Blender to JME workflow.
|
|
|
|
|
|
-== Fixing the normal colors in Blender
|
|
|
+Because of this, you need to fix the colors to prepare the Normal map for using it with the JME Lighting Material. You should only have to invert the green channel, the red and blue channels should stay unchanged. The curve for the red and blue channels should go from bottom left to top right, the green from top left to bottom right.
|
|
|
|
|
|
-Blender has its own normal colors standard. We need to fix the colors to prepare the normalmap for using it with the JME Lighting Material.
|
|
|
+To do this after baking and saving the original Normal map image:
|
|
|
|
|
|
-To do this, go to the Blender Node Window
|
|
|
+. In the "`UV Editing`" layout, from the "`UV Image Editor`" header select `menu:Image[Invert>Invert Green Channel]`.
|
|
|
+. Save the inverted image to a destination you want and use it with the JME Lighting Material and the "`LowPoly`" version of the model.
|
|
|
|
|
|
-* Here is Blender Node example. It fixes the normal colors:
|
|
|
-** image:jme3/external/5.gif[5.gif,width="500",height=""]
|
|
|
+.Normal map invert results (Method 2 example)
|
|
|
+image::jme3/external/monkey_bump2_invert.png[monkey_bump2_invert.png,width="50%",height=""]
|
|
|
|
|
|
+[TIP]
|
|
|
+.Inverting Tips
|
|
|
+====
|
|
|
+If you build the engine from source, the master branch link:https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.j3md#L39[PBR material] has a NormalType parameter that allows one to handle this in the shader instead of having to edit the Normal map.
|
|
|
|
|
|
-* Here is the colors configuration:
|
|
|
-** image:jme3/external/6.gif[6.gif,width="180",height=""] image:jme3/external/7.gif[7.gif,width="180",height=""] image:jme3/external/8.gif[8.gif,width="180",height=""]
|
|
|
-
|
|
|
+You can also use the SDK to invert the channel:
|
|
|
|
|
|
-* Sometimes it will be needed to change R and G scale and add some blur for better effect. Do it like on image below
|
|
|
-** image:jme3/external/exception2.gif[exception2.gif,width="",height=""]
|
|
|
+. In the SDK, btn:[RMB] select the image and choose "`Edit Texture`".
|
|
|
+. In the window header, press the btn:[Filters] button and choose `menu:Invert[Green]`.
|
|
|
+. When satisfied, save the change in the same format as the original image using `menu:File[Save]`.
|
|
|
+====
|
|
|
|
|
|
-* After rendering, save the file to a destination you want and use it with the JME Lighting Material and the lowpoly version of the model.
|
|
|
-** image:jme3/external/ready_normal.gif[ready_normal.gif,width="",height=""]
|
|
|
+This is what the final outcome of Normal map baking should produce for you. A "`LowPoly`" model that looks like it's a "`HighPoly`" model.
|
|
|
|
|
|
+.Final results (Method 2 example)
|
|
|
+image::jme3/external/monkey_final.gif[monkey_final.gif,width="",height=""]
|
|
|
|
|
|
|
|
|
-=== LightMap baking
|
|
|
+== LightMap baking
|
|
|
|
|
|
The goal of this tutorial is to explain briefly how to bake light map in blender with a separate set of texture coordinates and then export a model using this map in jME3.
|
|
|
|
|
|
|
|
|
-== Blender modeling + texturing
|
|
|
+=== Blender modeling + texturing
|
|
|
|
|
|
* create a mesh in blender and unwrap it to create uvs
|
|
|
** image:jme3/advanced/1.jpg[1.jpg,width="600",height=""]
|
|
@@ -279,19 +341,19 @@ The blend file, the ogre xml files and the textures can be found in the download
|
|
|
link:http://code.google.com/p/jmonkeyengine/downloads/detail?name=LightMap.zip&can=2&q=#makechanges[http://code.google.com/p/jmonkeyengine/downloads/detail?name=LightMap.zip&can=2&q=#makechanges]
|
|
|
|
|
|
|
|
|
-=== Modelling racing tracks and cars
|
|
|
+== Modelling racing tracks and cars
|
|
|
|
|
|
Follow the link below to a pdf tutorial by rhymez where I guide you to modelling a car and importing it to the jMonkeyengine correctly and edit it in the vehicle editor.Plus how to model a simple racing track.
|
|
|
link:http://www.indiedb.com/games/street-rally-3d/downloads/modelling-in-blender-to-the-jmonkeyengine[http://www.indiedb.com/games/street-rally-3d/downloads/modelling-in-blender-to-the-jmonkeyengine]
|
|
|
|
|
|
|
|
|
-=== Optimizing Models for 3D games
|
|
|
+== Optimizing Models for 3D games
|
|
|
|
|
|
Follow the link below to a pdf tutorial by rhymez where I guide you on how you can optimize your models for faster rendering.
|
|
|
link:http://www.indiedb.com/games/street-rally-3d/downloads/optimizing-3d-models-for-games[http://www.indiedb.com/games/street-rally-3d/downloads/optimizing-3d-models-for-games]
|
|
|
|
|
|
|
|
|
-=== SkyBox baking
|
|
|
+== SkyBox baking
|
|
|
|
|
|
There are several ways to create static images to use for a sky in your game. This will describe the concepts used in blender and create an ugly sky emoji:smiley Check the links below for other ways and prettier skies.
|
|
|
|