dramatic fps drain when displaying 2d over 3d
Blitz3D Forums/Blitz3D Programming/dramatic fps drain when displaying 2d over 3d
| ||
Displaying my inventory and character's sheet requires drawing -let`s say it more or less- 40 or 50 icons (32x32 px), and 20 variables - displayed by a [Text X,Y,"Life: "+Life#] command, with no special font loaded - simultaneously. All this is done by a function placed inmediately after renderworld command: updateworld renderworld(tween#) updategui() ;Yes, I'm using tweening, but that's not the problem. I have already tried the game without tweening, and that made no difference If the inventory is closed, the game runs at 40 fps smoothly, as required. If inventory window is opened, the game runs at 20 fps. I think the problem is 2d graphics superposition over 3d screen. So here are the questions: Wasn't the Text command supposed to be real FAST? How come using it for displaying 15 variables reduces performance so drastically? Anyone has a particular method to display 2d images over 3d screen without losing performance? Thanks |
| ||
The text command on alot of machines, is painfully slow actually. And some graphics cards have a real performance problem mixing 3d and 2d. You could move to a 2d in 3d lib, like nSprite 2 or SpriteCandy. Failing that, try using images instead of drawing command. IE. draw your text to an image, then draw that to the screen, and see if it helps. |
| ||
Mixing 2D and 3D is slow on many graphics cards/drivers -- there's nothing Blitz can do about that. However, you can use 3D sprites which are scaled to be pixel-perfect. The free SpriteControl handles this for you, as well as providing lots of other features. |
| ||
Thank You Ross C, as usual clever and fast. The TEXT command was guilty! |
| ||
Thank you BlitzSupport! Found the problem: excessive use of TEXT command! |
| ||
Thanks for the link James. Nice :) Nps, Sagitario |
| ||
Sorry to hijack, but would it be okay to use that SpriteCOntrol code for part of this: http://www.blitzbasic.com/codearcs/codearcs.php?code=2533 It would be the perfect combination to make a complete replacement for the 2D font / text commands in 3D |
| ||
I don't see why not? It's free to use :) I'll convert my waypoint editor to use 3d actually. |
| ||
nice! :D |
| ||
Get Fastlibs and use FastImage and Fasttext, they're super fast, you get really good fast 2d as well as fast text with rotation etc.. Try the Fastlibs demo, you won't be disappointed. http://www.fastlibs.com/ |
| ||
Best non complicated way to draw 2D over 3D is to render 2D to a screensized image buffer - redraw the buffer contents only say 30fps, but render the image buffer every frame to the screen... Then your only calling the text command, etc. 30 times a second instead - infact you could prolly get away with only updating it at 20Hz. |
| ||
@Malice... would it be okay to use that SpriteCOntrol code for part of this Sprite Control is the work of Jim Brown, so you'd have to ask him (if you mean you want to put the code into your public domain code) -- drop him an email via the web site I linked to above. |
| ||
If you need an example/better explanation of what I said lemme know. EDIT: Tho looks like you could be doing that already hmmm works for me - boosts performance from 35fps to 500fps when drawing just the menu. |
| ||
Thank you, James... will do that now. |
| ||
Or write your own routines, pixel-perfect sprites are not too hard. Take a look at my example, the orange square size is exact 128x128 pixels: http://www.blitzbasic.com/Community/posts.php?topic=85745#970608 |
| ||
To James L Boyd: SPRITECONTROL IS AWESOME! THANK YOU VERY MUCH! |
| ||
Sprites - very slow solution for 2D. |
| ||
@Sagitario: thank Jim Brown -- he wrote it! |
| ||
Hi, I'm just working one of the examples into some code I have to allow an FPS counter to be displayed on screen with minimal effect to the 3D rendering (i.e. - I do not wish to drag down my 3d by using the simple text command). Is it mandatory to use the :- SpriteGraphics3D sw,sh CameraClsColor spritecamera,20,45,116 Instead of the native Graphics3D ? I only ask because I use Graphics3D in my current code. |