Untitled
Toggle main menu visibility
Loading...
Searching...
No Matches
ssao_blur.frag
Go to the documentation of this file.
1
#version 330 core
2
out
float
FragColor
;
3
in
vec2
vUV
;
4
5
uniform sampler2D
uSSAOInput
;
6
uniform sampler2D
uDepth
;
7
8
void
main
() {
9
vec2
texelSize = 1.0 /
vec2
(textureSize(
uSSAOInput
, 0));
10
11
12
float
result = 0.0;
13
float
weightSum = 0.0;
14
15
float
centerDepth = texture(
uDepth
,
vUV
).r;
16
17
for
(
int
x = -2; x <= 2; ++x) {
18
for
(
int
y = -2; y <= 2; ++y) {
19
20
vec2
offset =
vec2
(
float
(x),
float
(y)) * texelSize;
21
vec2
sampleUV =
vUV
+ offset;
22
23
float
sampleAO = texture(
uSSAOInput
, sampleUV).r;
24
float
sampleDepth = texture(
uDepth
, sampleUV).r;
25
26
float
depthDiff = abs(centerDepth - sampleDepth);
27
28
float
weight = exp(-depthDiff * 1000.0);
29
30
result += sampleAO * weight;
31
weightSum += weight;
32
}
33
}
34
35
FragColor
= result / weightSum;
36
37
}
main
void main()
Definition
audio_probe_bake.comp:465
uDepth
uniform sampler2D uDepth
Definition
depth_downsample.frag:2
vUV
in vec2 vUV
Definition
lightmap.frag:13
uSSAOInput
uniform sampler2D uSSAOInput
Definition
ssao_blur.frag:5
FragColor
out float FragColor
Definition
ssao_blur.frag:2
vec2
Definition
types.h:11
src
render
ssao_blur.frag
Generated by
1.18.0