Pivot lag?

Blitz3D Forums/Blitz3D Programming/Pivot lag?

Sake906(Posted 2009) [#1]
Something strange that draws me to come here and ask...

On our robot sim, our units normally create a bunch of pivots for many different referencing reasons, most of them are placed at 0,0,0 (vectors, item indexing on naming refs applied to pivot hierarchy, etc). This same thing is also applied to the weapons they shoot.

The problem is... when my camera looks at 0,0,0, this slight lag is noticeable, and was also noticeable when the camera looked at areas where lots of pivots hadn't been cleared (I made a careful memory leak check just now). Even with the memory leaks removed, there is still a vast amount of pivots created mostly at 0,0,0 during gameplay which are needed to exist for said referencing reasons.

What gets to me is this slight lag that happens even if no mechs are present.. it is like something exists right THERE that you cannot see but that is causing grief, I even went as far as replacing the CreatePivot function with one that returns cubes instead (after the world is cleared, only 11 entities remain which are the ones that should exist after clearing it anyway)

I know this happens at 0,0,0 because also when the camera moves away from this point, the lag stops happening even if there are still mechs nearby. Lag also manifests no matter from which angle you look at this spot... I imagine it as some kind of Medusa that petrifies you if you dare to look at it.

Anyways, just wondered if you are aware that pivots may lag if placed on vast amounts (hidden or not... though would be ridiculous that a completely empty entity causes rendering grief...) and if pivots are not responsible of this then I should stop blaming it on them and look at other possibilities that might be causing this.

Another note worth mentioning... plenty of cached meshes are placed there but hidden, could it also be the hidden meshes?


puki(Posted 2009) [#2]
Everything you load and create will default to 0,0,0 - so the idea of congestion is probable.

Merely hiding them may not be sufficient - as Blitz3D still knows they are there.

If you have to concentrate the camera on 0,0,0 - then you are best moving everything that is loaded or created to far away from both 0,0,0 and also outside of camera view, then move them back when needed.

I could be wrong - but I am suspicious on this.


Sake906(Posted 2009) [#3]
I believe the problem is based on the fact that, as you said puki, Blitz3D still checks through them even if they are hidden. Sadly there is no way to tell Blitz3D to completely ignore entities -at all- unless you want to unhide them (something like a "hidden mode 2")


puki(Posted 2009) [#4]
How many pivots are there?


Sake906(Posted 2009) [#5]
I am embarrased to say that an average mission drop with about 12 mechs has around 200 of these pivots, not counting hidden cached meshes.


puki(Posted 2009) [#6]
Don't automatically create pivots. Apply them per mission, per mech. Use pivot skeletons and reuse them each time.


Sake906(Posted 2009) [#7]
That is what I'm doing... only fixed pivots are about 11 to 15. I will try to do a test application to see if hidden entities or pivots cause such lag on a raw 3D space with a camera. Will post the results later.


cyberyoyo(Posted 2009) [#8]
I use multipurpose pivots too, but 200 is way too many.


Sake906(Posted 2009) [#9]
I moved the cached meshes to a very far position and it seemed to fix the problem a bit.

The test I mentioned... failed miserably at it (no lag showed even with 200 anim-meshes loaded and hidden at 0,0,0 ... )


Adam Novagen(Posted 2009) [#10]
I use multipurpose pivots too, but 200 is way too many.


Since when?? I've had over 300 pivots onscreen at once on a ten-year-old machine with 8MB Gfx memory, with no detectable problems.

Sake906, I think there's something else going on here, although unfortunately I've no idea what.


Ross C(Posted 2009) [#11]
To be honest, i've had 5000 on screen at the one time, before i just decided to use the one. A pivot should not cause rendering lag at all. Hidden or shown, as they are never rendered. Best thing to do is to create a type object for each pivot, or an array, and when you need one, access it's rotation/position, and apply them to the one pivot.

Another question. Are you creating and deleting type objects regulary?


Sake906(Posted 2009) [#12]
Not really, but they are being updated with some local movement information... Though this still does not explain why things lag a bit when I look at that certain position of the 3D space.


Ross C(Posted 2009) [#13]
Can you show some code to reproduce this please?