DX11 - SSAO

Started by
12 comments, last by Migi0027 10 years, 9 months ago

So are my values correct, taking away the radius?

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/, cuboidzone.wordpress.com/

Advertisement

Using radius of 0.1:

2cia4ps.png

I have absolutely no idea of where i snapped these values. laugh.png

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/, cuboidzone.wordpress.com/

I played a little more with this and done some changes that look better then before (at least for me), so you might want to try:

1. I have normalized view space normals in texture, and i don't get why do we need to scale-bias here? Also, this fixes some ugly artifacts.


float3 getNormal(in float2 uv)
{
    //return normalize(tex2D(gbNormal_samp, uv).xyz * 2.0f - 1.0f);
    return tex2D(gbNormal_samp, uv).xyz;
}

So you might need to change your gbuffer normal to be normalized also

output.Normals = float4(normalize(input.NormalW), 1);

2. I had getRandom before which looks nice for me:


float3 getRandom(in float2 uv)
{
    return tex2D(rand_samp, uv * ScreenParams.xy / 4.0f).xyz * 2.0f - 1.0f;
}

3. Setting scale to 0 looks better for me, so i can even remove some calculations:


float doAmbientOcclusion(in float2 tcoord,in float2 uv, in float3 p, in float3 cnorm)
{
    float g_scale = SSAO_params.x;
    float g_bias = SSAO_params.y;
    float g_intensity = SSAO_params.z;

    float3 diff = getPosition(tcoord + uv) - p;
    const float3 v = normalize(diff);
    //const float d = length(diff)*g_scale;
    return max(0.0,dot(cnorm,v)-g_bias)*g_intensity;//(1.0/(1.0+d))*g_intensity;
}

4. I get strange "haloing" artifacts on screen corners, so i set position and normal texture UV addressing mode to mirror and it seems that fixes that issue.

5. Changed radius to 0.15 and intensity to ~2.5

The reason for the false occlusions at the corners is simply because there is nothing in the scene there,

2db9ok1.png

But as you see in the bottom, when I go too close to the mesh, these false occlusions start to appear, and when really close, they're everywhere!

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/, cuboidzone.wordpress.com/

This topic is closed to new replies.

Advertisement