Framerate differs on object distance.

Started by
6 comments, last by sirob 19 years, 3 months ago
Hello. I'm trying to make a 2D using textured quads in a 3D enviroment so I have controll of the camera. However, whenever I'm zoomed in very close to an object, the framerate drops dramatically. My game requires that objects are very close to the camera to fill the screen, so this is an annoying problem. I've also noticed that the lower I make my resolution, my framerate will increase by a lot. 1024x768 gives me about 120 frames per second, but 320x240 gives me over 1000. I only have about 12 polygons on the screen, but I also think there might be a problem with the function that makes textured quads is flawed. Currently, it sets the world coordinates, locks, then writes the coordnates, then unlocks and draws them. Is there a problem with doing this many steps every time I need to make two polygons?
Advertisement
try to make your texture smaller

if the verices are less than 100, use DrawPrimitiveUP()
it won't be slow.
------------------------------The Great Nature!
Thank you. I'll check out that function.

Yeah. The textures I used are 512x512. I was afraid they might be too large, but the graphics are fuzzy otherwise.
Quote:Original post by Whogie
I've also noticed that the lower I make my resolution, my framerate will increase by a lot. 1024x768 gives me about 120 frames per second, but 320x240 gives me over 1000.


At higher resolutions, the graphics card has to output more pixels. At lower resolutions, the graphics card has to output less pixels. So, of course your applications are going to be faster at lower resolutions. For example, at 1024x768, 786,432 pixels have to be filled. At 320x240, 76,800 pixels have to be filled.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
The problem is quite likely the actual pixels drawn. You are pixel rate limited. On a faster card, you'll run faster; on a slower card, you'll run slower.

What specific card are you using? You might want to try with different cards to get a feel for how it's impacted.

You might want to turn off texturing, and see what frame rate you get. It might not be texture fetch that's the problem, but pure fill rate to the framebuffer.

How much overdraw do you have? Try to get it to 1.
Do you use blending? Try not to.
Do you draw near-to-far? Try to do that, to get early Z reject.

120 fps is way faster than most people run their monitors anyway, so you have room to grow. You can probably multiply your poly count by 100 and still be at the same FPS, if you're currently fill limited.
enum Bool { True, False, FileNotFound };
Sounds like you're being limited by fill rate. What does your frame rate look like if you don't change the vertices each frame? If it doesn't increase significantly, then that isn't your problem and points more in the direction of a fill rate issue.

There's a great slide presentation (pdf) on NVIDIA's website explaining how to locate the bottleneck in your D3D application. It's titled, "Practical Performance Tuning and Analysis".
I've commented out the code that sets the texture, and I'm getting the same framerate. I'm now using The DrawPrimitiveUP, because it fits my code better. I'm at school running on a Radeon 9200, and I have a Radeon 9800 pro at home.

I'll try out what you all have suggested. Thank you for all your help.

"Do you use blending? Try not to."

I have these flags, if that's what you mean:

d3dd->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
d3dd->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);
d3dd->SetRenderState(D3DRS_ALPHABLENDENABLE,TRUE);

"120 fps is way faster than most people run their monitors anyway, so you have room to grow. You can probably multiply your poly count by 100 and still be at the same FPS, if you're currently fill limited."

The framerate goes to over 200 when the scene has half the polygons, so it does seem pretty sensitive.
Your renderstates are enabling alpha blending.

Test your framerate with:
d3dd->SetRenderState(D3DRS_ALPHABLENDENABLE,FALSE);
this should increase your framerate by quite a bit.

Also, what people here have been trying to say is that if you are fill rate limited, you won't see a large decrease in performance if you add more vertices to your scene as long as you don't add more pixels. This doesn't halp you much in 2D, but would allow you to get more accurate 3D geometry for less of a performance loss.

My 3D terrain engine is suffering from my fill rate limited card, so I had to find workarounds to allow me to draw enough pixels, though I still see a huge difference between filling an entire screen or just half.

For 2D, the best thing you can do is avoid any redundant pixels being drawn. Meaning, try to use occlusion culling (not draw what will be blocked by other stuff) and try to draw far things last (draw your background last, not first).

Good luck.
Sirob Yes.» - status: Work-O-Rama.

This topic is closed to new replies.

Advertisement