Sign in to follow this  
myers

Hardware antialiasing in floating point

Recommended Posts

Just a quick question: I gather that, because hardware FSAA can't be applied when rendering directly to a texture, the standard practice is first to render to some buffer that does permit AA (such as the back buffer), and then blit this to a texture. But I also understand that AA with floating point formats is unsupported on any current hardware (or at least on DX9-era hardware). So how is AA performed with HDR, or any other effect that requires FP textures? I assume there's a way other than just using software AA.

Share this post


Link to post
Share on other sites
MSAA on FP16 render targets has been supported since the Radeon X1800 series, and the Geforce 8 series IIRC. Without hardware support for MSAA, you can always try supersampling (render at a higher resolution and downsample).

But yes, you'll need to create an MSAA render target first using IDirect3DDevice9::CreateRenderTarget(). Since textures don't support MSAA render targets, and shaders can't sample from surfaces, you need to render to the MSAA render target then StretchRect() to your texture so it can be sampled in your HDR shaders.

Share this post


Link to post
Share on other sites
Hmm, okay. Just so I've got this straight: in any HDR application prior to DX10 hardware, no hardware FSAA was performed - instead, all antialiasing was done via the supersampling method you describe?

Share this post


Link to post
Share on other sites
The X1800 wasn't a DX10 class part. I remember several years ago, it was one of the features which prompted me to purchase an X1800 over a Geforce 7 series part at the time. Oblivion with HDR + AA was nice. [grin]

Back then, there weren't very many games that actually used FP16 HDR. Oblivion was one, FarCry was another. There were a few others, but they were nowhere near as prevalent as they are now. These games just disabled AA when your video card couldn't do it. SSAA is simply far too expensive to be of any use, especially since HDR already hits your fillrate particularly hard.

The exception, of course, was Valve's HDR method (first used in their Lost Coast tech demo) which only required a SM2 class card and was able to perform AA (presumably because they didn't use floating-point buffers). I don't remember the specifics, but I believe they performed some sort of tonemapping on a per-object basis rather than as a postprocessing effect.

Share this post


Link to post
Share on other sites
Quote:
Original post by myers
Just a quick question: I gather that, because hardware FSAA can't be applied when rendering directly to a texture, the standard practice is first to render to some buffer that does permit AA (such as the back buffer), and then blit this to a texture. But I also understand that AA with floating point formats is unsupported on any current hardware (or at least on DX9-era hardware). So how is AA performed with HDR, or any other effect that requires FP textures? I assume there's a way other than just using software AA.


Another way to do incorporate MSAA and HDR on DX9 class hardware is to store HDR colours in an alternative colour space that doesn't require more than 4 bytes per pixel. On the other hand I'm not sure it's possible with DX9 to read such a render target back and convert it to RGB (it needs to be tone mappe after all..), but PS3 and 360 can easily handle this technique.

Share this post


Link to post
Share on other sites
Quote:
Original post by Marco Salvi
Another way to do incorporate MSAA and HDR on DX9 class hardware is to store HDR colours in an alternative colour space that doesn't require more than 4 bytes per pixel. On the other hand I'm not sure it's possible with DX9 to read such a render target back and convert it to RGB (it needs to be tone mappe after all..), but PS3 and 360 can easily handle this technique.


Actually, I think we finally might have gotten a DX9/HLSL implementation of LogLuv to work for this purpose (over in this thread). Anything you'd care to add would be very much appreciated, especially if you have anything to share on filtering and/or MSAA pitfalls you warned about [smile]

Share this post


Link to post
Share on other sites

Sorry, OpenGL isn't my cup of tea, so I wouldn't know. The original LogLuv stuff to encode floating point in ARGB8 textures was written in Cg though, so that may be a viable alternative for OpenGL as well.

Share this post


Link to post
Share on other sites
Quote:
Original post by myers
Just a quick question: I gather that, because hardware FSAA can't be applied when rendering directly to a texture, the standard practice is first to render to some buffer that does permit AA (such as the back buffer), and then blit this to a texture. But I also understand that AA with floating point formats is unsupported on any current hardware (or at least on DX9-era hardware). So how is AA performed with HDR, or any other effect that requires FP textures? I assume there's a way other than just using software AA.


This small article describes how to render to Fp16 targets with antialiasing :
HDR with fp16 target and antialiasing

It's mainly for D3D9, but the technique is the same on OpenGL, though it's relying heavily on extensions (no way around it !). On Direct3D10 you would have to call explicitely resolveSubRegion, or do the resolve yourselves in the pixel shader (that allows you custom resolve).

No talk about image quality yet though..

LeGreg

Share this post


Link to post
Share on other sites
Quote:
Original post by remigius
Actually, I think we finally might have gotten a DX9/HLSL implementation of LogLuv to work for this purpose (over in this thread). Anything you'd care to add would be very much appreciated, especially if you have anything to share on filtering and/or MSAA pitfalls you warned about [smile]

Thanks for the pointer remigius, I'll try to have a look at it later.

Share this post


Link to post
Share on other sites
Quote:
Original post by LeGreg
This small article describes how to render to Fp16 targets with antialiasing :
HDR with fp16 target and antialiasing

How can it possibly work if it requires to create a FP16 rendertarget with multisampling? A lot of NVIDIA and ATI DX9 hardware doesn't support that.

Another problem with it is that it performs tone mapping after AA resolve, while it should be the other way around. Unfortunately that would also be much slower.

Share this post


Link to post
Share on other sites
Quote:
Original post by Marco Salvi
How can it possibly work if it requires to create a FP16 rendertarget with multisampling? A lot of NVIDIA and ATI DX9 hardware doesn't support that.

Another problem with it is that it performs tone mapping after AA resolve, while it should be the other way around. Unfortunately that would also be much slower.


First the OP asked for floating point target + AA which is commonly used on PC (not talking about xbox or ps3 here). And yes it only works for recent graphics cards.

Second your objection with tone mapping would require a much more complete article, so that's why it's not covered yet (but it has been discussed partially here and elsewhere). There's always Valve solution but that doesn't address everything (and only Valve in my knowledge uses it).

LeGreg

[Edited by - LeGreg on July 8, 2008 9:59:44 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by LeGreg
First the OP asked for floating point target + AA which is commonly used on PC (not talking about xbox or ps3 here). And yes it only works for recent graphics cards.

Yes, but it seems to me that the OP explicitely asked for a solution working with hardware that doesn't support this feature. Perhaps I'm misreading his post..

Quote:

Second your objection with tone mapping would require a much more complete article, so that's why it's not covered yet (but it has been discussed partially here and elsewhere). There's always Valve solution but that doesn't address everything (and only Valve in my knowledge uses it).

It doesn't seem much complicated to me: tone mapping operators are mostly non linear operators and AA resolve doesn't commute with them.

Share this post


Link to post
Share on other sites

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