Blender 2.79a (64bits) with GPU Hardware Skinning patch

Hi,

Here below you will find a blender 2.79a (64bits) with the GPU Hardware Skinning patch from Moguri’s thesis (Mitchell Stokes) https://github.com/Moguri/blender/commits/thesis

Blender-2.79a-64bits-GPU-Hardware-Skinning: https://mega.nz/#!41simAaI!iUgnyBzVx…3Tq8mukaSLClJw
Version 2.0 with more bones availables (1024 uniforms until 64 bones, 4096 until 128 bones):
https://mega.nz/#!1wdAGZqI!bmHsuJvCmodk3cRsLsSbDsQoTbJefS6DE8CF_WkVTNM

NOTE: You have to set the following settings:

  1. In render panel:
  • Always GLSL
  • Always Vertex Array as Storage type
  1. In Armature panel:
  • Select BGE GPU as Deform

WARNING:
You have as maximum 128 bones per character (I think that more than enough for current state of art) but this is the maximum fixed by blender sofware.
Additionally, you will have a graphics card maximum. I mean, you have:

  • A matrix with bones movement with a (4 x 4) dimension = 16 uniform components per bone
  • N bones per character.

Then you use the maximum: 128 bones * 16 components = 2048. If you have a more or less recent NVIDIA card you will have 4096 components available, if you have a less recent or low card or ATI card you will have 1024. (For example, my Nvidia 940m has 1024 only)

Then if you have 1024 component you will have as maximum 64 bones but you would spend all the uniforms (you need them for other things too). Internally, BGE is configured to reserve half of all uniform.

After all this story :-), I summaryze:

If you want that the GPU hardware Skinning works in almost “all” the hardware then use 32 bones or less per character.
Anyway, Internally is coded to use skinning by software if the graphics card doesn’t have enough uniform availables.

can we pass a table of bones as 1 uniform?

is there a CList or something equivalent in a GPU?

now that things have changed a bit, would this be better redone by a compute shader?

was reading this - https://turanszkij.wordpress.com/2017/09/09/skinning-in-compute-shader/

Hi, this sounds cool. I tested with a few models from blendswap, but it’s hard to find a model rigged and animated with less than 32 bones where we can see well the performance difference. Do you have a good test file for GPU skinning? Anyway, thanks very much for your work and shared build! I’ll retry later to find good models.

Hi,I’m going to increase the number of mínimum bones removing the reserve of half uniforms. I will upload later.

here test my guy.i get a framerate of thirty.look at the vertex count.

Attachments

guy.blend (3.55 MB)

My computer is hewlett packard computer
with a amd E1-2500 APU with Radeon™HD graphics 1.40Gz processor.

@lostscience/lordloki: wow, indeed, with this model the performances difference is impressive between CPU and GPU, that’s amazing

EDIT: Maybe this could be used to rig some vegetation. I’d maybe try some day.

thankyou but we should try it out on enemies added with the add object actuator.

78 characters, 10 bones each, 3 millions triangles, 37 fps with a nvidia 940m

Attachments


I tested four of mine and the framerate stayed at thirty.

with 36 animated man models I get a framerate 28.

This build has not reserved the half of uniforms for BGE. Then if the graphics card has 1024 uniforms you could accelerate until 64 bones, if the graphics card has 4096 uniforms you could until 128 bones. Anyway que you will have to leave some uniforms free.
New link: https://mega.nz/#!1wdAGZqI!bmHsuJvCmodk3cRsLsSbDsQoTbJefS6DE8CF_WkVTNM

Do you know how to install this on Upbge 0.2.3?
Is there any download as an addon?

This is not an addon and it can not pass to upbge without a high sources modification.

Anyway, GPU hardware skinning will be implemented in next upbge 0.2.5. You will have to wait a bit (3-4 months max)

1 Like

all of the links don’t work!

1 Like

this is literally ancient history. ask around the current upbge builds threads or join the upbge discord. lordloki hangs out there and is still working on upbge.

