If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
![]() |
|
|
#1 |
|
Junior Member
Join Date: Mar 2007
Posts: 50
|
Hi,
I am currently wondering if premultiplied alpha can still be used when using a full HDR pipeline, where the tone mapping appends at the very end of the frame rendering operation... My pipeline relies on premultiplied alpha for several stuffs: - normal 3D objects - impostors - low-resolution off-screen particles rendering, kind of impostor, where the content is blit onto the back buffer before tone map Now, in my opinion, for premultiplied-alpha to produce correct results, it should happen after the tone mapping, and not before. But then the issue is that it is not possible anymore to tone map at the very end of the pipeline, but each pixel should be tone mapped in the pixel shader... any thoughts ? |
|
|
|
|
|
#2 |
|
AndyTX
Join Date: May 2004
Location: British Columbia, Canada
Posts: 1,090
|
Why do you say this? Shouldn't it happen in linear space? Tone mapping should operate on the final colors reaching the camera/eye.
__________________
The content of this message is my personal opinion only. |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Mar 2007
Posts: 50
|
Hi Andy,
I was wondering because of the way I used to tone map each pixel at the end of the pixel shader, in each shader. Now I use the (more correct and cheaper) way to render all pixels in HDR, and then tone map at the very end, by doing a custom-MSAA resolve once the scene has been fully rendered, and blitting the resolved and tone-mapped pixel onto the back buffer. However, what I used to do in my main shader (for standard objects) was: Code:
- render pixel in HDR - tone map - premultiply by alpha - blend onto RT Code:
- render in HDR - once the scene has been fully rendered, bind the HDR RT - render a full-screen quad and a custom blit shader - custom blit shader performs a custom MSAA resolve by tone-mapping each subsample and averaging (paper page 18) Below the equation for a given pixel: method 1: alpha * (1.0 - exp(-exposure * colour)) method2: 1.0 - exp(-exposure * alpha * colour) any thoughts ? |
|
|
|
|
|
#4 |
|
AndyTX
Join Date: May 2004
Location: British Columbia, Canada
Posts: 1,090
|
My intuition tells me that all the alpha stuff should be done in linear space since the pre-multiplied RGB portion represents how much color the surface is *adding* (linearly) to the reflected light and the alpha portion represents how much it is occluding (also linearly) from the light behind it. All should be done in linear space (both in terms of gamma and pre-tone map). Thus my intuition is that your second pipeline is more correct.
__________________
The content of this message is my personal opinion only. |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Mar 2007
Posts: 50
|
Thanks for your answer Andy.
With a bit of hindsight, and seing the equation again, I think you are right. The blending operation should happen in linear colour space, and therefore the alpha pre-multiplication should also logically take place in linear space. I will keep an eye on the graphical result for a while, to make sure it also produces good results visually with different scenes. Thanks for your feedback man ! Greg |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|