HDR rendering with antialiasing

A2b21fa7defb56c62be013e2b4cce956
0
spalter 101 Feb 13, 2006 at 15:21

Hi there,
is there a way to do HDR rendering (in OpenGL) in combination with antialiasing? I tried FBOs but found out pretty fast that rendering to textures with this doesnt support AA. Doing it in multiple render passes is too slow…is there any other way I can try ?
Thanks

18 Replies

Please log in or register to post a reply.

Da26e799270ce5e8b62659ed77b11cef
0
Axel 101 Feb 13, 2006 at 15:39

Current nVIDIA cards can’t do multisampling on FP16 rendertargets, so if you use such a card it’s not OpenGL’s fault.

820ce9018b365a6aeba6e23847f17eda
0
geon 101 Feb 13, 2006 at 15:59

I’ts probably because antialiasing becomes a bit tricky when you do it in HDR. The subpixels must be averaged after the clipping (to non-HDR) is done. Otherwise a bright pixel neighbouring an antialiased one might completely saturate the antialiased pixel, making it white instead of gray.

Result: Jaggy edges, just like without antialiasing.

A2b21fa7defb56c62be013e2b4cce956
0
spalter 101 Feb 13, 2006 at 22:13

My problem is that when rendering to a FBO, the hardware cannot multisample at all. So it’s not the “averaging before or after” issue, the graphics card just can’t do the multisampling. I wonder if I could use GL_ARB_color_buffer_float to render to a float target, then use glCopyTexSubImage to copy the result into a texture, then render that texture again as a simple quad with the appropriate shader for the tone mapping. I have yet to try that…I wonder if it works (and if it’s fast enough).

Da26e799270ce5e8b62659ed77b11cef
0
Axel 101 Feb 13, 2006 at 23:32

Are you using a nVIDIA GPU or not?

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 168 Feb 14, 2006 at 01:02

Just be aware there’s also no bilinear filtering on FP buffers on any current GPU as far as I know. So if you go that route, you will have to do the filtering yourself.

A2b21fa7defb56c62be013e2b4cce956
0
spalter 101 Feb 14, 2006 at 09:12

Axel: yep, using nVidia.
Reedbeta: Why would I want to use bilinear filtering on the fp buffer? I’d just draw a fullscreen quad with that texture and GL_NEAREST sampling, so that’ll be fine…so as long as the content in the fp buffer is multisampled, I don’t really need to care about bilinear filtering?

Da26e799270ce5e8b62659ed77b11cef
0
Axel 101 Feb 14, 2006 at 11:36

@spalter

Axel: yep, using nVidia.

As I said the GPU is not capable of doing multisampling on FP16 rendertargets. This is not a problem with the extension or OpenGL.
@Reedbeta

Just be aware there’s also no bilinear filtering on FP buffers on any current GPU as far as I know. So if you go that route, you will have to do the filtering yourself.

Wrong. Every nVIDIA GPU starting from NV40 can do full anisotropic filtering on FP16 textures, but there is no ATI GPU that can do that. But ATI’s latest GPU lineup (R5xx) can do multisampling on FP16 rendertargets…

Currently it seems best to wait for the DX10 generation where these features will be very likely enforced by the specification.

A2b21fa7defb56c62be013e2b4cce956
0
spalter 101 Feb 14, 2006 at 19:34

so is there any way to do HDR rendering in combination with multisampling at all? (at reasonable speed)?

Da26e799270ce5e8b62659ed77b11cef
0
Axel 101 Feb 14, 2006 at 20:35

Yes. Buy a Radeon X1000 series GPU or do some tricks with normal 32bit rendertargets and MRT like Valve.

A2b21fa7defb56c62be013e2b4cce956
0
spalter 101 Feb 14, 2006 at 21:41

GPUs other than nVidia are not an option for me…this is a commercial application targeted at geforce 6 and 7 gpus. Is there any information available on how valve did HDR for half life 2? (couldn’t find any with sufficient details on the implementation)..

6673a7d3bfd3d1db5e05c5676cc040b6
0
Goz 101 Feb 15, 2006 at 17:33

There was a great discussion on GD Algorithms about this just recently. I’d recommend checking it out.

Conslusion (If i remember right) … it doesn’t matter WHAT card you are using multisample AA and HDR just aren’t compatible. The only way i know of to get AA is to render to an oversized buffer and then super sample it down to the screen res.

6ad5f8c742f1e8ec61000e2b0900fc76
0
davepermen 101 Feb 15, 2006 at 17:49

nope. all the radeon 1x00 can do it.

6673a7d3bfd3d1db5e05c5676cc040b6
0
Goz 101 Feb 15, 2006 at 18:10

@davepermen

nope. all the radeon 1x00 can do it.

How? If you multisample (as pointed out in another post above) in a higher dynamic range you can’t then antialias it after the exposure pass. You may be able to turn multisampling on but it will only work if you are completely in the range you will be exposing to … and if you are .. why are you using HDR?

Its a fairly simple reason it won’t work … how does it deal with a pixel that returns the following 2 multisamples … 16,000,000 and 0 … logically you’d choose down the middle at 8,000,000 (and yes i know im simplifying this) but at that value if you then expose into the range 0->1024 (yes everything will probably appear very bright) then that 8,000,000 value is still well out of range and the multi sampling is not providing you with decent results…

6ad5f8c742f1e8ec61000e2b0900fc76
0
davepermen 101 Feb 15, 2006 at 18:19

actually, you should not average _after_ tonemapping. it should be done at the high dynamic range. and i know of the result with the edges. but it’s still the correct way..

6673a7d3bfd3d1db5e05c5676cc040b6
0
Goz 101 Feb 15, 2006 at 18:33

@davepermen

actually, you should not average _after_ tonemapping. it should be done at the high dynamic range. and i know of the result with the edges. but it’s still the correct way..

What do you mean by “you should not average after tonemapping”? Slightly confused by that statement.

That said it sounds like you agree that you will get aliasing artifacts? I’d hardly call that antialiasing myself … still reckon super sampling is the way forward (if you can afford it!).

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 168 Feb 15, 2006 at 18:58

You should perform the antialiasing while you are still in HDR range, because the pixel brightness values are linear at this point and so box-filtering AA is reasonably correct. Then perform the tone mapping to take the HDR pixels back to the [0,1] range, using exposure mapping or whatever you like. You shouldn’t have that much trouble with single bright pixels but if you do, just apply a little bloom…which you probably should anyway :)

Da26e799270ce5e8b62659ed77b11cef
0
Axel 101 Feb 15, 2006 at 19:27

Supersampling is not the way forward, because it wastes much fillrate and simple downscaling will only give you an ordered subsample pattern which is much worse than sparsed-grid multisampling for edges.

A2b21fa7defb56c62be013e2b4cce956
0
spalter 101 Feb 15, 2006 at 21:18

Whether to tonemap before or after averaging is still somewhat unsolved…you cant really say after averaging is “more correct”, since the estimation of the pixel integral becomes much worse then. AFAIK commercial renderers like mental ray actually tonemap before averaging. So I guess I could just do the lighting and everything in HDR and then just directly tonemap the result in a pixel shader, rendering everything to a 8 bit rendertarget, where it would be antialiased….losing the ability to do decent postprocessing effects though..