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

gpu_shader_material_subsurface_scattering.glsl « material « shaders « gpu « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fc81f3c4674ba12aca3a42c48ae268d8065bb6b0 (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
#ifndef VOLUMETRICS
void node_subsurface_scattering(vec4 color,
                                float scale,
                                vec3 radius,
                                float sharpen,
                                float texture_blur,
                                vec3 N,
                                float sss_id,
                                out Closure result)
{
#  if defined(USE_SSS)
  N = normalize(N);
  vec3 out_diff, out_trans;
  vec3 vN = mat3(ViewMatrix) * N;
  result = CLOSURE_DEFAULT;
  closure_load_ssr_data(vec3(0.0), 0.0, N, viewCameraVec, -1, result);

  eevee_closure_subsurface(N, color.rgb, 1.0, scale, out_diff, out_trans);

  vec3 sss_radiance = out_diff + out_trans;
#    ifdef USE_SSS_ALBEDO
  /* Not perfect for texture_blur not exactly equal to 0.0 or 1.0. */
  vec3 sss_albedo = mix(color.rgb, vec3(1.0), texture_blur);
  sss_radiance *= mix(vec3(1.0), color.rgb, texture_blur);
#    else
  sss_radiance *= color.rgb;
#    endif
  closure_load_sss_data(scale,
                        sss_radiance,
#    ifdef USE_SSS_ALBEDO
                        sss_albedo,
#    endif
                        int(sss_id),
                        result);
#  else
  node_bsdf_diffuse(color, 0.0, N, result);
#  endif
}
#else
/* Stub subsurface scattering because it is not compatible with volumetrics. */
#  define node_subsurface_scattering
#endif