HDR + many simple GLSL 2D Filters v2.0

Hey
Recently i`ve been trying to implement SSGI (screen space global illumination) and HDR (tonemapping with auto exposure) in Game Engine.

I couldnt get SSGI to work as BGE doesnt have Normal Buffer yet. Otherwise it works really well.
HDR is still work in progress, but while making it, I came up with these simple filters.

screenshot:
http://img132.imageshack.us/img132/4139/filters.jpg

and a blend
Few_Simple_Filters.blend (187 KB)

Controls:

1 - noise
2 - vignette
3 - retinex

mouse/wasd - rotate/move camera
mouse wheel - change retinex value
up/down - noise amount
left/right - vignette size


edit:

HDR is here:
HDR.blend (192 KB)

It will run properly only with Blender 2.49RC3 or newer build.

Controls: same as before.
only now press 1 to enable HDR rendering.
2 - noise
3 - vignette
4 - retinex

screenshot showing difference in exposure:

http://img30.imageshack.us/img30/1046/hdrp.jpg

video, with filter in motion

Luminance info is taken form 5 points close to center of the screen.


version 2.0

HDR2.0.blend (218 KB)

controls:
1 - HDR
2 - Noise
3 - Vignette
4 - Retinex
5 - Gamma correction
6 - barrel Distortion
7 - underwater-like screen distortion
8 - DoF with blurred depth map
9 - DoF without blurred depth map
0 - edge blur filter

i - technicolor 1 Film Filter
o - technicolor 2 Film Filter
n - normals
b - bloom
l - light scattering

z - ZX Spectrum 1
x - ZX Spectrum 2
r - Radial Blur
p - BleachBypass
j - color channel remapping with curves

cool!
nice work! :slight_smile:

That’s awesome!

I was thinking today about controlling bloom through properties,
and the retinex filter does exactly what I wanted. :slight_smile:

Thanks a lot martinsh!

mm nice! so the retinex filters is like the reverse of a bloom shader right?

Well technically yes, reverse of retinex looks like a bloom. Actually thats how i accidentally came up with retinex. But retinex itself doesnt look like reverse of bloom :).
Reverse of bloom looks like this:
http://img39.imageshack.us/img39/7233/darkysd.jpg

I couldnt get SSGI to work as BGE doesnt have Normal Buffer yet.

Getting it by nodes won’t do if it can’t be accesed by buffer? It would be like applying the filter on the material tough…

http://blenderartists.org/forum/showthread.php?t=156301

I just finished High Dynamic Range 2D Filter.
Done with cooperation with Mike Pan (mpan3) and Dalai Felinto (dfelinto).

blend:
HDR.blend (192 KB)
It will run properly only with Blender 2.49RC3 or newer build.

screenshot showing difference in exposure:

http://img30.imageshack.us/img30/1046/hdrp.jpg

without and with HDR enabled
http://img199.imageshack.us/img199/3972/hdr1.jpg

video, with filter in motion

Controls: same as before.
only now press 1 to enable HDR rendering.
2 - noise
3 - vignette
4 - retinex

Luminance info is taken form 5 points close to center of the screen.

I was joking when i said next week, but you really did it.:eek: Good job.:yes:

I don’t know much about GLSL, but maybe this link could be useful for you:
http://www.gamerendering.com/2008/09/25/rendering-normals-in-screen-space/

By the way: you can bake the radiosity to texture:
http://vi-wer.de.tl/Lightmap-Tutorial.htm

But please use the “selected to Active”-Button in the bake panel.:wink:

OOh…MYGAD![/Janice]

awesome! The first three works but the HDR doesn’t run as it should, or not at all. It prints the full script to the console then

ERROR: 0:36: ‘pow’ : no matching overloaded function found
ERROR: 0:36 ‘=’ : cannot convert from const float to ‘noperspective 4-component vector of float’
ERROR 0:38 ‘pow’ : no matching overloaded function found
ERROR 3 compilation errors. No code generated

The work is amazing, however it produces too dark an image to be called a lighting enhancer, so I took the two lines of code that said


 float contrast = avgL*4.0;
 float brightness = contrast*0.2;

And changed it to


float contrast = avgL*<i>2</i>;
float brightness = contrast*<i>0.23</i>;

The new values are underlined, and are specifically for allowing the 2D filter to produce a reasonably bright image so as to enhance the atmosphere provided by the current lighting instead of darkening the scene significantly.

To everyone reading, these two values are all you need for lots of darkness/brightness/contrast variation provided by this filter and you don’t really need to be a programmer just to change a couple of numbers.

Doesn’t seem to work on ATI card.

Heres a full copy of the error that gets printed: http://www.pasteall.org/5669/text

It’s the same error as the one Sim88 had.

Looks awesome, they are make magic! :eek:

Fantastic Martinsh!!!
Absolutaly Amazing!

wow great work!! many thanx :smiley:
dreams come true to BGE

Same here.
BLA … stupid ATI card

Joining you with 9600xt :spin:
Not working…

WOW!!! It keeps getting better and better!!!

Here is HDR that should work also on ATI cards. It is without bloom, but you can enable it with retinex filter separately.

HDR1.3.blend (191 KB)

martinsh can you look at problematics of tone and gamma corrections and introduce some 2d filter for it please?
would be nice to have gamma corrected BGE output… it’s easier to make more photorealistic look (altought if one want use it it will introduce use of linearized colors for materials/textures… but who cares it’s just one more step to do in gimp)

see here:
what’s going on - http://www.ypoart.com/tutorials/tone/index.php
thread about it using composite nodes on render output - http://blenderartists.org/forum/showthread.php?t=119205

here is your hdr1.jpg with tone and gamma correction to see difference

Attachments


This is amazing!

I remmember previously looking at this, when you had the reflection mirror objects, you used mouse.py to allow the mouse to freely move the camera, you wouldnt happen to have a link to a tutorial for that would you?