[Deprecated]SSAO with XEffects (Reloaded)
Go right ahead, I provided the source and download package on the first page.devsh wrote:could i help wiht SSAO i want to have it in my game so...
Right now I have yet to sit down and really analyze my problems, or actually look at, in-depth, what I'm doing. I can't seem to find the time these days.
TheQuestion = 2B || !2B
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact:
I have some basic question about this:
- Is this give the same kind results as a real ambient occlusion? Or you have some kind of limitations?
- Is this being rendered per frame? Or it's baked at launch?
- Can it work with other light sources?
- Can it be colored (blue tinted for example as for simulating a daylight atmosphere, reddish tint to simulate a "torch" lighted atmosphere?
Halifax, you could improve your demo by putting bigger cubes (or make the camera move slower, seem the cubes are small because the movement of the camera is really fast). Also a very flat texture on the cube could reveal more of the SSAO.
Another nice thing would be to have a FPS counter on the window to evaluate the performance.
A flat plane under the mass of cubes should simultate the ground and also give a better view of what the code could do.
I've seen some kind of noise pattern, but it was not moving with the mesh, looked like some kind of unnatural overlaid noise. Is this the same for every SSAO algorithm?
- Is this give the same kind results as a real ambient occlusion? Or you have some kind of limitations?
- Is this being rendered per frame? Or it's baked at launch?
- Can it work with other light sources?
- Can it be colored (blue tinted for example as for simulating a daylight atmosphere, reddish tint to simulate a "torch" lighted atmosphere?
Halifax, you could improve your demo by putting bigger cubes (or make the camera move slower, seem the cubes are small because the movement of the camera is really fast). Also a very flat texture on the cube could reveal more of the SSAO.
Another nice thing would be to have a FPS counter on the window to evaluate the performance.
A flat plane under the mass of cubes should simultate the ground and also give a better view of what the code could do.
I've seen some kind of noise pattern, but it was not moving with the mesh, looked like some kind of unnatural overlaid noise. Is this the same for every SSAO algorithm?
It approximates the results of real ambient occlusion by using a depth buffer in screen space to simulate the hemi-sphere sampling.christianclavet wrote: Is this give the same kind results as a real ambient occlusion? Or you have some kind of limitations?
Screen-Space Ambient Occlusion is real-time technology. No baking is involved, you just have to use the shader that I provided. (I don't recommend you using the one I provided though because it's in a horrible state. )christianclavet wrote: Is this being rendered per frame? Or it's baked at launch?
Of course. It's a post-process technique. Meaning that all you need to do is get XEffects, follow this example, render your scene with the SSAO post-process enabled and there you go! It doesn't matter if you have lights or not.christianclavet wrote: Can it work with other light sources?
As of now, no. Can that feature be added in, sure no problem.christianclavet wrote: Can it be colored (blue tinted for example as for simulating a daylight atmosphere, reddish tint to simulate a "torch" lighted atmosphere?
Yes, I could really improve the demo. But really I was just doing an experiment, and wasn't even really concentrated. I will take your recommendations into consideration.
Since there seems to be so much interest in this technique, I will go write a real SSAO shader that works well, is fully integrated, and has tweak-able parameters. I'll write up a demo as well, and even try to write a little tutorial showing how to enable SSAO with XEffects already well produced shadows!
Check the topic for when I release the update.
TheQuestion = 2B || !2B
Excuse my double post, but this doesn't really fit well with my last reply.
Anyways, I just installed my new GeForce 8800GT and decided to try out my SSAO. Low and behold...all banding issues were gone! I ran the same executable that I ran with my GeForce 6150SE and no banding occured. I find this quite odd.
But anyways, there were some modifications done regardless that helped out. Nate_D provided his great randomized normals map which reduced quite a few artifacts. BlindSide's link to the article about 32-bit buffer compression helped as well. (That's what I'm currently using instead of the 16-bit depth buffer in the standard XEffects.) I think that's all the changes, at least all that I can remember for now.
I'm not releasing anything yet, considering I still have to do all I did above. But I think it's quite interesting, so here are some screenshots:
SSAO Off:
My SSAO, no blur:
Leadwerks SSAO, no blur:
My SSAO, buffer:
As you can probably see, Leadwerks's SSAO shader produces a much more dramatic effect, while mine on the other hand produces a more natural one I think. It's up to you to decide which one you like, but they both will be in the "SDK" release.
Anyways, I just installed my new GeForce 8800GT and decided to try out my SSAO. Low and behold...all banding issues were gone! I ran the same executable that I ran with my GeForce 6150SE and no banding occured. I find this quite odd.
But anyways, there were some modifications done regardless that helped out. Nate_D provided his great randomized normals map which reduced quite a few artifacts. BlindSide's link to the article about 32-bit buffer compression helped as well. (That's what I'm currently using instead of the 16-bit depth buffer in the standard XEffects.) I think that's all the changes, at least all that I can remember for now.
I'm not releasing anything yet, considering I still have to do all I did above. But I think it's quite interesting, so here are some screenshots:
SSAO Off:
My SSAO, no blur:
Leadwerks SSAO, no blur:
My SSAO, buffer:
As you can probably see, Leadwerks's SSAO shader produces a much more dramatic effect, while mine on the other hand produces a more natural one I think. It's up to you to decide which one you like, but they both will be in the "SDK" release.
TheQuestion = 2B || !2B
I'm sorry but, yours really doesn't look like ambient occlusion. It looks like you are taking the dot product of the normal with the camera direction, and doing something with that. I think this effect is called "self-occlusion" among ssao enthusiasts and is tried to be avoided at all costs (Along with the cartoon outline effect, which you have done a very good job in avoiding ).
But really, the older screenshot looks 10x better than this newer one, I'm not quite sure what you changed...
Incase you don't get the problem with your newer one, it's that if you move the camera, the AO effect will change, which isn't really supposed to happen, atleast not in such a noticable way (Aside from maybe the random texture effect). There's also no "randomness" in this new shot, which is sort of a good thing, but all the occlusion went away with it.
I'm very interested to see the code and spot the differences, good luck on the release.
But really, the older screenshot looks 10x better than this newer one, I'm not quite sure what you changed...
Incase you don't get the problem with your newer one, it's that if you move the camera, the AO effect will change, which isn't really supposed to happen, atleast not in such a noticable way (Aside from maybe the random texture effect). There's also no "randomness" in this new shot, which is sort of a good thing, but all the occlusion went away with it.
I'm very interested to see the code and spot the differences, good luck on the release.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
This line threw me for a loop, I can't really understand what your saying. As for the code, I will try my hardest to get it ready by the end of this week, but right now it's really not in a release-able state.m_krzywy wrote:Like Leadwerks SSAO but can't implement .vert and .frag with XEffectsR. Anny sugestions or code snippets?
BlindSide and I talked on IRC, and I completely agreed with his post above. The only thing I forgot to tell him is that although the Leadwerks SSAO does not appear to do real SSAO, it seems to be the effect desired by many people who aren't looking for the real SSAO, but rather a cheap effect that adds more depth to their bland scene and does define edges like an edge detection shader. At least that's been my experience.
But at any rate, I'm working with BlindSide who is trying to help me improve this shader.
TheQuestion = 2B || !2B
Don't know how to load it like you does:Halifax wrote:This line threw me for a loop, I can't really understand what your saying.m_krzywy wrote:Like Leadwerks SSAO but can't implement .vert and .frag with XEffectsR. Anny sugestions or code snippets?
Code: Select all
ssao = effect->addPostProcessingEffectFromFile( stringc( "shaders/SSAO.glsl" ) );
ITexture* randomVectors = videoDriver->getTexture( "media/SSAORandomVectors.bmp" );
effect->setPostProcessingUserTexture( randomVectors );
Your SSAO buffer looks more like some strange sort of lighting effect rather than true Ambient-occlusion.
The Ledwerks one most definitly seems to be AO, which IMO *is* what people expect ambient-occlusion to do afterall... right?
Could you maybe explain what you think "real SSAO" is?
I'm not looking to start a debate or anything, but I have always thought of SSAO as being precisely
The Ledwerks one most definitly seems to be AO, which IMO *is* what people expect ambient-occlusion to do afterall... right?
Could you maybe explain what you think "real SSAO" is?
I'm not looking to start a debate or anything, but I have always thought of SSAO as being precisely
But its good to hear you are still working to improve it, keep it upa cheap effect that adds more depth to their bland scene and does define edges like an edge detection shader
m_krzywy: The problem is that you are saving the files as .frag/.vert, then you try to load them with the extension .glsl, so try changing the extensions to .glsl.
fmx: AO (Ambient Occlusion) is exactly what it describes. The occlusion of ambient light in the scene. So basically it should be some cheap edge detection effect, like the Leadwerks shader is. Not evidenced in my screenshot, because of the resolution, is the fact that the Leadwerks shader provides significant ambient occlusion around the very outer edge of the cubes. (Where the red meets the cubes.) That shouldn't be happening.
Specifically what it models is the fact that when two objects are very close together there is a certain area where not a lot of ambient light bounces to, thus producing a soft sort of shadow (rather a lower intensity of ambient light).
fmx: AO (Ambient Occlusion) is exactly what it describes. The occlusion of ambient light in the scene. So basically it should be some cheap edge detection effect, like the Leadwerks shader is. Not evidenced in my screenshot, because of the resolution, is the fact that the Leadwerks shader provides significant ambient occlusion around the very outer edge of the cubes. (Where the red meets the cubes.) That shouldn't be happening.
Specifically what it models is the fact that when two objects are very close together there is a certain area where not a lot of ambient light bounces to, thus producing a soft sort of shadow (rather a lower intensity of ambient light).
Last edited by Halifax on Mon Mar 09, 2009 12:29 am, edited 1 time in total.
TheQuestion = 2B || !2B
Hmm yeah, thats the kind of formula I was talking about on IRC, to try and stop far away things from being shadowed.
The leadwerks shader is nice, and it's similar to how I first implemented SSAO, but it's not the way it's supposed to be done. In that sense Halifax's more on the right track except maybe he got lost along the way.
I'm still having a look over but I've got a good idea on how it should work. (And this method will solve alot of limitations inherently like shadowing far away things, SSAO effect getting too strong or weak depending on camera distance, and camera angle dependency.). Don't worry I won't butcher your shader too much Halifax.
The leadwerks shader is nice, and it's similar to how I first implemented SSAO, but it's not the way it's supposed to be done. In that sense Halifax's more on the right track except maybe he got lost along the way.
I'm still having a look over but I've got a good idea on how it should work. (And this method will solve alot of limitations inherently like shadowing far away things, SSAO effect getting too strong or weak depending on camera distance, and camera angle dependency.). Don't worry I won't butcher your shader too much Halifax.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Butcher away BlindSide. As I've said on the IRC channel, I'm here to learn. And right now I'm trying to solve the problem, but simply can't due to my severe lack of knowledge when it comes to shaders.BlindSide wrote:Hmm yeah, thats the kind of formula I was talking about on IRC, to try and stop far away things from being shadowed.
The leadwerks shader is nice, and it's similar to how I first implemented SSAO, but it's not the way it's supposed to be done. In that sense Halifax's more on the right track except maybe he got lost along the way.
I'm still having a look over but I've got a good idea on how it should work. (And this method will solve alot of limitations inherently like shadowing far away things, SSAO effect getting too strong or weak depending on camera distance, and camera angle dependency.). Don't worry I won't butcher your shader too much Halifax.
So I thank you very much for any help you provide.
TheQuestion = 2B || !2B