Importing Importing




Importing Static Meshes using FBX (Video Tutorials)


The following video tutorials show you the workflow how to create 3d meshes inside Blender, Maya and 3ds Max and import them into the engine using FBX

Following procedures are covered: 
  • Setup the World Coordinate System
  • Setup the Units Scale
  • Create a 1m x 1m x 1m Box
  • Automap UVs
  • Apply Delta Engine Shader
  • Apply Diffuse Texture
  • Export the mesh as FBX 
  • Import the FBX into the engine
If you are not a big fan of video tutorials, there is also a detailed text summary available below each video.

Text Summary



Preparation


Blender is a free and open source 3D animation suite and can be downloaded here

Download the phyton script "DeltaEngineSimpleShaderForBlender268.py" and the png image file "BoxDiffuse.png" from this website. Launch Blender. 


Scene Setup and Box Creation


Start by setting up the Units Scale. In the Scene Context Scene Context, turn the Units to „Metric“.

For the box model, use the cube that is already in the scene. A cube can also be created this way: Add > Mesh > Cube.

Press „N“ to access the properties shelf. For every dimension, type in "1" which is 1 Meter. By performing this action, the Scale of the cube also changes. Press Ctrl + A (Strg+ A) and choose "Scale". This will reset the scale back to 1.



Give the cube a meaningful name, e.g. „Box“, by typing it in the textfield in the Object Context Object Context.

Set the Diffuse Color, located in the Material Context Material Context , to white (RGB: 1 ; 1 ; 1).
Set the Specular Intensity, located in the Material Context Material Context , to be 0.
Set the Ambient Color, located in the World Context World Context , to be 10% (RGB: 0,100 ; 0,100 ; 0,100)


Texture Mapping and Applying The Shader

In the Textures Context Textures Context, create a new textures with type „Image or Movie“. Import the texture.

Next, open the UV/ Image Editor UV/ Image Editor. With the Cube selected, switch to Edit Mode Edit Mode and turn on „Face Select“ Face Select. In the left Panel, scroll down to UV Mapping and choose „Unwrap“ from the dropdownlist. Inside the UV/ Image Editor, choose BoxDiffuse.png as „Image to be linked“ Image To Be Linked.

Set „Texture“ as Viewport Shading Texture Viewport Shading. Now the box is displayed with texture in the viewport. You can see that the rotation of the image on some faces is not as intended. To fix this, select a face of the cube in the viewport which has currently not mapped right. In the UV/ Image Editor´s menu, choose UVs > Transform > Rotate ( which is only visible when in Edit Mode). When moving the cursor while this mode is active, you change the rotation of the UVs. To rotate in 5 degree increments, hold Ctrl/ Strg while rotating. This is useful to achieve a precize rotation. Once you are happy with the mapping, press the left mouse button to apply the rotation and leave this mode. Correct all other faces this way. 

In the Texture context scroll down to Mapping. Set „Coordinates“ to „UV“ and as Map „UVMap“.
Change „Blender Render“ to „Blender Game“. In the properties shelf under „Display“, set „Shading“ to „GLSL“.

Open the Text Editor Text Editor. Click „Open Text Block“ under the menu point „Text“ and choose DeltaEngineSimpleShaderForBlender268.py.

Now open the Logic Editor Logic Editor. Choose „Always“ in the Dropdownlist „Add Sensor“, and „Phyton“ in the Dropdownlist „Controller“. As script, use DeltaEngineSimpleShaderForBlender268.py. Connect the two boxes.

Press „P“ to enter Playmode, press esc to end it. You can change FBX export properties by adding text to the object´s name. For example: Add „|C“ to export the object without texture. To see a list of these extensions and their purpose, open the text editor again that shows the phyton script.

|C: No Texture, just coloring is used
|A: Alpha Test
|L: Use Directional Lighting (uses your light and the material ambient+diffuse)
|M: Use LightMap (uses secound UV channel and same name as fbx file+LightMap)
|F: Use Fog (Setup in Level, use the blender fog settings for testing)


