Blender
Install Addon
- copy 'tools/blender/io_export_chrisslymesh.py' to 'C:\Program Files\Blender Foundation\Blender 3.1\3.1\scripts\addons'
- 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:
- select material
- 'Custom Properties -> New'
- name the new property 'gpu_program' and select 'String' as type
- set value (like "skybox.fx")
- after export your (.material) file will contain a line 'gpu_program "skybox.fx"' in the pass section
- add a custom/external cubemap to material:
- select material
- 'Custom Properties -> New'
- name the new property 'cubic_texture' and select 'String' as type
- set value (like "irradiance.tex")
- 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.
- 'Object Mode -> Add -> Mesh -> Grid'
- delete faces of the grid 'Edit Mode -> Mesh -> Delete -> Only Faces'
- in 'Edge Select' mode, extrude grid with 'E' in -Z direction to create a shape we can cookie-cut our mesh with
- 'Object Mode' select all (the mesh and the grid) and press 'Ctrl + J' to join
- 'Edit Mode' select corner of the grid and press 'L'
- 'Face -> Intersect(Knife)'
- 'Mesh -> Split -> Faces by Edges'
- 'Mesh -> Separate -> By Loose Parts' will create separate objects
- remove leftovers from the grid
- in the exporter check the 'Objects as separate files' option