Need Ideas to speed up renderworld()
Blitz3D Forums/Blitz3D Programming/Need Ideas to speed up renderworld()
| ||
I am currently in the finishing stages of a space invaders/galaxians style game. I displays roughly 20-80 enemy ships on the screen at any one time. The enemy ships are B3D models, the game also has a large number of particle effects and lasers done with standard sprites. After using Micheal Reitzen's (sp?) profiler I found out that the only real place for much speed improvment was at renderworld(). I have done many experiments, removing certain things and recording the speed gain (if any) and almost nothing seems to impact the framerate except not displaying as many ships. Due to the nature of the game I cannot really physically reduce the enemy numbers, but I was wondering if anyone knew any general ways to speed up the render of a model? I am pretty new to blitz and im sure there must be some undocumented commands which might help out. Thanks, -Nex |
| ||
If you have for example 20 entities that looks the same(uses the same mesh) make sure that they are clones of the original entity. This should make it a bit faster since the gfxcard would reuse the same vertexbuffer. |
| ||
If you can reduce the number of polygons contained in the models then it should make a big difference. Use the TrisRendered() function to find out how many triangles are being rendered during RenderWorld |
| ||
A single surface particle system is your best bet. |
| ||
The entities are already clones and using lower polygon models didnt really seem to help much. |
| ||
You need a single surface particle system as John said. It might be worth combining it with text if you are doing that with sprites as well. You could also try combining the ships into one or a handful of surfaces as well, attaching each one to a bone. It will be a balancing act between CPU processing and render time. |
| ||
Polycount is rarely the issue. Surface count seems to have a bigger impact. |
| ||
Screen fill-rate plays a big part as well, how large are those ship textures? ? |
| ||
Eeek! Don't use blitz sprites for particles - each one is a separate surface. Here's another vote for single surface particles for the best speedup. |
| ||
Alienhead, Texture size is nothing to do with fillrate. It's the size of the polygon on screen that matters, not the size of the texture. Textures are sampled so size is irrelevant. |
| ||
Use the "fast" flag. RenderWorld(fast=true) |
| ||
LOL |
| ||
Im not really sure how to go about doing single surface particles, or how to combine ships into one surface (each ship can move independently and so i dont think that would work?) Can someone give me a link to an article or tutorial on this? |
| ||
Single surface particles and single surface entity system: http://www.blitzbasic.com/codearcs/codearcs.php?code=978 Watch out cos it has a few bugs! |
| ||
1] - store all your texture data in one texture map.. 2] - group objects by material under root nodes, i created some test code for this + it seems to improve fps in some cases..though mainly for simple geometry.. though if you are storing all your images in one texture this is pointless... hmmm..are you using sprites or meshes..erg..if its sprites, single surface systems are the way to go.. - its a fine balance..state changes vs cpu vs upload time.. supposedly you can improve single surface performance by updating mesh data bursts..but this is sketchy & very system dependent..also, i dont know how blitz treats the dynamic vertex editing code..so it may be totally pointless :/ ok..um..that probably doesnt help...lol ;) |
| ||
Take a look here for more info: http://www.blitzbasic.com/Community/posts.php?topic=38845 |