Hardware Skinning
Hardware Skinning
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:
Expect a working implementation sometime soon
Cheers
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:
Expect a working implementation sometime soon
Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Blindside's hardware skinning is now working well, both in dx and openGL.
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)
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)
-
- Posts: 170
- Joined: Sun Jul 01, 2007 11:41 pm
- Location: Manchester, UK
it all fits in nicely with skinnedMesh, no real changes to the engine were needed. (expect a bug in the opengl driver)
yep, that's about the only thing that's needed.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?
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.SwitchCase wrote:Nice work BlindSide. So you figured out the passing the matrices? or was it something else?
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.Would all the materials need to be rewritten to work with it so the vertex shader can be easily swapped out?
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
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
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 ):
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:
and transparency:
Cheers
Heres a screenshot (It is identical in both OpenGL and DirectX ):
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:
and transparency:
Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
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
Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact:
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
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
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.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
Devs, what can be done about this?