Fill rate problems

Hello everyone

I am new to the forums and somewhat new to OpenGL. Hopefully I put this on the correct board.

I am currently attempting to implement grass rendering based on this article:
http://http.developer.nvidia.com/GPUGems/gpugems_ch07.html

I am having some pretty severe frame rate problems that I think are due to fill rate. Using the “grass elements” described in the article (basically three quads forming a skewed triangle or star when viewed from above) and the setup that is described in the article my frame rate drops to 20-25 from certain angles with 400 grass elements (2400 triangles).

What I do is this:

  • Sort the grass elements in back to front order
  • Enable depth testing
  • Enable blend
  • Draw the elements

I’ve tried a few things to try to remedy the low frame rates.

First I tried to ignore semitransparent texels and sorted the elements front to back, enabled alpha test and disabled blend but this did not fix it.

Then I thought that maybe my textures were too sparse so I tried using completely filled textures instead but that did not fix it either.

Note by “not fixed” I mean that from certain angles the frame rate is still as low as 45-50.

Also note that I have disabled all other things that I thought might affect the frame rate. My vertex shader simply sends the texture coordinates and calculates gl_Position and my fragment shader is only a texture lookup.

Thanks in advance

First, what hardware/OS/drivers ?
Then, which resolution ?

I am using
Intel Dual Core T6400 2.0 GHz
ATI Mobility Radeon HD 4650
4GB RAM
Windows 7 64bit

Drivers are 8.791.0.0 if that tells you anything, according to GLview the OpenGL version is 3.2 and I passed both rendering tests.

I was running on 800x600 to get the low fps, with 400x300 there is no problem. Furthermore the fps drops when the grass elements only make up a small portion of the screen, i.e. when they are far away or the camera is looking in another direction. These are the reasons I believe it’s a fill rate issue.

Thanks in advance

ATI Mobility Radeon HD 4650

So, a mid-grade laptop GPU. You haven’t told us how much grass you’re rendering, but it’s not like this card is a fillrate monster or anything.

400 grass elements (2400 triangles)
I certainly don’t have the best hardware but it can still run games like Starcraft 2, Oblivion, Dragon Age etc. so I figured the low fill rate was probably due to my lack of OpenGL experience rather than the hardware. If these kinds of scenes really can’t be rendered in real time on my computer then I have a problem :slight_smile: .

Again, if you have any ideas or need any additional info please let me know!

Thanks in advance

What’s the frame rate like when you do no sorting at all? (obviosuly you’ll get rendering ‘errors’ - but it’s worth seeing if this is the cause of the slow down).

There is another way to get semi-transparetn rendering without blending. Sample_Alpha_To_Coverage. See nVidia SDK 9.5 as they have an example. The results are not as good a blending but way, way better than alpha test.

There are only 400 elements to sort so the time is very minimal, turning it off doesn’t change the frame rate. Furthermore the frame rate is good when I only view a few grass elements at the time or when they are very far away regardless of sorting.

I’ll check Sample_Alpha_To_Coverage out and get back when I’ve had time to code it up.

Thanks!

To everyone else who might be reading. Please realize that I am a beginner so things you might take for granted that I’ve thought of are worth bringing up.

Thanks in advance

There are only 400 elements to sort so the time is very minimal, turning it off doesn’t change the frame rate. Furthermore the frame rate is good when I only view a few grass elements at the time or when they are very far away regardless of sorting.

I’ll check Sample_Alpha_To_Coverage out and get back when I’ve had time to code it up.

Thanks!

To everyone else who might be reading. Please realize that I am a beginner so things you might take for granted that I’ve thought of are worth bringing up.

Thanks in advance [/QUOTE]

I tried Sample_Alpha_To_Coverage instead of blend but it did not have any noticeable impact on fps compared to blend and was worse than alpha test with front to back sorting (which isn’t really surprising).

I guess with such hardware you have no other choice than reducing overdraw.
You said earlier that it depends on the view angle.
Explore that with an artificial rendering :

  • everything but the grass is black
  • draw grass blades same as usual, with following changes :
  • no texture, pure color like : 1,1,1,255 (or bit lighter)
  • additive blending

Then try to verify the correlation between overdraw and view angle.
A fix could be to change grass settings and reduce number of grass blades depending on view angle.

EDIT: what about mipmaps ? Not using mipmaps will kill performance for distant textures.

Yes!

Mipmaps solved it, can’t believe I didn’t think of that.

Thanks for your help!