I need to implement an HDR technique in the game engine I'm working on, and I have some questions regarding performance and compatibility. I haven't researched HDR that much yet, but as I understand it there are two main ways to implement HDR:
1. "Fake" HDR, where the alpha channel is used as a scalar/exponent value to simulate high dynamic range
2. "True" HDR, where you actually set up a floating-point precision backbuffer.
My questions are:
- Is fake HDR faster than true HDR? I think fake HDR requires a few more shader instructions for calculating the exponent to be stored in the alpha channel, although true HDR would probably take twice the pixel memory for the backbuffer itself, which I guess would result in higher bandwidth needs.
- How incompatible is true HDR? Which video cards support it?
- Is there any way to keep alpha-blended effects (particles, vegetation, etc.) within a fake HDR system?
I'm mainly interested in finding the fastest (and cleanest) method, because compatibility isn't as much of a problem since HDR will be optional. It would be nice if I don't have to write all my shaders twice (with HDR / without HDR) too.
HDR implementation questions
- JohnJ
- OGRE Expert User
- Posts: 975
- Joined: Thu Aug 04, 2005 4:14 am
- Location: Santa Clara, California
- x 4
- sinbad
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
- Contact:
If you're aiming for a 6800-class card or better, go for true HDR. 48-bit (16-bit float * 3) surfaces tend to be the best and can run very well indeed on modern hardware. Frame buffer blending on floating point targets is also supported in this class of cards.
Blending in fake HDR is tough, because the frame buffer blend cannot cater for the exponent you're storing in the alpha channel, it simply doesn't understand it, and will blend it just like a regular colour channel. With source alpha blending, it sometimes looks ok provided the range differences aren't too high, but most other blend modes fail completely, particularly add. You really have to do your own separate composition in another fragment shader targetting a second texture and pulling the 'background' values in so you can do accurate blending, rather than render the transparent effects into the same original surface.
Blending in fake HDR is tough, because the frame buffer blend cannot cater for the exponent you're storing in the alpha channel, it simply doesn't understand it, and will blend it just like a regular colour channel. With source alpha blending, it sometimes looks ok provided the range differences aren't too high, but most other blend modes fail completely, particularly add. You really have to do your own separate composition in another fragment shader targetting a second texture and pulling the 'background' values in so you can do accurate blending, rather than render the transparent effects into the same original surface.
- JohnJ
- OGRE Expert User
- Posts: 975
- Joined: Thu Aug 04, 2005 4:14 am
- Location: Santa Clara, California
- x 4
- nullsquared
- Old One
- Posts: 3245
- Joined: Tue Apr 24, 2007 8:23 pm
- Location: NY, NY, USA
- x 11
Are you using Shoggoth? Eihort can't do AA on textures.JohnJ wrote:Ok, I think true HDR sounds like the best choice.
I'm having a problem though - after adding a simple do-nothing compositor, I noticed anti-aliasing is disabled (even in 24-bit RGB mode). Is there something I need to do to reenable anti-aliasing when using compositors?
- JohnJ
- OGRE Expert User
- Posts: 975
- Joined: Thu Aug 04, 2005 4:14 am
- Location: Santa Clara, California
- x 4