Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Is it possible to support skeletal animations without shaders?  (Read 2071 times)
0 Members and 1 Guest are viewing this topic.
Offline gouessej
« Posted 2013-10-18 18:34:50 »

Hi

I know that some Java engines that rely on several Java bindings for the OpenGL (and OpenGL-ES) API support skeletal animations with the programmable pipeline. I know that there are less and less graphics cards not supporting GLSL. I'm interested in skeletal animations and I wonder whether it could be implemented with the fixed functions. I already know how to support key frame animations with the fixed pipeline. Has somebody already done that? My main concern is that storing one mesh per frame can require a lot much memory than storing the data of bones and joints for each frame. If the support of such animations is too difficult to implement with the fixed pipeline, I'll go on using key frames.

Offline badlogicgames
« Reply #1 - Posted 2013-10-18 18:40:43 »

Sure it's possible. The process is quite the same. Calculate all bone matrices on the Cpu, then instead of applying them via a vertex shader on the Gpu, apply them to the vertices on the Cpu, the upload the transformed vertices via a vertex array or streaming vbo. Note that on some GL ES chips there's a matrix palette extensiom available for fixed function, probably available on some desktopm gpus as well. Bit limited.

Downsides to Cpu side skinning: transforms are usually slower, and you need to reupload transformed vertices for each model instance every frame.

http://www.badlogicgames.com - musings on Android and Java game development
Offline gouessej
« Reply #2 - Posted 2013-10-18 21:57:51 »

Thank you for your reply. I already have to modify the morph mesh every frame most of the time when using key frames. What is this palette extension? How can it be useful to support skeletal animation?

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline badlogicgames
« Reply #3 - Posted 2013-10-19 19:38:33 »

The matrix palette extension allows you to upload multiple matrices and the have the gpu transform your vertices with them. all in fixed function.

ahain, not worth the trouble. transform on the cpu, then upload just like you do with morphs. eventually switch to the programmable pipeline Smiley

http://www.badlogicgames.com - musings on Android and Java game development
Offline RobinB

JGO Ninja


Medals: 44
Projects: 1
Exp: 3 years


Spacegame in progress


« Reply #4 - Posted 2013-10-20 20:25:38 »

The problem is, that when you use no shaders, you need to transform every vertex on the cpu, making it really slow.
I have tried this approch, it took 0,5 ms to rebuild a simple model, imaging how slow this would be with more and more complex models.
Combine this with older cards, and your game is unplayable.

When you send at least the transformation matrix to move and rotate the vertrices for each bodypart, this slowdown is completely gone.
Then you only need to calculate its start position and send other data to the shader.

Offline gouessej
« Reply #5 - Posted 2013-10-22 17:49:08 »

Thanks RobinB. Supporting skeletal animations without shaders seems to be not worth a try.

Offline Nate

JGO Kernel


Medals: 149
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #6 - Posted 2013-10-22 18:40:17 »

Spine will do skeletal animation with 2D meshes on the CPU, but the mesh only has a handful of vertices (well, as many or as few as you like).

Offline EgonOlsen
« Reply #7 - Posted 2013-10-22 19:47:33 »

Thanks RobinB. Supporting skeletal animations without shaders seems to be not worth a try.
Most of the complexity in models and animations that you are able to achieve on an amateur level will work perfectly fine using the CPU. Half-Life did it's skeletal animation on the CPU and it worked fine on machines with less power than any current smartphone has (even when using the high definition pack for the models).

Offline gouessej
« Reply #8 - Posted 2013-10-23 11:34:59 »

Most of the complexity in models and animations that you are able to achieve on an amateur level will work perfectly fine using the CPU. Half-Life did it's skeletal animation on the CPU and it worked fine on machines with less power than any current smartphone has (even when using the high definition pack for the models).
Ok but if my implementation doesn't scale (I'm not Carmack after all), it will be useless for Ardor3D. My models are usually composed of hundreds of vertices.

Offline ClickerMonkey

JGO Coder


Medals: 20


Game Engineer


« Reply #9 - Posted 2013-11-16 22:00:38 »

I currently use the old method of:

1  
2  
3  
4  
glPushMatrix();
glMultMatrix( boneMatrix );
// draw limb and all child limbs
glPopMatrix();


Only works nicely for models where each vertex only belongs to a single bone...

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline HeroesGraveDev

JGO Kernel


Medals: 269
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #10 - Posted 2013-11-16 22:12:44 »

This was one of the projects I was just working on (although in 2D).

I'd say that skeletal animations are easier to do with immediate mode (or display lists) rather than the programmable pipeline, but obviously not as efficient.

This is basicallt how I did it.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
class Joint
{
    public void render()
    {
        //Rotate here
        bone.render();
    }
}

class Bone
{
    public void render()
    {
        //Draw from [x, 0, z] to [x, length, z] or similar
        //Translate to [0, length, 0]
        for(Joint j : joints)
        {
            glPushMatrix();
            j.render();
            glPopMatrix();
        }
    }
}


I'm not sure how you skin the skeletons (are the skins static on the bones, or do they stretch between them), but I think any problems could be solved with interpolation.

This method is however not very efficient, and can't handle many skeleton before you start to get lag.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (37 views)
2014-10-17 03:59:02

Norakomi (28 views)
2014-10-16 15:22:06

Norakomi (24 views)
2014-10-16 15:20:20

lcass (27 views)
2014-10-15 16:18:58

TehJavaDev (52 views)
2014-10-14 00:39:48

TehJavaDev (54 views)
2014-10-14 00:35:47

TehJavaDev (42 views)
2014-10-14 00:32:37

BurntPizza (64 views)
2014-10-11 23:24:42

BurntPizza (36 views)
2014-10-11 23:10:45

BurntPizza (77 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!