Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
09504c69
Commit
09504c69
authored
Jan 09, 2012
by
Sebastian Eichelbaum
Browse files
[CHANGE] simplified radius calculation for each hemisphere
parent
ba495b1a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
32 deletions
+7
-32
src/core/graphicsEngine/shaders/shaders/WGEPostprocessor-fragment.glsl
...hicsEngine/shaders/shaders/WGEPostprocessor-fragment.glsl
+7
-32
No files found.
src/core/graphicsEngine/shaders/shaders/WGEPostprocessor-fragment.glsl
View file @
09504c69
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment