Sign in to follow this  

framerate depends on camera distance?

This topic is 4839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm getting some odd behaviour in this simple portal engine im making theres very few triangles, perhaps 12 at first but when i increase it to about 36 (by adding new rooms) the framerate drops from 60 to 20 I'm sure its not anything im doing, since cpu activity remains low also, the framerate goes back up if i pull the camera out of the rooms and look at them from farther away (from outside instead of up close and inside them) no textures and disabling fog and lighting dont affect it its just a simple Descent-style clone, nothing demmanding or complex all big square/triangular polygons, and fewer than 100 of them rendered at a given time any ideas what causes that kind of behaviour? maybe walls made entirely of single triangles that fill up the screen when viewed up close are bad? thats the only thing i can figure.... but why should the size of triangles being rendered matter?

Share this post


Link to post
Share on other sites
What type of graphics card do you have? And what resolution are you rendering at?

Although this may be caused by inefficiencies on your part, this seems obviously related to a fill rate limitation. Graphics cards are limited largely by two things: vertex processing, and pixel processing. When you say that you only have a few triangles, so it should be fast, this is referring to vertex processing, and indeed, the few vertices that you send to the card hardly affect it. However, the number of pixels that are drawn do matter, and often times, they matter a lot more than the vertices. If you fill more of the screen with pixels from triangles, then it's going to take more processing from the GPU.

In addition, if you have a lot of overdraw, then you're requiring even more from the GPU. If you draw every single triangle, the farthest ones first, and finally the nearest ones, then you're likely filling the screen multiple times over each frame. This could seriously hurt your framerate. The two biggest ways to avoid this is to render front-to-back and use the z-buffer to avoid calculating a lot of pixel colors, and to using various culling techniques to completely ignore certain triangles, and simply never send them to the GPU 'cause you already know that they're not going to be visible. Some culling techniques include back-face culling, frustum culling, and occlusion culling.

Share this post


Link to post
Share on other sites
gefore 4 420 go

just the other day my terrain project was going 60fps just fine with about 20k triangles....


this current one though
does render front to back
and does use the z buffer
and i do have basic portal visibility check, im not rendering the entire map

so what more can i do?

would tesselating the walls when i get up close into smaller triangles help?
my terrain project certainly had much much more small triangles, with just as large a screen coverage

and why would that affect anything?

Share this post


Link to post
Share on other sites
I honestly can't suggest much else. You're doing pretty much everything that I would know of from my limited experience. The only suggestion that I can make now would be to debug your stuff and make sure that your culling is working as you think it is. It's probably something else, though, but I don't know enough to really have an idea of what it is. Sorry I couldn't help much. :-/

Share this post


Link to post
Share on other sites
If you are rendering a GL_QUAD very near, it takes much more time for the graphics card than to render two GL_TRIANGLES. I've tried this myself i was just rendering ONE big quad, and when i changed it to two triangles, the framerate simply grew that much. Use Triangles!

It could also be because that you are using glPolygonMode(); to calculate what side of the triangle/quad is facing the camera. That takes very much time.

If it's not one of these problems - then i don't know...

Share this post


Link to post
Share on other sites
>>maybe walls made entirely of single triangles that fill up the screen when viewed up close are bad? thats the only thing i can figure....
but why should the size of triangles being rendered matter?<<

this is normal behaviour (think about the graphics card has to draw more pixels)
is the reason why in 99% of graphics apps (games) the framerate drops when you play it in a larger resolution

Share this post


Link to post
Share on other sites

This topic is 4839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this