Page 1 of 2
Screen Space Global Illumination
Posted: Sun Dec 28, 2008 11:35 pm
by nullsquared
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?
Re: Screen Space Global Illumination
Posted: Sun Dec 28, 2008 11:43 pm
by jacmoe
Definitely up!
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 12:55 am
by jjp
To hell with "correctness" when it comes to diffuse indirect lighting. This actually looks pretty decent
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 1:01 am
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.
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 2:08 am
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.
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 2:15 am
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
. 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
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
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 2:24 am
by PolyVox
Looks very cool!
I trust you're following the current GameDev thread about this?
http://www.gamedev.net/community/forums ... _id=517130
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 2:33 am
by nullsquared
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
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;
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 2:40 am
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.
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 2:45 am
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...
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 2:41 pm
by _tommo_
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.
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 2:50 pm
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,
). 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.
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 2:53 pm
by _tommo_
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"?
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 2:58 pm
by nullsquared
_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
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.
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 3:46 pm
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...
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 4:02 pm
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
See the first post for a screenshot...
There's no light source in there except the objects themselves, which have an emissive property.
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 4:43 pm
by jacmoe
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 5:02 pm
by nullsquared
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.
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 5:16 pm
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.
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 5:22 pm
by jacmoe
I really dig the emissive objects!
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 5:24 pm
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
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 10:22 pm
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.
Re: Screen Space Global Illumination
Posted: Mon Dec 29, 2008 10:52 pm
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.
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).
Re: Screen Space Global Illumination
Posted: Wed Dec 31, 2008 4:28 pm
by iloseall
Sorry, no demo this time
I like the screenshot.
Re: Screen Space Global Illumination
Posted: Wed Dec 31, 2008 7:23 pm
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.