Hi
I'm trying to implement hdr rendering, I need some help...
I have a pp view
MATERIAL *mtlTonemap = {
effect = "tonemap.fx";
}
VIEW *viewTonemap = {
material = mtlTonemap;
flags = CHILD | PROCESS_TARGET | AUTORELOAD;
}
function main()
{
// vid init etc...
var format = 12222;
camera.bmap = bmap_createblack( screen_size.x, screen_size.y, format );
camera.stage = viewTonemap;
}
My fx file is very simple, just a ps that outputs the value directly from the texture (Just to make sure the process of rendering to an FP32/16 target then post processing to screen was working).
What I want to know is this:
How do I down sample the render_target to a much smaller texture to do the bright pass and from there what steps do I need to take to tone map the render_target + bright pass results? I've seen a few different ways, the one I want to try is down sampling to a 2x2 texture to calculate the average luminance and then using that value in some sort of tone mapping function.
Thx
Justin