Horde3D
http://horde3d.org/forums/

SSAO and NPR shading in practice
http://horde3d.org/forums/viewtopic.php?f=2&t=1199
Page 1 of 1

Author:  karstux [ 21.07.2010, 13:51 ]
Post subject:  SSAO and NPR shading in practice

Hi,

I'm currently trying to create a visually pleasing environment for the techdemos in our research group, using Horde3D.

To that end, I've tried to implement a shading technique that will illuminate the scene in a non-photorealistic, global manner - without actually placing lights in the scene. At the moment I'm combining SSAO and flat texture shading, and I'm halfway pleased with the outcome. (I've attached a sample output below.)

Image

However, you can see that there are some problems with my approach. Most obvious is the strong blurring of some of the geometry when I multiply the flat shaded buffer with the ambient occlusion buffer. Seeing the application in motion, there are also some shading artifacts whenever the view changes. I'm not sure how to fix any of that.

For the SSAO shader, I more-or-less copied the one from here. I'm making my source code (binary included) available here: http://www.compsens.uni-tuebingen.de/pub/pages/personals/10/SSAO_test.zip

If any of you have suggestions how to improve my rendering, I'd be grateful.

Karsten

Author:  worstplayer [ 21.07.2010, 18:39 ]
Post subject:  Re: SSAO and NPR shading in practice

First thing you should do is to eliminate low frequency noise. Assuming you use screen coordinates as a seed for PRNG you can simply do something like
vec2 coord=mod(gl_FragCoord.xy,4.0);

High frequency noise can then be eliminated with selective blur (based on depth, or even better depth and normal).

EDIT: Looking at your code...
Using texture instead of prng, very interesting approach. I wonder if it's more efficient.

Anyway, try replacing

vec3 fres = normalize((texture2D(randomSamples,texCoords*offset).xyz*2.0) - vec3(1.0));
with
vec2 rngCoords=mod(gl_FragCoord.xy,8.0)/8.0;
vec3 fres = normalize((texture2D(randomSamples,rngCoords*offset).xyz*2.0) - vec3(1.0));

that will remove low frequency noise, selective filter should be easy.

EDIT2: If AO is your only form of shading, I'd recommend trying this method. It's slower but much less direction dependent.

Author:  marciano [ 22.07.2010, 22:41 ]
Post subject:  Re: SSAO and NPR shading in practice

There are so many different SSAO implementations these days that it's tough to pick the best one ;)
A well documented one which looks quite promising at a first glance is here. It is relatively simple and should be easy to integrate into our deferred pipeline.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/