Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skeletal animation demo #186

Open
mikolalysenko opened this issue Aug 1, 2016 · 11 comments
Open

Skeletal animation demo #186

mikolalysenko opened this issue Aug 1, 2016 · 11 comments

Comments

@mikolalysenko
Copy link
Collaborator

It would be cool to have a demonstration showing how to implement something like skeletal animation/vertex skinning on top of regl. There is a half baked version on the skeleton branch currently, but it is currently blocked by the collada parsing being incomplete. If we can fix that up, then making a demo shouldn't be too hard.

@chinedufn
Copy link

chinedufn commented Aug 4, 2016

Here's the issue for fixing the parser -> chinedufn/collada-dae-parser#3

EDIT: This was not the actual issue!

@chinedufn
Copy link

chinedufn commented Jan 2, 2017

What was wrong

So it turns out that the issue was my ignorance of control (non-deformation) joints like IKs, pole targets, etc. It turns out that the collada format doesn't do much to support these.

The model that we were trying to use had these types of control joints, so it just didn't work when we tried to use it a few months ago.

The parser will now throw an error if you attempt to use a collada file that contains control joints. Instead, you must first bake the effects of your control joints into your deformation bones

Path Forward

We already have a reference vertex shader and fragment shader so we'd effectively be copying and pasting them into a regl program.

@crobi
Copy link

crobi commented Jan 26, 2017

From my experience, COLLADA is the worst possible format for loading assets because it's so insanely complicated (it's only great for exchanging assets between applications). If it's for a demo with a single hardcoded model, consider something like GLTF.

I wrote my own COLLADA loader/converter that loads a COLLADA file and exports it to a custom JSON+binary format that's super easy to parse in browsers. See this live preview and the github repo.

The live preview renders animated models, and I also have a highly experimental branch with support for animation blend trees (see below image for an example of smoothly blending between standing/walking/running animations). Feel free to have a look at any of this and scrap any usable code from it.

blendtree2
I bought the model from bitgem.com, so I can't share it

@vorg
Copy link
Contributor

vorg commented Jan 26, 2017

I would second glTF. Here is a glTF repo with sample models

@kevzettler
Copy link
Contributor

@chinedufn what are your thoughts on adapting: https://github.com/chinedufn/skeletal-animation-system to use regl? I was just considering this but haven't wrapped my head around it yet.

@chinedufn
Copy link

@crobi @vorg for sure for sure, wouldn't hurt to have examples for how to deal with both file formats though. But yeah just a question of where to start.


@kevzettler if you're interested in doing that I'd be happy to answer any questions / provide advice on how to get started / help in any way that I can.

@kevzettler
Copy link
Contributor

kevzettler commented Mar 5, 2017

I ported @chinedufn 's skeletal-animation-system. To regl see:

chinedufn/skeletal-animation-system#3

I am interested in feedback on the demo and further discussion here.

We could use that as the example. It is a good start, but I feel there is room yet for a more simplified example. The skeletal-animation-system demo has code for texture support, a camera, and dual quaternion animation joint blending. I can picture a more simplified demo with a single, untextured, animated skinned mesh.

Additionally, I feel the Blender -> collada -> regl/WebGL work flow is not the best learning example. I started it on a personal model and found the manual conversion of IK joints to deformation joints to be real tedious.

On the topic of GLTF. Khronos group is currently requesting quotations on a contract project, to build a Blender -> GLTF exporter. See: https://www.khronos.org/rfq/request-for-quote-blender-gltf-exporter . You could build out the exporter and test it against regl. It could be a good regl mindshare building opportunity.

@donmccurdy
Copy link

the Blender -> collada -> regl/WebGL workflow is not the best learning example

The glTF Blender exporter is now in alpha, and does support morph targets: https://github.com/KhronosGroup/glTF-Blender-Exporter/

@donmccurdy
Copy link

Does the skeleton branch mentioned in the OP still exist somewhere?

@kevzettler
Copy link
Contributor

kevzettler commented Aug 6, 2020

@donmccurdy if you're looking for regl skeletal animation support I did put together a demo for the skeletal-animation-system module at:
chinedufn/skeletal-animation-system#3

I'm not sure why it was removed form the master branch of the repo but it was working with at skinned model. I currently use regl for skeletal animation in a similiar manner in an ongoing project

@chinedufn
Copy link

I don't quite remember why I removed it, but I think I was planning to re-write the demo site for some reason but then I changed languages and stopped using skeletal-animation-system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants