Skip to main content
GameDev.net gamedev.net
🔒 Locked

ssao_crytek

Started by aashish24 May 19, 2011 at 1:31 AM 4 replies 2.5k views
Original Post
aashish24
aashish24
[font=arial, verdana, tahoma, sans-serif][size=2]Folks,

I have been trying to implement various ssao and now I am trying to implement crytek ssao and applying some form of bilateral blur. The images looks convincing but I see lot of bands and some halos (though I think thats expected with crytek ssao)..

Attached are some screenshots any comment or help is appreciated.

Thanks[/font]
Ashaman73
Ashaman73
The effect looks too dark, even large,plane surfaces have a high occlusion value. This could also explain the banding effect because you seem to use mostly a small portion of the available value range.
aashish24
aashish24

The effect looks too dark, even large,plane surfaces have a high occlusion value. This could also explain the banding effect because you seem to use mostly a small portion of the available value range.


Well yes, according to the shader in ShaderX7 I was doing this..

calculateSSAO(...)
{
...
..
ao[color=#9f4f00] =[color=#9f4f00] (ao[color=#9f4f00] /[color=#9f4f00] actualNumberOfSamples);[color=#006400]//[color=#9f4f00] [color=#006400]ao[color=#9f4f00] [color=#006400]=[color=#9f4f00] [color=#006400](ao[color=#9f4f00] [color=#006400]*[color=#9f4f00] [color=#006400]ao[color=#9f4f00] [color=#006400]+[color=#9f4f00] [color=#006400]ao); --> Saturation.. ao[color=#9f4f00] =[color=#9f4f00] clamp(ao,[color=#9f4f00] [color=#000080]0.0,[color=#9f4f00] [color=#000080]1.0);[color=#2b5f01]return[color=#9f4f00] ao;}
If I don't do that that.. I still bet banding but now not noticeable as much.. (attached is updated screenshost)
Yours3!f
Yours3!f
I dont know if you remember, but when this year Crysis 2 was about to hit the shelves, someone (probably a Russian) stole an early build of the game. Now what's interesting is that it contained the shader source codes.
I haven't seen the source code, but it might be interesting and might help you with what you're missing. Note that it will probably be written in DX HLSL language.
Ashaman73
Ashaman73

[quote name='Ashaman73' timestamp='1305784430' post='4812887']
The effect looks too dark, even large,plane surfaces have a high occlusion value. This could also explain the banding effect because you seem to use mostly a small portion of the available value range.


Well yes, according to the shader in ShaderX7 I was doing this..

calculateSSAO(...)
{
...
..
ao = (ao / actualNumberOfSamples);[color="#006400"]// [color="#006400"]ao [color="#006400"]= [color="#006400"](ao [color="#006400"]* [color="#006400"]ao [color="#006400"]+ [color="#006400"]ao); --> Saturation.. ao = clamp(ao, [color="#000080"]0.0, [color="#000080"]1.0);[color="#2b5f01"]return ao;}
If I don't do that that.. I still bet banding but now not noticeable as much.. (attached is updated screenshost)
[/quote]
I think you still got lot of self-occlussion (i.e. a plane surface like the floor is shaded by itself). But this seems to be a problem of the initial crytek SSAO shader. To get rid of it you need to restrict the test rays only to the hemisphere which is pointing away from the surface. This could be done by using the surface normal and mirror all rays which are pointing "inside" the surface.

Gamedev.net has a good article about SSAO over here.
aashish24
aashish24

[quote name='aashish24' timestamp='1305813762' post='4812994']
[quote name='Ashaman73' timestamp='1305784430' post='4812887']
The effect looks too dark, even large,plane surfaces have a high occlusion value. This could also explain the banding effect because you seem to use mostly a small portion of the available value range.


Well yes, according to the shader in ShaderX7 I was doing this..

calculateSSAO(...)
{
...
..
ao = (ao / actualNumberOfSamples);[color="#006400"]// [color="#006400"]ao [color="#006400"]= [color="#006400"](ao [color="#006400"]* [color="#006400"]ao [color="#006400"]+ [color="#006400"]ao); --> Saturation.. ao = clamp(ao, [color="#000080"]0.0, [color="#000080"]1.0);[color="#2b5f01"]return ao;}
If I don't do that that.. I still bet banding but now not noticeable as much.. (attached is updated screenshost)
[/quote]
I think you still got lot of self-occlussion (i.e. a plane surface like the floor is shaded by itself). But this seems to be a problem of the initial crytek SSAO shader. To get rid of it you need to restrict the test rays only to the hemisphere which is pointing away from the surface. This could be done by using the surface normal and mirror all rays which are pointing "inside" the surface.



Yes like I said crytek implementation has that issue. I am not trying to make any improvements (other than clamping texture fetch). I just wanted to make sure that I can implement the algorithm using my framework and in OpenGL..

Gamedev.net has a good article about SSAO over here.

Yes, I have implemented this algorithm too. Actually I had to tweak 1-2 things to get it to work on OpenGL. Thanks for your feedback..




[/quote]


Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.