Sign in to follow this  
aashish24

ssao_crytek

Recommended Posts

aashish24    100
[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[/size][/font]

Share this post


Link to post
Share on other sites
Ashaman73    13715
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.

Share this post


Link to post
Share on other sites
aashish24    100
[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.
[/quote]

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

calculateSSAO(...)
{
...
..
ao[color=#9f4f00] [/color]=[color=#9f4f00] [/color](ao[color=#9f4f00] [/color]/[color=#9f4f00] [/color]actualNumberOfSamples);[color=#006400]//[/color][color=#9f4f00] [/color][color=#006400]ao[/color][color=#9f4f00] [/color][color=#006400]=[/color][color=#9f4f00] [/color][color=#006400](ao[/color][color=#9f4f00] [/color][color=#006400]*[/color][color=#9f4f00] [/color][color=#006400]ao[/color][color=#9f4f00] [/color][color=#006400]+[/color][color=#9f4f00] [/color][color=#006400]ao); --> Saturation.. [/color]ao[color=#9f4f00] [/color]=[color=#9f4f00] [/color]clamp(ao,[color=#9f4f00] [/color][color=#000080]0.0[/color],[color=#9f4f00] [/color][color=#000080]1.0[/color]);[color=#2b5f01]return[/color][color=#9f4f00] [/color]ao;}
If I don't do that that.. I still bet banding but now not noticeable as much.. (attached is updated screenshost)

Share this post


Link to post
Share on other sites
Yours3!f    1532
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.

Share this post


Link to post
Share on other sites
Ashaman73    13715
[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.
[/quote]

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

calculateSSAO(...)
{
...
..
ao = (ao / actualNumberOfSamples);[color="#006400"]//[/color] [color="#006400"]ao[/color] [color="#006400"]=[/color] [color="#006400"](ao[/color] [color="#006400"]*[/color] [color="#006400"]ao[/color] [color="#006400"]+[/color] [color="#006400"]ao); --> Saturation.. [/color]ao = clamp(ao, [color="#000080"]0.0[/color], [color="#000080"]1.0[/color]);[color="#2b5f01"]return[/color] 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 [url="http://www.gamedev.net/page/reference/index.html/_/reference/programming/140/lighting-and-shading/a-simple-and-practical-approach-to-ssao-r2753"]here[/url].

Share this post


Link to post
Share on other sites
aashish24    100
[quote name='Ashaman73' timestamp='1305876011' post='4813364']
[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.
[/quote]

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

calculateSSAO(...)
{
...
..
ao = (ao / actualNumberOfSamples);[color="#006400"]//[/color] [color="#006400"]ao[/color] [color="#006400"]=[/color] [color="#006400"](ao[/color] [color="#006400"]*[/color] [color="#006400"]ao[/color] [color="#006400"]+[/color] [color="#006400"]ao); --> Saturation.. [/color]ao = clamp(ao, [color="#000080"]0.0[/color], [color="#000080"]1.0[/color]);[color="#2b5f01"]return[/color] 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 [url="http://www.gamedev.net/page/reference/index.html/_/reference/programming/140/lighting-and-shading/a-simple-and-practical-approach-to-ssao-r2753"]here[/url].

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]


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this