Screen Space Global Illumination

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Screen Space Global Illumination

Post by nullsquared »

A bit of an over-ambitious title for such a big hack, but, hey, it looks cool :D

This is just an 'extension' to SSAO that grabs values from the light buffer as a second light bounce... It's completely dependent on having lights in the scene, otherwise it looks like normal SSAO. The good part, though, is that the number of lights doesn't matter - they all accumulate into the same buffer, and for each SSAO sample there is only 1 corresponding light buffer sample (currently, 15 samples, and it's pretty noise-free due to a 100% uniform distribution).

Off:
Image
On:
Image

Off:
Image
On:
Image

Another:
Image

A screen shot of the second bounce:
Image

Since objects with an emissive property are correctly accumulated into the light buffer, they actually behave as ... well, emissive :D

Off:
Image
On:
Image

As you can see, it looks pretty cool and add details, but it's not nearly 'correct' or accurate in any way whatsoever. Sorry, no demo this time :(. Maybe later on when Portalized reaches a more final stage I'll redo the SSAO demo and add in some SSGI :D

Anyways, what do you guys think? Thumbs up or down?
Last edited by nullsquared on Mon Dec 29, 2008 5:11 pm, edited 4 times in total.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Screen Space Global Illumination

Post by jacmoe »

Definitely up! :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
jjp
Silver Sponsor
Silver Sponsor
Posts: 597
Joined: Sun Jan 07, 2007 11:55 pm
Location: Cologne, Germany
Contact:

Re: Screen Space Global Illumination

Post by jjp »

To hell with "correctness" when it comes to diffuse indirect lighting. This actually looks pretty decent :)
Enough is never enough.
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: Screen Space Global Illumination

Post by nullsquared »

jjp wrote:To hell with "correctness" when it comes to diffuse indirect lighting. This actually looks pretty decent :)
It does suffer from the common SSAO issues. Colour can only be contributed from front-facing things on the screen, that is, only whatever is rendered.
User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
x 3
Contact:

Re: Screen Space Global Illumination

Post by Praetor »

Unless you do a front and back face render and use them both for your AO and GI calculations. Of course, that'll be about twice as slow.
Game Development, Engine Development, Porting
http://www.darkwindmedia.com
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: Screen Space Global Illumination

Post by nullsquared »

Praetor wrote:Unless you do a front and back face render and use them both for your AO and GI calculations. Of course, that'll be about twice as slow.
Yeah, that defeats the whole purpose of having it screen-space. Right now at 1024x768 with 15 samples (quite noise free, can use a blur though) it runs at about 50-60 FPS on my 8800GTS, so I'm happy :D. Svenstaro says on his 8800GTX it runs at 40 FPS at 1440x900, which is excellent considering he was rendering a 3DSMax animation in the background :lol:

The system uses an MRT of four R8G8B8A8 textures. There's depth, specular, emissive, diffuse, baked ambient occlusion and normals all packed into there, it's pretty crazy :mrgreen: . The speed is excellent in my opinion, and visual trade off is not that bad :D
User avatar
PolyVox
OGRE Contributor
OGRE Contributor
Posts: 1316
Joined: Tue Nov 21, 2006 11:28 am
Location: Groningen, The Netherlands
x 18
Contact:

Re: Screen Space Global Illumination

Post by PolyVox »

Looks very cool! :D I trust you're following the current GameDev thread about this?

http://www.gamedev.net/community/forums ... _id=517130
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: Screen Space Global Illumination

Post by nullsquared »

PolyVox wrote:Looks very cool! :D I trust you're following the current GameDev thread about this?

http://www.gamedev.net/community/forums ... _id=517130
I had the idea long ago, but never got anywhere and ditched it. Then, yes, I saw that thread and went on a journey to redo what I had before and make it better :mrgreen:

