SSAO

Posted By: lostclimate

SSAO - 12/08/08 07:43

my latest expirimentation... SSAO

A big credit to slin who helped me understand how to render a depthmap.

Heres what i have so far:




well actually there is a blur filter over the shading in my current version that is not shown, but it makes the really dark bars look even worse so im still working on it.
Posted By: Quad

Re: SSAO - 12/08/08 08:01

pretty damn nice...

and it's fast???
Posted By: lostclimate

Re: SSAO - 12/08/08 08:19

well fullscreen with a 1024x768 resolution, with an extra blur filter over it, it gets 85fps on my machine. keep in mind this is with on depthmap retrieving shader, with an ssao shader that takes 12 samples, and another blur filter over it that takes another 12 samples, so its is running it surprisingly fast for whats involved. my graphics card is a nvidia 9600 gt.


EDIT:
Some images of it with the blur filter over the ssao:







Posted By: VeT

Re: SSAO - 12/08/08 08:28

its looking very good

i'm not too famous with this shader, but looking like shadows are not on their places... or this is the main target of SSAO?


if i made bad screen( if its hard to understand what i mean), i can make some more screens smile
Posted By: lostclimate

Re: SSAO - 12/08/08 08:40

its sort of what ssao does. it shouldnt be so dark there and that line shouldnt stick out like that, but it is supposed to make areas that are near "occluded" areas darker in order to simulate ambient shading in the room.
Posted By: VeT

Re: SSAO - 12/08/08 17:30

in corners of the room i think, but on the screen shadow is on the edge of walls, where shadows mustn't be...
okay, i'd belive you laugh
Posted By: Cowabanga

Re: SSAO - 12/08/08 18:23

awesome job lostclimate smile .
Posted By: lostclimate

Re: SSAO - 12/10/08 02:58

well, ive determined that the rings come from a depth issue. the shallower it reads from the closer the rings are until its solid. if only there was enough way to pack more precision into it easier (racking my brain right now)

thought this will be interesting (off of the msdn hlsl reference)

Quote:

double - 64-bit floating point value, that can be used inside a shader function in Direct3D 11 (see the topic, Double Precision in the Direct3D 11 docs).

doubles in shaders? i might just need to get vista when dx 11 comes out laugh
Posted By: JibbSmart

Re: SSAO - 12/10/08 05:14

i'm quite surprised float precision isn't enough!

julz
Posted By: lostclimate

Re: SSAO - 12/10/08 05:45

it is or others wouldnt be able to make it :P i just dont know how they are doing it...
Posted By: JibbSmart

Re: SSAO - 12/10/08 11:20

are you using 16 bit floating point texture, or 32 bit floating point texture? (if you're using BMAP* name = "#widthxheightxbits"; is the "bits" bit 12 or 14?) and if you're doing floating point textures a different way, what way is that?

julz
Posted By: BoH_Havoc

Re: SSAO - 12/10/08 15:00

The whole problem has nothing to do with 16 or 32 bit fp. You can even do ssao with 32bit rgba if you encode the depthmap.

You have to do a simple depthtest and check if a blurred part of the depthmap intersects with a "far away" part of the depthmap. If this is the case you simply don't apply ssao. And there you go: The black line are gone.
Now creating the code for all this is not quite as easy, but basically that's what you have to do smile
Posted By: lostclimate

Re: SSAO - 12/10/08 17:26

oh, no, ive already done that. im talking about the rings that happen on surfaces facing (or close to facing) the camera. what im doing rihgt now is actually 32bit rgba (not sure how to do floating point textures the way i have it set up so maybe thats what i need to work on.)
Posted By: BoH_Havoc

Re: SSAO - 12/10/08 20:03

Ah sorry, i thought you were talking about this bug:




As you are using 32bit rgba, you could try to encode your depthmap like this:

encode (depthmap shader):
float depth = Color.r; //this is the depth
Color.r = floor(Color.r*127)/127;
Color.g = floor((depth-Color.r)*127*127)/127;

decode (ssao shader):
float depth = tex2D(depthSampler,inTex).r + tex2D(depthSampler,inTex).g/127;

This should drastically reduce the "rings". However ultimately you might want to use a 32bit floating point texture:

bmap_to_format(depthTexture,14);

and then only write/read from the red channel of your depthmap.

Hope this helps smile

Posted By: lostclimate

Re: SSAO - 12/10/08 23:52

i checked this a little late, slin already helped me with it, although even he was stumped a couple times. eventually though after several hours and a complete script rewrite:




need to get rid of the lines again, the only issue ill have is that any places that need to actually be dark, get filtered out the only way i know of doing this.
Posted By: JibbSmart

Re: SSAO - 12/11/08 05:23

nice work!

i think foxfire solved that problem (is an area really being occluded or not?) using a few ray-traces, but i doubt that would be necessary.

julz
Posted By: lostclimate

Re: SSAO - 12/12/08 20:55

trying to do some normal tests to fix the black lines (even though 2 days ago i told myself i wouldnt mess with it anymore :P )



Posted By: broozar

Re: SSAO - 12/12/08 21:21

that looks so much better. a bit blurry, though.
Posted By: lostclimate

Re: SSAO - 12/12/08 22:55

thanks, im working on it :P
Posted By: lostclimate

Re: SSAO - 12/15/08 02:22

well it is to the point were i am very happy with it, some the dark lines are gone for the most part (although there are some halos on some of the edges because if my "depth detection test" to see if its to far to calculate. but it isnt too noticable, and once i get dynamic lightmapping in (either via slins work or boh_havocs work) it will be barely noticable. not ssao is perfect, and im not going to attempt to even get mine close. I'd show another screen but i have to wait until i have another environment to show you it on since the only one i have right now is a level im working on for a client, and i shouldnt be showing that.
Posted By: lostclimate

Re: SSAO - 12/21/08 19:22

heres a screen showing what effect it has on the venice demo. still having problems with artifacts on models/sprites with gradual transparancy, and with skyboxes being shaded (which i can probably easily fix.) well here we go:

Before:



after:


Posted By: croman

Re: SSAO - 12/21/08 19:54

it looks good, just fix those dark lines surrounding the models and it will be awesome stuff smile
© 2024 lite-C Forums