Hardware Skinning

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Hardware Skinning

Post by BlindSide »

So I've started diving into the unknown world of Hardware Skinning (Animation done in vertex shader so that you dont have to keep uploading vertices to the GPU, useful in conjunction with VBOs).

This is my process as of now:

1 - Filter through meshbuffers, set all vertex colours to 0.

2 - Filter through joints, set all vertex colors to the corresponding joint id. If the first component is taken then the second component will be used (and the third and the fourth), this will result in an even split between each bone, a 50/50 (or 33/33/33 or 25/25/25/25) weight distribution (No we are not talking about Toyota MR2s) between the joint transformations.

3 - Recieve vertex color in vertex shader and perform operations based on said vertex color.

Heres a screenshot of a mesh (Set up for rigid animation, that is only one weight per vertex), showing varying light intensities based on joint id, slightly intensified so that the differences are more noticable:

Image

Expect a working implementation sometime soon :D

Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

nice work :)
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

thinking about, ignore what I said about animating the mesh in the shaderCallback, the mesh should already be animated correctly as it gets drawn just pass the animated joint matrices :)
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

Nice work. :D
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

Blindside's hardware skinning is now working well, both in dx and openGL.


Image


at least on my machine the hardware skinning is not much faster then software skinning, but that's what we expect, till we get VBO support. (please give some input: http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24832)
SwitchCase
Posts: 170
Joined: Sun Jul 01, 2007 11:41 pm
Location: Manchester, UK

Post by SwitchCase »

Nice work BlindSide. So you figured out the passing the matrices? or was it something else?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Cool. Is it all nicely tied in with SkinnedMesh so it could be automatically activated when supported? What are the big things that need to be done? Would all the materials need to be rewritten to work with it so the vertex shader can be easily swapped out?
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

it all fits in nicely with skinnedMesh, no real changes to the engine were needed. (expect a bug in the opengl driver)
What are the big things that need to be done? Would all the materials need to be rewritten to work with it so the vertex shader can be easily swapped out?
yep, that's about the only thing that's needed.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

SwitchCase wrote:Nice work BlindSide. So you figured out the passing the matrices? or was it something else?
Yeah, Luke fixed a bug concerning passing multiple matrices as a uniform in OpenGL (Irrlicht was using the wrong address). Everything after that worked pretty much flawlessly.
Would all the materials need to be rewritten to work with it so the vertex shader can be easily swapped out?
That may not be the case, I'll have to tinker around more with how the vertex shader passes its variables to the pixel shader. If I can get the setup similar to the fixed function pipeline (Which is all emulated by shaders ever since PS 2.0 like came out), then theres a good chance that the original materials would slot right in.

This may require placing some levels of seperation between pixel and vertex shaders in Irrlicht though, this would help later when people only want to set a pixel shader to a skinned mesh that already has a vertex shader applied.

Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Ok update, I got it working in both OpenGL and DirectX using only the vertex shader and supporting up to 8 coloured lights and 55 bones.

Heres a screenshot (It is identical in both OpenGL and DirectX ;) ):
Image
Oh... mspaint seems to have crappy JPEG compression, oh well you get the idea (This shot is from OpenGL btw).

The next big problem comes in supporting ATI hardware, I'll start work on that tomorrow.

EDIT:

Ok so I started testing which kinds of basic material types would work alongside this vertex shader. Things like sphere mapping and reflections dont, but most basic material types seem to be ok, like detail mapping:
Image

and transparency:
Image

Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Ok reflections and stuff work fine with a slight modification of the vertex shader, so a different version could be provided for those material types.

Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

From looking at this, Hardware skinning is implemented? Can someone update me on this?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Good question. It seems that BlindSide has many interesting things on his machine, but did not integrate them into the main engine so far.
fmx

Post by fmx »

Blindside uploaded a working implementation of this (I think it was this) with sourcecode on one of my project topics
http://irrlicht.sourceforge.net/phpBB2/ ... 097#233097

direct download
http://irrlichtirc.g0dsoft.com/BlindSide/HWSkin.zip

The framework currently allows hardware skinning to work correctly with Luke's system without modifying the irrlicht source (as long as the number of bones is really low) but it's still a hacky solution at best relying on vertex color stream to store joint indices.

I seem to be saying this a lot recently, but irrlicht's restrictive vertex formats are hindering any potential of updating the character system to take advantage of modern technologies
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

fmx wrote:I seem to be saying this a lot recently, but irrlicht's restrictive vertex formats are hindering any potential of updating the character system to take advantage of modern technologies
Seconded. I know Irrlicht is designed as a fixed-function pipe engine first and a shader-based engine second since it promises to work across a broad range of hardware, but it could seriously use more flexible vertex support. I'm not going to run off to some other shader-based engine; I love Irrlicht and its simplicity. I (and others) would just like to see better support for modern graphics methods.

Devs, what can be done about this?
Post Reply