I actually tried the 'coherent SSAO' implementation on there, but never got it to work. It seems to always artifact on edges, I'm not sure how the OP did it considering all of the code is right there :lol:. I was going to post some results and ideas on there, but my new account 'nullsquared' got banned, and my original 'agi_shi' got suspended. I forgot they don't like alts on there :(. agi_shi is so not me anymore, and that was the first forum I was ever on (since I was like 12), so agi_shi != nullsquared. Oh well.

The implementation on there seems extremely slow, though. It's got a million normalizations and samples and what-not that aren't needed. On the other hand, I tried to optimize mine as much as possible - it actually doesn't run much slower than SSAO itself, just all the extra texture fetches really add up. Loop body:

Code: Select all

        // reflected direction to move in for the sphere
        // (based on random samples and a random texture sample)
        // bias the random direction away from the normal
        // this tends to minimize self occlusion
        float3 randomDir = reflect(RAND_SAMPLES[i], randN) + viewNorm;

        // move new view-space position back into texture space
        #define RADIUS 0.2125
        float4 nuv = mul(ptMat, float4(viewPos.xyz + randomDir * RADIUS, 1));
        nuv.xy /= nuv.w;

        // compute occlusion based on the (scaled) Z difference
        float zd = max(far * (depth - unpack(TEX2DLOD(depthMap, nuv.xy))), 0);

        #define OCC_POW 11
        occ += saturate(pow(1.0 - saturate(zd), OCC_POW) + zd);

        // the colour-factor prevents leakage from near to far objects
        float c = smoothstep(1, 0, saturate(zd));//zd > 0.75 ? 0 : 1;
        light += TEX2DLOD(lightMap, nuv.xy).xyz * c;
        numLightSamples += c;
User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
x 3
Contact:

Re: Screen Space Global Illumination

Post by Praetor »

I tried his shader as well, with the same results as nullsquared. I got really terrible artifacting around the corners of my boxes too. Maybe it has something to do with the fact he was using spheres and columns in his tests and we are using boxes. Anyway, your results look really great. In a normal scene it's really going to add a lot of realism.
Game Development, Engine Development, Porting
http://www.darkwindmedia.com
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: Screen Space Global Illumination

Post by nullsquared »

Praetor wrote: In a normal scene it's really going to add a lot of realism.
For Portalized we created a mockup render with GI and AO in Max to see what our graphics style should look like. We're going to post a news update on www.portalized.org when we do a comparison of Portalized's real-time rendering and our original mockup...
User avatar
_tommo_
Gnoll
Posts: 677
Joined: Tue Sep 19, 2006 6:09 pm
x 5
Contact:

Re: Screen Space Global Illumination

Post by _tommo_ »

Genius. :shock:

I really like the effect, i think that it would greatly improve a real detailed scene!
I like less the framerate impact (it wouldn't even run on my $70 card :roll: )... but on higher level configurations it can be really good!

Anyway, I the "grainy" look of the thing really ruins the effect... diffuse lighting should be "diffused". Maybe you can add some blur to the global illumination buffer, this would kill the grainy look and would also mask some of the artifacts... at the cost of a couple more frames. :wink:
OverMindGames Blog
IndieVault.it: Il nuovo portale italiano su Game Dev & Indie Games
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: Screen Space Global Illumination

Post by nullsquared »

There's a blur and everything in place already, I even did a half-resolution option which I'm playing with to speed it up (just not in those screenshots, :lol:). What card do you have? If SSAO runs on your card, this will, too, just slower :mrgreen:

There's no floating point textures being used at all. So it's a lot more compatible than you'd thing.
User avatar
_tommo_
Gnoll
Posts: 677
Joined: Tue Sep 19, 2006 6:09 pm
x 5
Contact:

Re: Screen Space Global Illumination

Post by _tommo_ »

Good to hear that :D
I have an X1950 pro, and considering the 50 fps on a 8800GTX... I don't have much hopes of it being playable :roll:

Will you release a demo of your "graphic framework"?
OverMindGames Blog
IndieVault.it: Il nuovo portale italiano su Game Dev & Indie Games
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: Screen Space Global Illumination

Post by nullsquared »

_tommo_ wrote:Good to hear that :D
I have an X1950 pro, and considering the 50 fps on a 8800GTX... I don't have much hopes of it being playable :roll:
50 FPS on 8800GTX at 1440x900 full-resolution SSGI. Half-resolution is much faster, and therefore it should run fine, especially at something like 1024x768...
Will you release a demo of your "graphic framework"?
No, only betas for testers (private testing, though), and releases of Portalized :) Sorry.

Edit:
Just tested half-resolution. This seems to be the sweet-spot: much faster, and free 'blur' due to bilinear filtering :)

Edit:
Updated first post with half-resolution results.
User avatar
_tommo_
Gnoll
Posts: 677
Joined: Tue Sep 19, 2006 6:09 pm
x 5
Contact:

