|
|
Re: the cart before the horse
[Re: txesmi]
#421585
04/20/13 19:06
04/20/13 19:06
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
Looks awesome! May I ask how you calculate the ambient occlusion? I'm currently using a randomly rotated kernel (normal oriented hemisphere) with 14 samples and a 5 tap filter but the result is still a bit noisy and not that fast... 
POTATO-MAN saves the day! - Random
|
|
|
Re: the cart before the horse
[Re: Kartoffel]
#421599
04/21/13 07:10
04/21/13 07:10
|
Joined: Jun 2007
Posts: 1,337 Hiporope and its pain
txesmi
OP
Serious User
|
OP
Serious User
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
|
this ao fake is not a spatial calculation but a screen calculation. Since the polygons depth is in a small range it looks good. The depthmap is in view space.
// Ambient occlusion
float2 Offset = 0;
float fScale = 9.0f;
float fScaleStep = 1.6f;
float fAmbientOcclusion = 0.6f;
int index = ( ( inTex.x + inTex.y ) * vecViewPort.x ) % 4;
for (int i=0; i<4; i++)
{
for (int ii = 0; ii < 8; ii++)
{
Offset.x = coors[index][ii].x * fScale * vecViewPort.z;
Offset.y = coors[index][ii].y * fScale * vecViewPort.w;
Offset.xy += fSunDir.xy * i * 0.002f;
float fNewDepth = tex2Dlod ( DepthSampler, float4(inTex.xy+Offset.xy,0,0) ).r;
fAmbientOcclusion += fDepth < fNewDepth ? 0.015625f : -0.015625f;
}
fScale *= fScaleStep;
}
I blur the result with a 5x5 cubic gaussian blur in two stages
|
|
|
|