High texture count

That’s weird indeed. so for one character you have multiple armatures right?
How do you import your models? (from blender? with ogre workflow?)
Imo the best thing to do is to edit the armatures in blender so that there is only one for a model.

I’ve recently noticed some weird behavior of clone().
Cloning a spatial with several geometries, particles and particleControls results in additional particle controls in created spatial.

@Darkchaos: do you use clone() ? Check if the source model have proper skeletonControls and if the colne’s result have the same.

Here I have two images.
I use some clone() but this is way before cloning and I guess I am only cloning Vector3f aswell.

It’s using BlenderImporter and in Blender I also only have one Armature.
I tried to Join the Meshes but then I don’t seem to have seperate Geometry anymore (as I need them to switch the clothes dynamicall on/off).

You can also download the blend file from the 3.1 bug thread to see it.

I could “fix” the problem with the multiple SkeletonControls and it improves the performance really well, reset is still consuming quite some CPU.

There is no check made to stop reset when HW is enabled.
On the other hand it seems necessary to correctly apply the Animation?

btw: I guess you don’t have that part in controlRender to be consistent? (When a player is looking away and on again, the animation should have processed, not “paused” somewhat)

Yeah reset skeleton is needed even for HW skinning. That’s the reset of the buffer that is not needed. I though you were talking about this one.

I don’t understand your question

Well I thought you could make those Calls culling sensitive, because you don’t need a walk animation when it’s culled.

However for some Animations which take long (a Monster which evolves or a any complex process) the animation should be played, so you can’t have it culled.

I think I might need my own control for it (CulledAnimationControl) I only wonder how I could “cast” an existing AnimationControl into my derived class?

Edit: Something like this in AnimControl:

private boolean animateOnCulled = true;
public void setAnimateOnCulled(boolean b)
    animateOnCulled = b;

public void controlUpdate(float tpf)
    if (!animateOnCulled)
    // original code

public void controlRender(float tpf)
    if (animateOnCulled)
    // The same code as in controlUpdate.

The thing is, if I have say 150-200 spatials being animated and roughly half of them is behind me, this stresses the CPU unnecessarly.

The question is, if such a change is wanted, though, because most people will neither care nor really profit for that.
And if you have some animation (like a castle’s bridge being opened) which takes long, you would notice that the animation does not take place in the backgound.

mhh… Skinning models when they are culled seems unnecessary indeed…
@Momoko_Fan what do you think? Isn’t there some corner case where it’s useful?

There is, imagine you are watching a slow animation, don’t know, a driving train or a catapult being tensioned.

When you look away and then look again, you’d expect it to be moveD.

Or An animation which would move itself in the field of view and hence become unculled.

Thats why I used a boolean.

Actually it is possible to do this while keeping track of time.
The contents of controlUpdate in AnimControl need to be moved to controlRender, then make sure it only runs once in a frame (same way as SkeletonControl does it).
To keep track of time that passed while the model was culled, you need to be able to detect controlUpdate invocations that were not followed by a controlRender invocation, and have some sort of “accumulated time” variable.

1 Like

Here’s the actual algorithm… Good thing our animation loop mode handler can handle huge time deltas, so even if the model was culled for several minutes it should still animate properly in the end.

float timeAccum = 0;

void controlUpdate(float tpf) {
    timeAccum += tpf;

void controlRender() {
    if (timeAccum == 0f) return;
    // update skeleton for timeAccum time
    timeAccum = 0f;
1 Like

Shouldn’t we do something along those lines in core?
I mean it’s not a particular case IMO.

There are some nuances to doing this, it turns out to be quite difficult …

  • If attachment nodes are used, they cannot be updated after culling because attached items change the model’s bounding box which influences culling.
  • Animation event listeners expect to execute during the update process in the same frame as the animation ends. If the model is culled, this event is only triggered on the next frame after the animation ends which is incorrect from the point of view of the listener.
  • Other types of animation might be used, like audio effects, those expect to run even if the model is culled.
  • The skeleton must be updated even if no animation is used, in case IK or ragdoll is used.