Commit 09504c69 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] simplified radius calculation for each hemisphere

parent ba495b1a
......@@ -372,40 +372,16 @@ float getLineAO( vec2 where )
float occlusion = 0.0;
float radiusScaler = 0.0; // we sample with multiple radii, so use a scaling factor here
// this allows an adaptive radius
float[SCALERS] rads;
#define radScaleMin 0.5
#define radScaleMax 3.0
rads[0] = radScaleMin + 0.0 * ( radScaleMax / SCALERS );
#if ( SCALERS > 1 )
rads[1] = radScaleMin + 1.0 * ( radScaleMax / SCALERS );
#endif
#if ( SCALERS > 2 )
rads[2] = radScaleMin + 2.0 * ( radScaleMax / SCALERS );
#endif
#if ( SCALERS > 3 )
rads[3] = radScaleMin + 3.0 * ( radScaleMax / SCALERS );
#endif
#if ( SCALERS > 4 )
rads[4] = radScaleMin + 4.0 * ( radScaleMax / SCALERS );
#endif
#if ( SCALERS > 5 )
rads[5] = radScaleMin + 5.0 * ( radScaleMax / SCALERS );
#endif
#if ( SCALERS > 6 )
rads[5] = radScaleMin + 6.0 * ( radScaleMax / SCALERS );
#endif
#if ( SCALERS > 7 )
rads[5] = radScaleMin + 7.0 * ( radScaleMax / SCALERS );
#endif
float fac = 0.0;
float maxi = 0.0;
// sample for different radii
for( int l = 0; l < SCALERS; ++l )
{
float occlusionStep = 0.0; // this variable accumulates the occlusion for the current radius
radiusScaler += rads[ l ]; // increment radius each time.
// this allows an adaptive radius
// NOTE: we do not exactly use the linear scaling from the paper here. Although they look very similar, the non-linear radius, which
// increases non-linearly with the level l, improves visual quality a bit.
#define radScaleMin 1.5
radiusScaler += radScaleMin + l; // increment radius each time.
// Get SAMPLES-times samples on the hemisphere and check for occluders
for( int i = 0; i < SAMPLES; ++i )
......@@ -480,8 +456,7 @@ float getLineAO( vec2 where )
}
// for this radius, add to total occlusion
occlusion += occlusionStep / float( SCALERS );
maxi = max( occlusionStep, maxi );
occlusion += occlusionStep;
}
// output the result
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment