Upbge 0.3 Gpu instancing, animations, particles

For Blender duplicated objects using “instance copy” , can Upbge take advantage of hardware instancing ?
When you target modern graphics you target a minimal DX11 3D card like GTX 960.

For my curiosity, is regular armature animations getting GPU skinning from Upbge 0.3 ? as i read somewhere it was still CPU.

Also is Upbge particles addon (EasyEmit) using GPU ?
Or is there some plan to get GPU integrated particles from Upbge 0.3 ?

On our side, the plan was to use as much blender code as we can use to avoid to have to duplicate some code…
So we use eevee render… and blender animation system. One of blender targets as far I understood is to improve animation playback in a first time, then maybe improve animations “when no cache is desired” (I guess this means for realtime). I have no idea about the techniques which will be used but it’s possible that the gpu will be used to do part of the animation job…

Perhaps it’s better for compatibility and have less code changes to make with each Blender upgrades.

But it would be possible to have in Upbge custom addons or dll to play animations, do objects instancing or display particles using gpu.
When Blender get new changes, those addons would only need to check if some data format have changed, but all the process and display would be handled by Upbge custom code (like other game engines).

This way, Upbge having some engine features handled by it’s own code could open new possibilities, improve a lot performance or solve issues.
For example animated objects parenting in the editor is buggy, it would be fixed and stable if Upbge would have it’s code to manage objects parenting instead of relying in Blender code.

You can use object instancing in the viewport based on faces or vertex.

This works in upbge also.

There is also the ability to join meshes in game now using bpy so it’s like batching.

Also new builds have many of the bugs fixed (all of them as far as I can tell)

For example you create a tree model with textures and animations, you duplicate it in Blender editor to create your scene. When the game starts Upbge would be able to use Gpu instancing for displaying the trees models, so the scene could have thousand detailed trees without any frame rate slow down.
It is already available in Upbge ?

Yeah,

  1. Make a mesh
  2. Parent a “tree mesh” to it and hide it
  3. Go to parent mesh and in object property panel In property tab is instance menu select face mode, each triangle gets a instance.

Also particle instance work in the game engine you just can’t move the emitter etc

1 Like

For my curiosity, is regular armature animations getting GPU skinning from Upbge 0.3 ? as i read somewhere it was still CPU.

2.7 and 2.8 use CPU (Moguri did a work to have GPU skinning but it was not merged neither in bge, neither upbge)

Will gpu animations be merged in next Upbge update ?

it’s a very very complex topic - the animations themselves are done on the cpu (bone transforms)

it’s deforming the vertex that we need to happen on the gpu
but there is the concept of modifiers - so the GPU skinning modifier must be the last node in the stack I think.

what would be best is to add a new armature modifier - I think - to keep everything compatible / easy to do merges

yes. get bone matrices in cpu, array uniform in->vertex shader. calculate deformed vertex pos,

vec4 skinned = vec4(0,0,0,1)
for(int i=0;i<numbones;i++) { skinned += weights[i] * bones[i] * position; }

and out skinned verts pos/normals. cant remember if tangent & bitangent would be calculated at this stage. but you get the general idea. skinning in modern opengl is pretty straightforward in and of itself.

so the question is, how would you implement this in blender. i have no idea; inner workings too dutch. reading through moguri’s shader code its not too far off from what my engine did when animation was still skeletal. but the blender specific parts confuse me a lot.