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: 4f6df238789d78adc11196608644a4f322e21160 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#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
  outcol.rgb += cl.sss_irradiance.rgb * cl.sss_albedo;
#  endif
}
#endif /* VOLUMETRICS */