should i turn off AA with fullscreen quads

the title saiz it all!!

im assuming theres practically no speed difference between the two, is this correct?

At the moment, im disabling it during the shadowmap creation stage, which makes a large difference (due to on average im rendering far more geometry in this stage than in the normal stage)

are there any other times i should disable AA?

If all of your rendering is to an offscreen buffer, I’d disable AA on your main window and use the fbo_multisample extension for when you need something to be antialised. The latest nVidia drivers support that extension at least back to the GeForce 6, I’m not sure about AMD drivers, but I suspect they support it as well.

Yes, call glDisable(GL_MULTISAMPLE) before any form of rendering that does not need its edges smoothed, like for instance fullscreen quads (it’s better to do a fullscreen triangle though since that eliminates the diagonal edge) or for things like skyboxes (works even if they are drawn last (which they should be) because the sample will still be tested against all destination depth values, so you’ll still get AA against the scene geometry).

Skyboxes drawn last? That’s not the way I learned it.

I always figured skyboxes should be drawn first with DEPTH_TEST disabled, so that everything else drew in front of them.

Nope. That was true in the Rage 128 era. :wink: But ever since Radeon it’s been better to draw the skybox last since you can cull large chunks of it with HyperZ. It’s the same front-to-back logic as with everything else, and the skybox is most definitely in the back.

Somehow this seems very unintuitive to a lot of developers, and seven years later we’re still struggling with educating developers to do this right. Loads of games shipping today still draw the skybox first, even though it’s slower and it should be a trivial fix in many cases.

of course you could benefit from early z if you render front to back, assuming you don’t need to blend with the background.

But then again, skyboxes are a bit of a snooze IMHO…

Originally posted by modus:
of course you could benefit from early z if you render front to back, assuming you don’t need to blend with the background.
Well, if you need to blend with the background the correct order is like this:

  1. Opaque objects
  2. Skybox
  3. Blended objects

But the skybox should never be draw first, unless everything needs to be blended with it.

Originally posted by modus:
But then again, skyboxes are a bit of a snooze IMHO…
Well, if you have more advanced representation of the environment then most certainly it should be drawn last. The more advanced the more you can gain from this optimization. A plain cubemap may see a couple of percent speedup of the game with this, whereas an advanced multi-layered sky could see much larger gains from it.

Well, it depends on what you mean by advanced.

If you’re actually rendering a nontrivial atmosphere with volumetric clouds and such, then there is no one sort order… it’s view dependant.

And what about light shafts, or other cool volumetric atmospheric effects, not to mention single/multiple scattering, arial perspective, etc.

Yes, call glDisable(GL_MULTISAMPLE) before any form of rendering that does not need its edges smoothed, like for instance fullscreen quads (it’s better to do a fullscreen triangle though since that eliminates the diagonal edge)
champion humus as usual.

yes i was leaving it on for the skybox (rushes out the room)

ill change over to drawing a triangle as well instead of a quad (ive heard this before)
luckily i have a function that goes draw_fullscreen_quad(W,H) so that’ll be quick

i assume the best method is
point A = corner0
point B = width2
point C = height
2
or would i need to add 1 to point B (+ perhaps also C) in case it misses the point in the upperright corner?

Erm, may i ask, what is the advantage of rendering a triangle over a quad for fullscreen-effects? I mean, it’s only ONE triangle less.

Jan.

Originally posted by modus:
[b] Well, it depends on what you mean by advanced.

If you’re actually rendering a nontrivial atmosphere with volumetric clouds and such, then there is no one sort order… it’s view dependant.

And what about light shafts, or other cool volumetric atmospheric effects, not to mention single/multiple scattering, arial perspective, etc. [/b]
Sure, you can always come up with exceptions, but I’m trying to give a simple generic answer here. :slight_smile: Things like volumetric clouds and stuff kind of fall outside what I consider “the environment”, I’m talking about the “at infinity environment” or whatever you want to call it. But I suppose many of those effects fall in the group that should be drawn last or late anyway because they are blended.

Originally posted by zed:
i assume the best method is
point A = corner0
point B = width2
point C = height
2

I’m not sure if there’s a “best” method. As long as it covers the entire [-1, 1] range in clip space it’s fine. Two layout’s I’ve been using are:
(-1, -1), (3, -1), (-1, 3)
and
(0, 2), (3, -1), (-3, -1)

Originally posted by Jan:
[b] Erm, may i ask, what is the advantage of rendering a triangle over a quad for fullscreen-effects? I mean, it’s only ONE triangle less.

Jan. [/b]
The diagonal edge in the middle introduces a slight inefficiency. The pixels on the edge will be shaded twice, once for each triangle. With multisampling enabled you’d also get these pixels decompressed.
Of course, it’s not a huge gain. In an extreme case I was able to squeeze 4% gain out of it, but in more common cases you’d maybe see a fraction of a percent. But on the other hand, it’s a trivial change so why not? The question should rather be, what’s the advantage of a quad, to which the answer is that there’s none. The only reason people use quads is because the screen is rectangular, so I suppose a quad is more intuitive.

If the texture you’re rendering to is larger than the quad, is there still a gain to using a triangle with the scissor test?

I haven’t tested that, but I would guess so.

But on the other hand, it’s a trivial change so why not?
Is it? I mean, how exactly do you draw a rectangular area with a single triangle? Wouldn’t the triangle have to be very large, compared to the size of the screen?

I find this interesting as in some console hardware docs, they recommend doing the fullscreen passes in a grid of quads (6x8 tiles? - not sure)

Something about not flooding the fragment pipe or something… (and most consoles use PC-like hardware)

More details on the tradeoffs of the various techniques for full-screen “quad” drawing would be greatly appreciated.

Originally posted by Korval:
[quote]But on the other hand, it’s a trivial change so why not?
Is it? I mean, how exactly do you draw a rectangular area with a single triangle? Wouldn’t the triangle have to be very large, compared to the size of the screen?
[/QUOTE]Yep :slight_smile: But when not using AA clipping should even lessen the “superiority” of the triangle way, right?

If you draw a triangle to cover the entire screen, I think the hw will clip it and you will end up with 2 triangles still. Unless if todays GPUs are working differently from the past stuff.