Hi, I've been asking this feature but it's not fully ready now.
Blindside created a vertex shader that could do this and submitted it to the forum. The version submitted had memory leaks, that I fixed.
BlindSide used it only to check if it worked. Most of the code here are based on Blindside work and the class instancing trick came from Andres. FMX had removed the lighting from the test so we could really see the Skinning performance, that was really nice. So now you can choose to check with or without lighting.
I've made it work in Irrlicht 1.7.2 (Should also work on 1.7.1), and then created separate files to use as include, so we could only issue a simple command to activate that feature on our Skinned model.
So to use this with your own skinned meshes, you only need to do this:
1. Add the include:
Code: Select all
#include "HardwareSkinCallback.h"
Code: Select all
HWSkinCB::getInstance()->setupNode(device,dwarf);
Current performance on my system (EVGA NVidia GTX 460, 2,66Ghz Quad Core Intel, OS: VISTA):
Drawing 36 dwarfs (6 x 6)
OpenGL
494 FPS No vertex lighting + Hardware Skinning
170 FPS Vertex Lighting + Hardware Skinning
110 FPS No lighting + Software Skinning
108 FPS Lighting + Software skinning
303 FPS Skinning disabled
DirectX 9
585 FPS No vertex lighting + Harware Skinning
353 FPS Vertex Lighting + Hardware Skinning
121 FPS No lighting + Software skinning
---- Lighting + Software skinning not working (no lights on the model)
381 FPS Skinning disabled
Current limits:
8 Lights
80 Joints max for OpenGL
57 joints max for DirectX
[WARNING] - Blindslide shader code seem to work only on GLSL 4.0! (As my primary PC), tested it on my HTPC (Radeon 4350 - Pentium - Glsl 3.3) and the shader give 9 errors and fail to compile! Found out after Lazerblade message... We'll need to convert the shader to a lesser version of OpenGL as my current knowledge of shader is insuficient to do the task. Until then, the open GL version will only work on very recent cards... (I wonder how could shadowlair could have tested openGL?!)
Exemple set at 1/60 refresh interval for the shader callback. You can disable the refresh by putting 0 in the parameter. (milliseconds)
I've created an MSVC (2008) project with all the files (also the shaders). The shaders are (DX hlsl and GL glsl). I've tested them both and did not see memory leaks. The archive also contain a binary so it will be easier to check.
This would really take advantage of your video card shaders processing power, but It would be surely pointless to use on a old (before they came in unified architecture) or really weak (integrated). If your system can't run a recent game, then this will not give you a big improvement...
You can download it here: (1.48Mb) http://www.clavet.org/files/Hardware_Skinning.zip (Last update 26/11/2010)
Thank a lot to BlindSide and FMX for providing the code and the shaders!