Exporting The Box As FBX

Go to File > Export > Autodesk FBX (.fbx). Use "Box" as filename. 
 
Leave the settings as they are ( Y Up, Scale: 1.00). In the FBX Export Screen, tick the "XNA Strict Option" Checkbox. This option is exists only in versions prior to Blender v2.69. 

Blender exports it wrong, the engine fixes from meters to centimeters. 

Blender Export Dialog Settings


Importing The Box Into Your Project


Import the two files (Box.fbx and BoxDiffuse.png) into your project by dragging and dropping them into the viewport or by pressing the "Add"-Button inside the ContentManager



Text Summary


Preparation


Maya ® is a 3D computer graphics software currently owned and developed by Autodesk, Inc. A 30-day-trial version can be downloaded here

Download "DeltaEngineSimpleShaderForMaya2010-2014.fx" and the png image file "BoxDiffuse.png".

Launch Maya (Version 2010 or higher). 


Scene Setup and Box Creation


Open the Plug-in Manager (Windows > Settings/ Preferences > Plug-in Manager) and make sure following plugins are loaded:

cgfxShader.mll, ddsFloatReader.mll, hlslShader.mll

Go to Window > Settings/ Preferences > Preferences > Settings. Under World Coordinate System, set Up axis to Z and under Working Units, set Linear to centimeter.



Create a cube (Create > Polygon Primitives > Cube > ). Set Width, Height and Depth to 100. At this point, your object is probably being displayed in wireframe. To change this, hit 5 on you keyboard to turn on Shaded display. (A list of all display hotkeys can be found here.)

Open the Channel Box ( Push this button  on the top right corner to open it). Set Translate X, Y and Z to 0, so the object is centered. Give the object a meaningful name (e.g. Box).

Texture Mapping and Applying The Shader

Open the Hypershade (Window > Rendering Editors > Hypershade). Create a HLSL Shader. With the box selected, right-click the shader node and „Assign Material to Selection“. In the Attribute Editor  , connect the „DeltaEngineSimpleShaderForMaya2010-2014“ file to the shader.  Assign the Diffuse Texture (BoxDiffuse.png) by clicking the checkerbox icon beneath the corresponding slot.

Press 6 on your keyboard to turn on „Shaded and Textured display“, so you can textures on objects in viewport.

Open the UV Texture Editor (Window > UV Texture Editor). Right-Click the Box in the Viewport, Choose „Face“ from the pop-up menu that appears and drag a selection box around it, so that all faces are selected. Now you will automap the Uvs. To do this, go to „Create Uvs > Automatic Mapping > “. (Note: This menu point is only visible when the Polygons-Menu set is active, see the dropdownbox on the left side to the Status line.)



In the „Polygon Automatic Mapping Options“-Dialog, turn on following settings:



Planes = 6
Shell Layout = Overlap
Scale Mode = None
Create new UV set = Unchecked

And hit Project. On some faces, the images are not adjusted as they should be. To fix this, select these faces on the box in the viewport and rotate them with the „Rotate selected UVs clockwise/ counterclockwise“-buttons  in the UV Editor until they are in the right positon. At this point, i recommend to delete the history (Edit > Delete By Type > History).

Exporting the box as FBX

Select the Box, go to File > Export Selection > . Under „General Options“, set the File type to „FBX export“. Use "Box" as filename. In the Export Dialog under "Axis Conversion", make sure the Up Axis is set to Z-up.  

Maya Axis Conversion


Importing The Box Into Your Project


Import the two files (Box.FBX and BoxDiffuse.png) into your project by dragging and dropping them into the viewport or by pressing the "Add"-Button inside the ContentManager



Text Summary



Preparation

3ds Max is a 3D computer graphics software by Autodesk. A 30-day-trial version can be downloaded here

