Fastlibs + Blitz Sprites = huge slowdown?

Blitz3D Forums/Blitz3D Userlibs/Fastlibs + Blitz Sprites = huge slowdown?

Vorderman(Posted 2010) [#1]
I'm using Fastlibs (FastExt and FastText) and I've noticed that adding just 4 Blitz3D sprites to a scene causes my framerate to be absolutely hammered.

The test scene is very simple, not many polys, doing nothing out of the ordinary apart from using FastExt to render a realtime cubemap onto a metal ball. It runs at a fixed 60fps until I add these 4 B3D sprites, at which point it almost stops.

Now I've usde B3D sprites before and normally having hundreds of them is no problem, but using FastExt it appears that having just a few of them is causing some huge slowdown.

I've noticed the same thing in SRX (Stunt Race, my main WIP!!) - with 4 sprites for the start lights the framerate plummets. Remove these (or replace them with quad meshes) and it's back at a solid 50fps. I know it's not "on the edge" of performance as it can quite happily have 7 other full-Tokamak cars added and racing around and still sit at 50fps, but adding the 4 sprites causes the slowdown.

Anyone have any info about this?


MikhailV(Posted 2010) [#2]
You hide/disable sprites, when render a cubemap? Check FPS with classic cubemap rendering without FastExt (and try use quads instead of sprites).


Vorderman(Posted 2010) [#3]
OK, I'll check out what happens when I hide them, but I don't think that's the issue - SRX is not rendering any cubemaps (the only effect it's using is either the new Rays effect or the older bloom effect) and that also suffers massive slowdown with only 4 B3D sprites present. I noticed also that using EntityOrder on the sprites makes things even slower.

I'll do some more tests and see if I can work out what combination of elements causes the slowdown.


Vorderman(Posted 2010) [#4]
Yeah looks like in my first test program that it's the combination of sprites and render-to-cubemap - as my realtime-cubemapped reflecting object passes close to the sprites it becomes even slower.

Very odd - I can have 10 objects all moving around generating their own realtime cubemaps with no slowdown, but with just one of these objects and 4 sprites the framerate takes a big hit.

This still doesn't explain why SRX slows down with only 4 sprites present as it's not rendering any cubemaps - it is rendering the post-FX screen overlays though - should B3D sprites be hidden for this?


MikhailV(Posted 2010) [#5]
It is difficult to me to give advice without having source files. Probably you reach the fillrate for your videocard pipeline. I recommend to make a small example (with and without FastExt).


Vorderman(Posted 2010) [#6]
It's not the fillrate / video card - I can add loads of stuff into the scene (even having Fastlibs rendering 10 realtime cubemaps onto high-poly spheres) and maintain the framerate, but 4 B3D sprites causes slowdown. If I get a chance I'll do some more investigating and see if I can produce a small example.

I wonder if there's some underlying B3D sprite problem here...


Vorderman(Posted 2010) [#7]
OK, the simplest example is as follows:

add this code to FastExt_Example_RenderCubemap.bb just before the main loop:

For a=1 To 4
	sprite = CreateCube()
;	sprite = CreateSprite()
	rad# = 1.0
	PositionEntity sprite , Rnd#(-rad#,rad#) , Rnd#(-rad#,rad#) , Rnd#(-rad#,rad#)
	EntityColor sprite , 64,64,64
Next


Then swap between CreateCube and CreateSprite - for the cubes my framerate remains at over 500, for the sprites it drops to about 200, which seems like a huge drop for what should be essentially just 4 quads. With 30 sprites my FPS is under 50.

This is on a Quad Core 3ghz PC with 4gb Ram and a 9800 GTX.


Vorderman(Posted 2010) [#8]
Never mind, it seems to be a Blitz problem - with a clean install of B3D 1.64 1000 sprites = 60fps. Update that to 1.104 and the same program gives 8fps.

That sucks.


MikhailV(Posted 2010) [#9]
OMG o_O
I am glad that my library is not guilty.


Vorderman(Posted 2010) [#10]
No, your library is excellent Mikhail! Thanks for your continuing support and development of it.

Too bad nobody seems to take the same interest in the apparent massive speed decline in B3D...I'd better go through SRX and remove any use of Blitz sprites I suppose, which is a shame because they are very handy for certain things.