Re: Screen Space Global Illumination

Post by _tommo_ »

Hmm the thumb is not-so-up with the half resolution screens... the grains have become splats, and the whole image is much less "crispy" and defined... wich was to me the best thing about the GI... and the artifacts at the edges are heavy...
OverMindGames Blog
IndieVault.it: Il nuovo portale italiano su Game Dev & Indie Games
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: Screen Space Global Illumination

Post by nullsquared »

Hm. Yes, it does look less 'crisp' and I agree, the edge artifacts are pretty bad. We'll see how it goes.

Anyways, benefits of completely independent first and second bounce? Emissive-lit objects ... actually emit light :D See the first post for a screenshot...

There's no light source in there except the objects themselves, which have an emissive property.
Last edited by nullsquared on Mon Dec 29, 2008 5:09 pm, edited 1 time in total.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Screen Space Global Illumination

Post by jacmoe »

Looks great! :)

There should be a law against teasing us like this, and not giving us any source! :evil: :twisted: :lol:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: Screen Space Global Illumination

Post by nullsquared »

Scroll up, you'll see pretty much all of the 'meat' :D. Slap it in a loop and you're good to go :mrgreen:

Anyways, full-resolution looks much better than half-resolution, and performs very well with 6 samples instead of 15. Will post updates soon.

Edit:
Updated first post with emissive light bounces and removed half-resolution as it looked bad - the new performance increase comes from a blurred 6-sample version rather than 15 samples. This means 6 * 2 = 12 texture fetches in the loop, plus an addition 3 outside, 15 texture fetches for the full SSGI implementation, plus an added 10 samples for the gaussian blur.
User avatar
DanielSefton
Ogre Magi
Posts: 1235
Joined: Fri Oct 26, 2007 12:36 am
Location: Mountain View, CA
x 10
Contact:

Re: Screen Space Global Illumination

Post by DanielSefton »

You're a genius, null!

What kind of overhead does it have? i.e. framerate with it on, and framerate with it off.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Screen Space Global Illumination

Post by jacmoe »

I really dig the emissive objects! :D
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: Screen Space Global Illumination

Post by nullsquared »

DanielSefton wrote:You're a genius, null!

What kind of overhead does it have? i.e. framerate with it on, and framerate with it off.
The new version is basically the same speed as 12-sample SSAO with a gaussian blur (6-sample SSAO and 6-sample SSGI).

FPS is a non-linear measurement, so it doesn't really make much sense to compare on-off FPS measures (turning off SSGI turns off SSAO, they're one shader). But in a relatively simple scene it's about 66 FPS average on an 8800GTS at 1024x768 with the normal 'full resolution'. We'll see how it scales with larger scenes (not too bad considering it's screen space).

@ jacmoe: whatever ends up in the light buffer is whatever the SSGI uses :D
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: Screen Space Global Illumination

Post by KungFooMasta »

Looks really sweet! I did notice in the first screenshots you posted, there are no shadows below the chairs. I don't know a lot about shadows, but thought I'd point that out, if it wasn't already obvious. :P
Creator of QuickGUI!
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: Screen Space Global Illumination

Post by nullsquared »

KungFooMasta wrote:Looks really sweet! I did notice in the first screenshots you posted, there are no shadows below the chairs. I don't know a lot about shadows, but thought I'd point that out, if it wasn't already obvious. :P
Yeah, the SSAO/SSGI is really faint (read: pretty much not there) for thin objects like the chair legs, especially when they happen to be in light... It will look a lot better once direct shadows are added for the light buffer (shadows for the light sources).
User avatar
iloseall
Gremlin
Posts: 156
Joined: Sun Sep 14, 2003 3:54 am
Location: Beijing China
Contact:

Re: Screen Space Global Illumination

Post by iloseall »

Sorry, no demo this time
I like the screenshot.
broli
Halfling
Posts: 48
Joined: Fri Mar 31, 2006 5:08 pm

Re: Screen Space Global Illumination

Post by broli »

On that gamedev thread there's also mention of this cool website with a recent research paper about the subject...

Approximating Dynamic Global Illumination in Image Space: http://www.uni-koblenz.de/~ritschel/

Maybe this can help compare and maybe optimize/add some things. Their video is awesome btw.
Post Reply