Download "DeltaEngineSimpleShaderForMax2010-2014.fx" and the png image file "BoxDiffuse.png". 

Launch 3ds Max (Version 2010 or higher). 


Scene Setup and Box Creation
 
Go to Customize > Preferences > Viewports to set a DirectX 9 display driver. Next, set up the units you will be modeling in. Go to Customize > Units Setup > System Units Setup and set 1 Unit = 1 Centimeter.



Create the box (Create > Standard Primitives > Box) and in the Parameters Rollout, set Lenght, Width and Height to 100. Give the object a meaningful name (e.g. Box) by typing it in the textbox in the Modify Panel. Choose "Select and Move" from the main toolbar (or press "W" on your keyboard). Zero the box out by typing 0-0-0 in the Transform Type-In, so the object is centered. 


Texture Mapping and Applying The Shader

Open the Material Editor (Press the M key on the keyboard or click on the Material Editor button on main tool bar.) and create a DirectX Shader. With the Box selected, right-click the shader node and „Assign Material to Selection“. Pick „DeltaEngineSimpleShaderForMax2010-2012.fx“ as DirectX Shader. Assign the Diffuse Texture (BoxDiffuse.png) by clicking the correspondend slot.

In this case, the mapping is as it should be and doesnt need any more modification. To view the UV Layout, apply an Unwrap UVW Modifier from the Modifier Stack.

Exporting The Box As FBX

Select the Box, go to Export > Export Selected, Save as type: Autodesk (*.FBX). Use "Box" as filename. In the Export Dialog under "Axis Conversion", make sure the Up Axis is set to Z-up.  

3dsMax Axis Conversion

Importing The Box Into Your Project

Import the two files (Box.FBX and BoxDiffuse.png) into your project by dragging and dropping them into the viewport or by pressing the "Add"-Button inside the ContentManager


Baking Lightmaps and include them into the shader


The following video tutorials show you how to create a lightmap inside MayaBlender and 3ds Max, include it into the shader, and import them into the engine using FBX

Following procedures are covered: 
  • Creating lights and editing its parameters
  • Combining several meshes into one
  • Create a second (automapped) UV channel for lightbaking
  • Baking and saving the lightmap
  • Separate the geometry
  • Create shaders and include the lightmap into them
  • Export the mesh as FBX 
  • Import the FBX into the engine
If you are not a big fan of video tutorials, there is also a detailed text summary available below each video.



Text Summary


Preparation

Download the png file GroundDiffuse.png. Start with the Box Exporting Scene. The instruction is written down here


Setting up the scene and lights

Create a Plane (Add > Mesh > Plane) with 5m x 5m Dimensions. Zero it out by setting the Location to 0,0,0.  Apply the scale transformation of the plane. Move the box 50 cm upwards by typing in 0,5 in the Z Location Transform. 

Create a new Material in the Material Context and rename it to "GroundMaterial". Create a texture of type "Image or Movie" and set "TableDiffuse.png" as Texture. Switch to Edit Mode , press "U" and choose "Unwrap". In the Textures Context  under "Mapping", set Coordinates to "UV" and choose "UVMap".

Switch to Object Mode, shift-rightclick the two objects, and click "Join" (Button under "Object") in the Object Tools window on the left side. Now the two objects are combined. 

Create a spotlight. Go to Add > Lamp > Spot. Set the setting as follows: 

Properties Shelf: 

X: -1m
Y: 1m
Z: 6m

Object Data Context: 

Color: A blue tone

Energy: 8
Distance: 8m 

Spot Shape: 
Size: 55
Blend: 1

Create a second spotlight with this settings: 

Properties Shelf: 

Location: 
X: 1m
Y: -1m
Z: 6m

Object Data Context: 

Color: purple tone

Energy: 8
Distance: 8m 

Spot Shape: 
Size: 55
Blend: 1


Creating a second UV channel

Switch to Edit Mode. Press "U" and choose Lightmap Pack. In the Lightmap Pack, tick all checkboxes and hit "Ok".

