• Create Account

Banner advertising on our site currently available from just \$5!

### #Actualbelfegor

Posted 18 July 2013 - 01:50 PM

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

### #1belfegor

Posted 18 July 2013 - 01:46 PM

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.

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


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

PARTNERS