Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gpu_shader_material_ambient_occlusion.glsl « material « shaders « gpu « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: edf2c93c9a05edcbf6a2085824cc06bc201d91b6 (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
#ifndef VOLUMETRICS
void node_ambient_occlusion(vec4 color,
                            float dist,
                            vec3 normal,
                            const float inverted,
                            const float sample_count,
                            out vec4 result_color,
                            out float result_ao)
{
  vec3 bent_normal;
  vec4 rand = texelfetch_noise_tex(gl_FragCoord.xy);
  OcclusionData data = occlusion_search(viewPosition, maxzBuffer, dist, inverted, sample_count);

  vec3 V = cameraVec(worldPosition);
  vec3 N = normalize(normal);
  vec3 Ng = safe_normalize(cross(dFdx(worldPosition), dFdy(worldPosition)));

  vec3 unused;
  occlusion_eval(data, V, N, Ng, inverted, result_ao, unused);
  result_color = result_ao * color;
}
#else
/* Stub ambient occlusion because it is not compatible with volumetrics. */
#  define node_ambient_occlusion(a, b, c, d, e, f) (e = vec4(0); f = 0.0)
#endif