Blender Lightmap Pack

Open the Object Data Context section Blender Object Data Context. Rename the newly created UV Map to "Lightmap", and the old one to "UVMap".

Blender: Rename UV Map

You can inspect the new lightmap in the UV/Image Editor. It will look like this: 

Blender UV Layout Lightmap
 
In the Textures Context, uncheck the checkbox beneath the two Diffuse Textures. This will turn off the visibility of the Diffuse Textures in the viewport. 

Switch to Edit Mode. In the UV/ Image Editor  choose "Lightmap" as "Active UV Map".


Baking and saving the lightmap

Go to the Render Context Blender Render Context and scroll down to the "Bake" submenu. Set "Full Render" as Bake Mode. Hit the "Bake"-Button. 

Blender Bake

Save the lightmap by going to Image > Save as image inside the UV/ Image Editor. 


Seperate the Geometry, create shaders and include the lightmap into them

Select the mesh and switch to Edit Mode. Press the "P" key on your keyboard and choose "Seperate > by loose parts". This will separate the box and the plane. 

Import the texture in the Textures Context on both Materials. Under Mapping, set "UV" as Coordinates and  "Lightmap" as Map. 

Blender. Set Lightmap as UV Map

In Order to export the meshes with lightmap, add a |M to the objects name. 

Export the geometry as FBX. Import it into your project by dragging and dropping it into the viewport or by pressing the "Add"-Button inside the ContentManager.



Text Summary



Preparation

Download the png file GroundDiffuse.png. Open the box scene that was created in this tutorial


Setting up the scene and lights

In the Plug-in Manager, make sure the plugin "Mayatomr.mll" is loaded. This is the plugin that enables Mental Ray

Create a 5m x 5m x 5m Plane and zero it out by typing 0 to all translate values in the channel box. Select the Box and in the channel box and set Translate Z to 50. 
 
When zooming out, the Geometry may disappear in the Viewport. To view it again, go to the persp camera attributes and increase the number of „Far Clip Plane“.
 
Create a standard lambert shader (right-click the meshes, and choose "Assign new material > Lambert" ) and assign it to the box and the plane. Turn on Viewport Renderer. 
 
Now create the lights. In this example, 2 spotlight were created (Create > Lights > Spot Light) with following settings
 
Spotlight 1 (The purple one)

Position: 
X: -137
Y: 276
Z: 650

Attributes: 

Color: R 172, G 83, B 255
Intensity: 3
Decay Rate: No Decay
Cone Angle: 100
Penumbra Angle: 0
Dropoff: 10

Raytrace Shadow Attributes: 
Use Ray Trace Shadows: Checked


Spotlight 2 (The blue one)

Position: 
X: 168
Y: -187
Z: 650

Attributes: 

Color: R 83, G 192, B 255
Intensity: 3
Decay Rate: No Decay
Cone Angle: 100
Penumbra Angle: 0
Dropoff: 10

Raytrace Shadow Attributes: 
Use Ray Trace Shadows: Checked




Creating a second UV channel

Next, combine the two meshes by „Mesh > Combine“ (Polygons Menu Set). Select all faces of the combined geometry and go to Create Uvs > Automatic Mapping >  with following settings: 



Shell Layout: Into Square, 
Scale Mode: Uniform, 
Shell Stacking: Shape, 
Create new UV set = Checked, 
UV set name = Lightmap

Click Project. Open the UV Texture Editor and when clicking the menu point „UV Sets“, you can either inspect the first „map1“-UV set and the newly created „Lightmap“-UV set, which will be used for lightbaking. 


Baking and saving the lightmap

Next, switch to the Rendering Menu Set. Go to Lightning/Shading > Batch Bake(mental ray). Enter the following settings in the dialog: 



Click convert and close. 
 
The image can be found in the Project Folder/renderData/mentalray/lightMap directory.


