Advertisement

Big Performance Hit!!

Started by September 02, 2002 04:16 PM
19 comments, last by fallingbrickwork 22 years, 5 months ago
If you have a solid background, then he''s right, don''t clear the colour bit. But you will still have to clear the depth. And make sure you turn depth testing back on after you draw your background.
writing a large quad in the background can give you a huge performace drop. This happens because your card is fillrate limited (nr of pixels it can draw per sec)
It is well possible that drawing your little ships/whatever might actually take less time then drawing your background.(althrought you need to push more triangles/quads per frame for those, they take very little space on screen - so much fewer pixels are drawn)

And the ideas about not clearing buffers is good.
Simply the first thing you do when drawing a new frame is:
-turn z-buffer test off
-draw your background quad (set Z-value of it to be greater then any other object appearing on screen)
-turn z-buffer test on - so other objects get drawn correctly
-draw other objects here

As you can see there''s no z-buffer nor color buffer clearing.
It''s simple not needed because your first step is to draw your background image which fills both color and z-buffer.
With best regards, Mirek Czerwiñski
Advertisement
Thanks for all the great replies.

I spent last night turning off as many things as I could before drawing the background and then enabling them again after and (holding both hands up) I''d left the Stencil enabled from doing some tests earlier in the week. When I disabled this I got some of my FPS back. There is still a drop in frame rate but not as dramatic as before.

I think this is a lesson to be learned for all beginners:

`If you don''t need it......Don''t enable it!!!!`

I''m going to replace the QUAD with a TRIANGLE_STRIP in a last attempt to recover a few more FPS.

Is the `Fillrate limit` based on the total number of pixels the gfx card is rendering. i.e Would splitting the background down into 9 smaller QUADS actually produce the same Fillrate penalties
because the overall number of pixels will be the same? (Does this make sense?)
if it''s game logic speed that has noticably slowed (not frame rate) then it may well be a case that your frame rate has just gone from, say, 600 to 200... which wouldn''t be surprising with a significant increase in fill rate demand...
while I don''y doubt your''ve noticed a difference,
I find it very hard to believe that a single full screen quad could drop the frame rate below 25ish (when it''s noticable) UNLESS you are running in software... Even my old 2mb s3 virge wouldn''t do that... (shudder)
fill rate is the number of pixels drawn, redrawn (overdraw - which can be hard to understand) and other obvious things like blending (which roughly halves fill rate ontop of the overdraw)...
so 9 quads wouldn''t help..
what would help, though, would be to draw the backdrop after all other solid objects (non-blended) so the z-test can cull a lot of excess pixels that would otherwise been overdrawn (at slightly less cost)...
try vertex/tex_coord array with triangle strip and
for optimization an octree, and for more FPS some
disabling vsync...
(a MAX OPENGL framerate=600FPS=nothing... 250 with some good quality 3ds...)

Relative Games - My apps

Advertisement
MAX OPENGL FRAMERATE=600fps?

What?

The only thing that determines maximum framerate is how fast your machine is. With an empty drawing loop, I''ve gotten 4-digit framerates. queryPerformanceCounter was returning single digits.

Drawing the background last, using the z-buffer, will certainly work - if you are in orthogonal mode. Otherwise, it has to be drawn first, with z-buffering turned off. And it may not make a difference if you do draw it last. How much worse is drawing extra pixels then checking the z-buffer?
by saying 600 to 200 I was trying to make a point, no matter how realistic it was... I''ve maintained over 400fps with fairly complex (fully drawn) scenes before...

quote:

How much worse is drawing extra pixels then checking the z-buffer?


I''d expect it''d depend on the hardware a fair bit. but there is definitly a difference. (I can''t say how significant though)

If you are running in software, and want to get as many pixels through as possible, when drawing the background, disable texture filtering and set the perspective hinting to per vertex (fastest) not per-pixel, this will significantly boost fill rate in software, but have virtually no effect in hardware.
What is the size of your texture?
Gaiomard Dragon-===(UDIC)===-
quote:
Original post by fallingbrickwork
The resolution of the Texture is 256x256.


Read.

[twitter]warrenm[/twitter]

This topic is closed to new replies.

Advertisement