Blender

Install Addon

  1. copy 'tools/blender/io_export_chrisslymesh.py' to 'C:\Program Files\Blender Foundation\Blender 3.1\3.1\scripts\addons'
  2. in Blender go to 'Edit -> Preferences -> Add-ons' and check 'Import-Export ChrisslyEngine-Mesh format(.mesh)'

Export directly to (.mesh), (.material), (.skeleton) and (.tex) using the addon

  • textures are exported in R8G8B8A8 format
  • axis_conversion(from_forward='-Y', to_forward='Z', to_up='Y') on static meshes and morph animations, but not on skeletal animations
  • modifiers are not applied (to apply: 'Object Mode -> Object -> Apply -> All Transforms')
  • set a custom gpu program in material:
    1. select material
    2. 'Custom Properties -> New'
    3. name the new property 'gpu_program' and select 'String' as type
    4. set value (like "skybox.fx")
    5. after export your (.material) file will contain a line 'gpu_program "skybox.fx"' in the pass section
  • add a custom/external cubemap to material:
    1. select material
    2. 'Custom Properties -> New'
    3. name the new property 'cubic_texture' and select 'String' as type
    4. set value (like "irradiance.tex")
    5. after export your (.material) file will contain another texture_unit with the given cubemap in the pass section

Export to "obj" for later conversion with the mesh cl tool

Options blender "obj" exporter for animations:

  • 'Export Animation'
  • 'Triangulated Mesh'

Skeletal Animation Setup

In order to work correctly in the engine there are a few necessities when setting up the rig and animations:

  • limit weights per vertex to 4 (in 'Weight Paint' mode: 'Weights -> Limit Total')
  • normalise weights so all weights of a vertex sum up to 1 (in 'Weight Paint' mode: 'Weights -> Normalize All')
  • in 'Pose Mode' set the bones transform mode to: 'Quaternion (WXYZ)'
  • apply transform if the mesh or skeleton was moved, rotated or scaled
  • always insert 'Location & Rotation' to all channels (scale not supported)
  • to add an animation just create a new Action

About Coordinate Systems

Blender (forward is -Y and Up is +Z)

+Z
^    +Y
|   /
|  /
| /
|/
+--------> +X

OpenGL Right-handed (forward is +Z and Up is +Y)

+Y
^    -Z
|   /
|  /
| /
|/
+--------> +X

That's why the exporter transforms the vertices with axis_conversion(from_forward='-Y', to_forward='Z', to_up='Y').

Separate mesh into equal chunks by a grid

This comes in handy to split large meshes like terrains in to smaller pieces for culling and coarse collision detection.

  1. 'Object Mode -> Add -> Mesh -> Grid'
  2. delete faces of the grid 'Edit Mode -> Mesh -> Delete -> Only Faces'
  3. in 'Edge Select' mode, extrude grid with 'E' in -Z direction to create a shape we can cookie-cut our mesh with
  4. 'Object Mode' select all (the mesh and the grid) and press 'Ctrl + J' to join
  5. 'Edit Mode' select corner of the grid and press 'L'
  6. 'Face -> Intersect(Knife)'
  7. 'Mesh -> Split -> Faces by Edges'
  8. 'Mesh -> Separate -> By Loose Parts' will create separate objects
  9. remove leftovers from the grid
  10. in the exporter check the 'Objects as separate files' option

Flat normals (face normal on all vertices of the face)

For the entire mesh:

  1. 'Edit Mode' select all
  2. 'Add Modifier -> Edge Split'
  3. 'Object Mode' select modifier and 'Apply' For particular faces:
  4. 'Edit Mode' select face
  5. 'Mesh -> Split -> Selection'