Seperate the Geometry, create shaders and include the lightmap into them

Switch to the Polygons Menu Set, select the mesh and go to „Mesh > Seperate“. At this point, i suggest to delete the history of the objects by „Edit > Delete by type > History“. Rename the plane to „Ground“ and the Box to „Box“. 

Open the Hypershade and assign the Hlsl shader to the box. Create a second hlsl shader for the plane, assign the DeltaEngineSimpleShaderForMaya2010-2014.fx and as Diffuse Texture, choose GroundDiffuse.png



Assign the lightmap texture to both HLSL shaders. Don´t forget to tick the "Use LightMap Texture" option. Scroll down to the „Surface Data“ section, rightclick in the textbox right to „UV1“ and choose „Lightmap“. Now the lightmap texture should be mapped with the right uv set. 



Finally, select the two objects and export them as FBX. Import it into your project by dragging and dropping it into the viewport or by pressing the "Add"-Button inside the ContentManager



Text Summary


Preparation

Download the png file GroundDiffuse.png. Start with the Box Exporting Scene. Open the Box Exporting Scene.


Setting up the scene and lights

Create a Plane without Segments and set length and width to 500cm. Right-mouseclick the Box and choose "Convert to: Editable Poly" from the context menu. Zero it out by setting all values to 0 in the Transform Type-in. Apply a standard material to the objects. Create some lights. In this example, 2 free spotlights were created (Create Panel > Lights > Standard > Free Spot button) with following settings: 

Spotlight 1 (The purple one)

Position
X: -100cm
Y: 100cm
Z: 600cm

Shadows
On = Checked
Ray Traced Shadows

Color
Red: 200
Green: 140
Blue: 255

Spotlight Parameters
Hotspot/ Beam: 40
Falloff/Field: 80


Spotlight 2 (The blue one)

Position
X: 100cm
Y: -100cm
Z: 600cm

Color
Red: 40
Green: 166
Blue: 255

Shadows
On = Checked
Ray Traced Shadows

Spotlight Parameters
Hotspot/ Beam: 40
Falloff/Field: 80
 

Creating a second UV channel

Turn the objects into a single mesh by using the Attach-Button. Select the model, and apply an "Unwrap UVW" Modifier from the Modifier list.

Change the Map Channel to 2. This is the second UV channel that will be used for lightmapping. 

Open the Edit UVWs Dialog, select "Face" and select all geometry. Inside the Edit UVWs Dialog, go to Mapping > Flatten Mapping.

The default settings are appropriate for this example. Hit Ok. Close the window and collapse the Modifier Stack (Right-click the Modifiers Stack Window and choose "Collapse All" from the menu).   
 
 
Baking and saving the lightmap

Select the geometry and go to Rendering > Render to Texture, or press the zero key. Set the output path, and under Mapping Coordinates, choose "Use existing Channel" and set the channel to "2".

Further down in the dialog, press the "Add..."-button. Select "LightingMap" in the Add Texture Element dialog. Hit "Add Elements". Type in a name, set the output path and specify a file size, in this case 512x512. Click "Render". The file can be found in the output directory. 
 
 
Separate the Geometry, create shaders and include the lightmap into them

Inside the Modify-Panel, turn the Selection Mode to "Element" and with the Box element selected, hit the "Detach"-Button (right to Attach-Button). A "Detach"-Window will open. In the "Detach as:"-textbox, write "Box". This will separate the box from the plane, and also name it to "Box". Select the Plane and name it "Ground". 

Double-Click the previously created DirectX shader for the box in the Material Editor to edit its parameters. Assign the LightMap Texture, set "LightMap Texture Map Channel" to 2 and tick the "Use LightMap Texture" option.

Assign the previously created box-shader back to the box. Repeat the whole process of creating the DirectX shader, but this time with the table diffuse texture, and assign the shader to the plane. 
 
Finally, Export the geometry as FBX. Import it into your project by dragging and dropping it into the viewport or by pressing the "Add"-Button inside the ContentManager


