Single Surface?

Blitz3D Forums/Blitz3D Programming/Single Surface?

For some reason, which appears to be specific to Blitz ( at least there are many similar languages/API's which do not exhibit this behaviour ) there is a pause when going from rendering triangles with one set of material properties ( texture, etc ) to triangles which use a different set.

At first it's not really noticeable and you usually don't notice the difference between 10 surfaces and 20 surfaces. But beyond a certain threshold ( which will vary wildly between cards ) each new surface really starts hitting your speed. General concensus seems to be that you shouldn't go beyond 100 surfaces at a time, and the lower the better.

So if you've got a particle effect on screen which displays 250 particles, you've got 250 potential surfaces from that alone. Now usually Blitz will auto-manage these things if you use CopyEntity or CopyMesh ( can't remember which.. entity I think ) but it doesn't seem completely reliable.

So to be sure you know how many surfaces are being used, you go over to a single surface system and ensure you have no more than you need. I haven't tried them ( I have my own which do all I need for the time being ) but Rob's single surface particle and entity systems seem like a good starting point. You can always modify them to suit your needs if there's something specific you need later.