Bone Export HOWTO
Software
- Cinema4d 11.5
- Unity 5
- WebGL
Modeling / rigging
- Create 3d model.
- Flatten the mesh (aka Current State to Object) and the clean it up from empties and merge meshes if it produces more than one.
- Menu > Character > Joint and create the hierarchy
- back to the model, add tag Character Tags > Weight and add all the joints to the properties.
- Click Set Pose and Auto Weight in the tag properties
- Add skin under the model in hierarchy (Menu > Character > Skin)
- If you need to chabge the bone strucotre, select Clear Weights in tag proeprties and siabled Skin (click the green checkmark in Objects panel)
- If adding more bones, remember to add the to the list in the Weight tag properties
- When done, export to FBX and move over to Unity5 (or just save the C4D file in Unity assets folder no need to FBX then)
Unity5 exporting
- Do a sanity check (see if all joint work fine)
- Disable all the mess and Null Objects
- Fine tune the import setting (scale, normals, etc...)
- Select the object and J3D > Export
- If model does not have animations, uncheck the "Export Animation" checkbox
WebGL / Squareroot
- Sanity check again (are boneWeights and boneIndices in the mesh, is the bone struture in the scene file)
- Import the JSON files
- Remember that if the scene doesn't have a camera, you'll need to create one including a projection setting ;)
- The shader needs to use the bones.glsl include and the a
Position
and aNormal
attributes need to be passed to the bones
function, like this:
//#include bones
...
vec3 p = bones(aPosition);
vec3 n = bones(aNormal);