2 Likes

Here is a working link: https://mega.nz/file/JxsDzb4a#wOqJyTO9aRDfaziI3_VUL17aAxcvP20u2lmm-CrwU2U

This build has blender 2.79a + GPU Hardware Skinning patch + Joystick hotpluggin

1 Like

thanks btw is there any possible way to have GPU Hardware Skinning on upbge 0.3.0 ???

I was thinking about this

we could add a little note to the vertex shader

//this is where we want to insert uniforms

and another note just before the final output of the vertex

//this is where we would offset the model

and then finally, editing the gpu module to save the shader vert and frag source as a text

material.frag
material.vert

the dev can then do
string1 =material.frag
string2 = material.vert
uniforms = “uniform data”

string2.replace("//this is where we want to insert uniforms
",uniforms,1)

and then we can compile the shader sources → replace the material with the new copy

I’m a little surprised this hasn’t been implemented into UPBGE/Blender 3.0x, it’s been years since 2018. You can actually add a metarig cat and the moment you click on any bone, it will cause a like 50% chance of a crash due to the fact its done entirely on CPU, not GPU.

Even on a powerhouse computer like the M1 iMac, the chance of crashing due to rigging is still the same as on a PC. Blender and UPBGE are both great pieces of modelling software, but the CPU-skinned armatures are what holds them back from being truly great for animators and people who design rigged models and game designers.

This is why I have also come to dread rigging in Blender/UPBGE because of the crashes that are associated with it because there is no GPU hardware skinning that patches out the crashing - the crashes are caused by the app simply running out of memory due to CPU-drawn armatures that eat up a lot of RAM and use a high amount of CPU power. GPU hardware skinning would reduce these crashes a tremendous amount by making the workload be on the GPU’s side, while the CPU handles something else related to bones. Currently, the workload is entirely shoved on the CPU, constantly draining the RAM of the app, and this leads to a crash.

I don’t design apps, but I think UPBGE/Blender definitely both need this feature of GPU hardware skinning. It’s version 0.3.6 of UPBGE and we still have no sign of the feature really, just a few prototypes.

It would be nice to see it being implemented kind of soon, and it has been marked as a high priority feature, indicating it could be in version 4.0, I guess.

The reason I prefer UPBGE over other game engines is because its free, easy to learn, easy to master, efficient, and has an internal player and you don’t have to build the game - you can just press P, or use Blenderplayer to launch an external window to test, which is useful if UPBGE starts crashing in a certain part and you need to fix it without crashing the main app, or running out of RAM in the internal player.

The only disadvantages to UPBGE are the random crashes that may occur when editing (I have seen a few of these get ironed out over time), and the CPU-skinning of armatures, which is where the real issue lies, as it breaks the modelling process of rigs.

If UPBGE didn’t autosave every couple of seconds (or minutes), you would lose everything since your last save. This used to happen in versions before 2.5, so UPBGE and Blender have both come a very long way.

GPU skinning would be the cherry on top to stabilising an app that is nearly out of the alpha phase, as UPBGE has been in alpha for a very long time ever since 2.8, which depreciated the entire legacy BGE and threw it in the graveyard, which disappointed me, since I love UPBGE and want to see it expand.

The future does look bright for both Blender and UPBGE as a whole. I have seen Blender go from being a crash-prone Windows XP app in 2.45a to being an app that is actually really good for special effects and making your own animated GiFs and animations in 3.3 LTS. While UPBGE is still rather like a rickety bridge in terms of stability, it is slowly getting better over time. The only issues that really stand out now are occasional crashes and the CPU-based rigging that can really make UPBGE and Blender freak out and crash due to running out of memory. It’s not lines of code that you may think at first, but CPU and RAM, so placing this into the task of the GPU would prove to be a massive benefit to both the user and the app in terms of stability and internal/external player speed. It’s a win-win for Blender and UPBGE. I hope UPBGE excels in the future. :blush: