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

gpu_shader_material_shader_to_rgba.glsl « material « shaders « gpu « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0a587c7e4716cf596e5c90e08fdd30cca628f488 (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_shader_to_rgba(Closure cl, out vec4 outcol, out float outalpha)
{
  vec4 spec_accum = vec4(0.0);
  if (ssrToggle && FLAG_TEST(cl.flag, CLOSURE_SSR_FLAG)) {
    vec3 V = cameraVec;
    vec3 vN = normal_decode(cl.ssr_normal, viewCameraVec);
    vec3 N = transform_direction(ViewMatrixInverse, vN);
    float roughness = cl.ssr_data.a;
    float roughnessSquared = max(1e-3, roughness * roughness);
    fallback_cubemap(N, V, worldPosition, viewPosition, roughness, roughnessSquared, spec_accum);
  }

  outalpha = avg(cl.transmittance);
  outcol = vec4((spec_accum.rgb * cl.ssr_data.rgb) + cl.radiance, 1.0);

#  ifdef USE_SSS
#    ifdef USE_SSS_ALBEDO
  outcol.rgb += cl.sss_data.rgb * cl.sss_albedo;
#    else
  outcol.rgb += cl.sss_data.rgb;
#    endif
#  endif
}
#endif /* VOLUMETRICS */