The following (currently for the future planned) video tutorials show you how to create an animated mesh inside Maya, Blender and 3ds Max and import it into the engine using FBX

Following procedures are covered: 
  • Creating a Skeleton with Joints
  • Skinning the Mesh
  • Animating using Forward Kinematics
If you are not a big fan of video tutorials, there is also a detailed text summary available below each video.



Text Summary


Coming soon



Text Summary


Preparation

Download and unpack "Catfish.zip". It contains a folder named "Catfish" that contains the project files for this tutorial. Place it in your Users/USER/Documents/maya/projects directory. Launch Maya (Version 2010 or higher). Go to File > Set Project, Choose "Catfish" and hit the "Set"-Button.

Go to File > Open Scene and open the file "Catfish.mb".

Go to Window > Settings/Preferences > Preferences. In the Kinematics Category, enter 2 for the Joint size and click the Save button.

Set the end time of the Playback range to 64.


Creating a Skeleton with Joints

Select Skeleton > Joint Tool > . (This Menu Point is only active when the Animation Menu Set is active.) Tick the checkbox „“Orient Joint to World“ in the Joint settings. In the side view, click to create 5 joints as shown in the image below.  



Press Enter after creating the last joint. This will complete the action. 

Once again, activate the Joint Tool. Select „joint1“, then create an additional joint as shown in the image below. Press Enter. 




Skinning the Mesh

Select joint1 and then the mesh.



Go to Skin > Bind Skin > Smooth Bind. Enter following settings in the dialog: 



Now the Skeleton is attached to the catfish mesh. 


Animating using Forward Kinematics

Go to Frame 1 in the timeslider. Shift-select joint2 – joint5 (Either in the Outliner as shown in the image or in the viewport). In the channelbox, rightclick the Rotate Z label and choose „Key Selected“ from the popup menu.



The textbox right to the label will turn red, what means that a keyframe was set. 

Go to frame 14. With joint2 – joint5 still selected, type in „10“ in the Rotate Z textbox. Again, rightclick the Rotate Z label and choose „Key Selected“ to set a keyframe for the joints rotation. 

On frame 28, type in 0 and set a keyframe. 
On frame 42, type in -10 and set a keyframe.
On frame 56, type in 0 and set a keyframe.

Go to Frame 1 and select joint1. Set following keyframes: 
 
On frame 9, type in 0 and set a keyframe. 
On frame 22, type in -10 and set a keyframe. 
On frame 36, type in 0 and set a keyframe. 
On frame 50, type in 10 and set a keyframe.
On frame 64, type in 0 and set a keyframe.
  
From the Perspective View menu, go to Panels > Saved Layouts > Persp/Graph/Outliner. This will split the interface into the Perspective View, the Outliner and the Graph Editor
 
With the Graph Editor active, press Key „F“ on your keyboard to view the graphs as a whole. This is what you will see: 



Draw a selection box around the graphs and check the „Spline Tangents“ Button. Under Menu Point „Curves“, set „Pre Infinity“ and „Post Infinity“ to Cycle. The Cycle setting repeats the animation curve as a copy infinitely.

In the Outliner, strg/ctrl – click joint1 and  joint2 to deselect them. Draw a selection box around the graphs. Turn on „Constrained x-axis drag“ . Move the graphs 3 frames to the right. Then deselect joint3 and move the graphs 1 frame to the right again. Continue with this procedere until there are no more joints. 

Set the end time of the Playback range to 56.

Select the mesh and go to File > Export Selection > and enter following settings in the Export Dialog: 



Import the animated FBX and Diffuse Texture into your project by dragging and dropping it into the viewport or by pressing the "Add"-Button inside the ContentManager.



Text Summary


Coming soon


Spine is a third-party 2D skeletal animation tool from Esoteric Software.

A guide how to export Atlas files out of it and import it into the engine can be found on this site