I finally finished my WebGL demo to render an animated character. To create the JSON File, I changed my ParrotEngine Blender Export Script to output a JSON file instead of XML.
The demo was tested on Firefox 7 and 8, Opera 12 and Google Chrome 15 – each was running fine. Internet Explorer does not support WebGL – and probably never will, so you have to use another browser to see the demo…
The JSON object contains the
- vertices
- faces
- skeleton structure (bone hierarchy)
- vertexgroup definitions (weighted assignment of vertices to bones)
- animations stored in channels (can be quaternion and/or position bezier curves)
The skinning and lighting is done entirely within the vertex and fragment shaders. Just the pose matrices are calculated in JavaScript – they are then passed to the shader where the actual skinning takes place.