Screen Space Global Illumination
- nullsquared
- Old One
- Posts: 3245
- Joined: Tue Apr 24, 2007 8:23 pm
- Location: NY, NY, USA
- x 11
Screen Space Global Illumination
A bit of an over-ambitious title for such a big hack, but, hey, it looks cool
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:
On:
Off:
On:
Another:
A screen shot of the second bounce:
Since objects with an emissive property are correctly accumulated into the light buffer, they actually behave as ... well, emissive
Off:
On:
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
Anyways, what do you guys think? Thumbs up or down?
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:
On:
Off:
On:
Another:
A screen shot of the second bounce:
Since objects with an emissive property are correctly accumulated into the light buffer, they actually behave as ... well, emissive
Off:
On:
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
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.
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: Screen Space Global Illumination
Definitely up!
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Silver Sponsor
- Posts: 597
- Joined: Sun Jan 07, 2007 11:55 pm
- Location: Cologne, Germany
- Contact:
Re: Screen Space Global Illumination
To hell with "correctness" when it comes to diffuse indirect lighting. This actually looks pretty decent
Enough is never enough.
- nullsquared
- Old One
- Posts: 3245
- Joined: Tue Apr 24, 2007 8:23 pm
- Location: NY, NY, USA
- x 11
Re: Screen Space Global Illumination
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.jjp wrote:To hell with "correctness" when it comes to diffuse indirect lighting. This actually looks pretty decent
- Praetor
- 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
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
http://www.darkwindmedia.com
- nullsquared
- Old One
- Posts: 3245
- Joined: Tue Apr 24, 2007 8:23 pm
- Location: NY, NY, USA
- x 11
Re: Screen Space Global Illumination
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 . Svenstaro says on his 8800GTX it runs at 40 FPS at 1440x900, which is excellent considering he was rendering a 3DSMax animation in the backgroundPraetor 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.
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 . The speed is excellent in my opinion, and visual trade off is not that bad
- PolyVox
- OGRE Contributor
- Posts: 1316
- Joined: Tue Nov 21, 2006 11:28 am
- Location: Groningen, The Netherlands
- x 18
- Contact:
Re: Screen Space Global Illumination
Looks very cool! I trust you're following the current GameDev thread about this?
http://www.gamedev.net/community/forums ... _id=517130
http://www.gamedev.net/community/forums ... _id=517130
- nullsquared
- Old One
- Posts: 3245
- Joined: Tue Apr 24, 2007 8:23 pm
- Location: NY, NY, USA
- x 11
Re: Screen Space Global Illumination
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 betterPolyVox wrote:Looks very cool! I trust you're following the current GameDev thread about this?
http://www.gamedev.net/community/forums ... _id=517130
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 . 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;
- Praetor
- 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
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
http://www.darkwindmedia.com
- nullsquared
- Old One
- Posts: 3245
- Joined: Tue Apr 24, 2007 8:23 pm
- Location: NY, NY, USA
- x 11
Re: Screen Space Global Illumination
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...Praetor wrote: In a normal scene it's really going to add a lot of realism.
- _tommo_
- Gnoll
- Posts: 677
- Joined: Tue Sep 19, 2006 6:09 pm
- x 5
- Contact:
Re: Screen Space Global Illumination
Genius.
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 )... 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.
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 )... 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.
- nullsquared
- Old One
- Posts: 3245
- Joined: Tue Apr 24, 2007 8:23 pm
- Location: NY, NY, USA
- x 11
Re: Screen Space Global Illumination
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, ). What card do you have? If SSAO runs on your card, this will, too, just slower
There's no floating point textures being used at all. So it's a lot more compatible than you'd thing.
There's no floating point textures being used at all. So it's a lot more compatible than you'd thing.
- _tommo_
- Gnoll
- Posts: 677
- Joined: Tue Sep 19, 2006 6:09 pm
- x 5
- Contact:
Re: Screen Space Global Illumination
Good to hear that
I have an X1950 pro, and considering the 50 fps on a 8800GTX... I don't have much hopes of it being playable
Will you release a demo of your "graphic framework"?
I have an X1950 pro, and considering the 50 fps on a 8800GTX... I don't have much hopes of it being playable
Will you release a demo of your "graphic framework"?
- nullsquared
- Old One
- Posts: 3245
- Joined: Tue Apr 24, 2007 8:23 pm
- Location: NY, NY, USA
- x 11
Re: Screen Space Global Illumination
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..._tommo_ wrote:Good to hear that
I have an X1950 pro, and considering the 50 fps on a 8800GTX... I don't have much hopes of it being playable
No, only betas for testers (private testing, though), and releases of Portalized Sorry.Will you release a demo of your "graphic framework"?
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.
- _tommo_
- Gnoll
- Posts: 677
- Joined: Tue Sep 19, 2006 6:09 pm
- x 5
- Contact:
Re: Screen Space Global Illumination
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...
- nullsquared
- Old One
- Posts: 3245
- Joined: Tue Apr 24, 2007 8:23 pm
- Location: NY, NY, USA
- x 11
Re: Screen Space Global Illumination
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 See the first post for a screenshot...
There's no light source in there except the objects themselves, which have an emissive property.
Anyways, benefits of completely independent first and second bounce? Emissive-lit objects ... actually emit light 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.
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: Screen Space Global Illumination
Looks great!
There should be a law against teasing us like this, and not giving us any source!
There should be a law against teasing us like this, and not giving us any source!
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
- nullsquared
- Old One
- Posts: 3245
- Joined: Tue Apr 24, 2007 8:23 pm
- Location: NY, NY, USA
- x 11
Re: Screen Space Global Illumination
Scroll up, you'll see pretty much all of the 'meat' . Slap it in a loop and you're good to go
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.
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.
- 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
You're a genius, null!
What kind of overhead does it have? i.e. framerate with it on, and framerate with it off.
What kind of overhead does it have? i.e. framerate with it on, and framerate with it off.
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: Screen Space Global Illumination
I really dig the emissive objects!
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
- nullsquared
- Old One
- Posts: 3245
- Joined: Tue Apr 24, 2007 8:23 pm
- Location: NY, NY, USA
- x 11
Re: Screen Space Global Illumination
The new version is basically the same speed as 12-sample SSAO with a gaussian blur (6-sample SSAO and 6-sample SSGI).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.
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
- KungFooMasta
- OGRE Contributor
- Posts: 2087
- Joined: Thu Mar 03, 2005 7:11 am
- Location: WA, USA
- x 16
- Contact:
Re: Screen Space Global Illumination
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.
Creator of QuickGUI!
- nullsquared
- Old One
- Posts: 3245
- Joined: Tue Apr 24, 2007 8:23 pm
- Location: NY, NY, USA
- x 11
Re: Screen Space Global Illumination
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).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.
- iloseall
- Gremlin
- Posts: 156
- Joined: Sun Sep 14, 2003 3:54 am
- Location: Beijing China
- Contact:
Re: Screen Space Global Illumination
I like the screenshot.Sorry, no demo this time
-
- Halfling
- Posts: 48
- Joined: Fri Mar 31, 2006 5:08 pm
Re: Screen Space Global Illumination
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.
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.