i had make a system that basically replace the action as a shadow.
ie, very shortly the actions continue to update all layer, and all frames, but the bones are update only if the armature is visible .
i have used 2 check :
distance to camera(is actually at 50mt) and sphereinsideFrustum(5.0 mt)
to me seem particularly useful if you have game with many characters (with relatively complex armature as humanoid)
the function for this check is out of class to make it more visible since the value can be too low, etc
that is the blend, switc the variable OPTIMIZED to 0/1 to witch mode, and see the differences.
press WSAD to move the camera
PS: the speed is tic-based actually anyway can be changed(just i fear that cost) AAAAA.blend (121 KB)
Interesting idea, I’ll have to make something similar myself. It’s such a waste to process animations for objects off screen and animations are one of the biggest bottlenecks in game right now.
yes, also if the more recurrent bottleneck is ever the rasterizer, it is simple to “adjust” with few clicks (ie removing lights or other eye candy stuff)
while the animations require much more work (afaik)
and is frequently the bottleneck
PS: anyway that system work only for armature that has not physic object parented or that has some task matter (since as the bone is stopped is stopped also the object attached)
…added the code to run frame time-based (framerate fix at 24.0) , plus priority of animation and layer_wheigt…all seem working correctly but not tested yet on a “normal game” , it need to be fast, but also overall simple to use!
Just a note about this, removing lights if you have a lot of them don’t actually decrease the time needed to render the graphics.
The way it’s set up in the engine, the shaders are compiled to take every light in the scene into account from the get-go even after the object is deleted, the way to resolve this would be actual source changes that either recompile the GLSL for every light added or removed or intelligently add or remove instructions from the program.
i know that add or remove new light obj in runtime not change absolutely NOTHING O.O (better so, “move” the current light present, rather than add/remove)
(but i was not sure if is a problem of PC/graphyc card/driver …or current behaviour of blender)
if is not wasting slow, will be better recompile something