blob: 7c448cd4f030dec8ebcc11c21a39141721957bd9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#ifndef SSAO_CUSTOM_MATERIAL_GLSLLIB
#define SSAO_CUSTOM_MATERIAL_GLSLLIB
#ifndef UIC_ENABLE_SSAO
#define UIC_ENABLE_SSAO 0
#endif
#ifndef UIC_ENABLE_SSDO
#define UIC_ENABLE_SSDO 0
#endif
#if UIC_ENABLE_SSAO || UIC_ENABLE_SSDO
#include "viewProperties.glsllib"
#if UIC_ENABLE_SSDO
#include "screenSpaceDO.glsllib"
layout (std140) uniform cbAoShadow {
vec4 ao_properties;
vec4 ao_properties2;
vec4 shadow_properties;
vec4 aoScreenConst;
vec4 UvToEyeConst;
};
uniform sampler2D depth_sampler;
#endif
uniform sampler2D ao_sampler;
#endif // UIC_ENABLE_SSAO || UIC_ENABLE_SSDO
#if UIC_ENABLE_SSAO
float customMaterialAO()
{
#if UIC_ENABLE_SSDO
vec2 smpUV = (gl_FragCoord.xy) * aoScreenConst.zw;
#else
ivec2 iSize = textureSize(ao_sampler, 0);
vec2 smpUV = (gl_FragCoord.xy) / vec2(iSize);
#endif
return texture(ao_sampler, smpUV).x;
}
#else
float customMaterialAO()
{
return 1.0;
}
#endif
#if UIC_ENABLE_SSDO
float customMaterialShadow( vec3 lightDir, vec3 varWorldPos )
{
return shadowOcclusion( depth_sampler, lightDir, varWorldPos, viewMatrix, viewProjectionMatrix, shadow_properties, camera_properties, aoScreenConst, UvToEyeConst );
}
#else
float customMaterialShadow( vec3 lightDir, vec3 varWorldPos )
{
return 1.0;
}
#endif
#endif // #ifndef SSAO_CUSTOM_MATERIAL_GLSLLIB
|