diff options
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/default_frag.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/default_frag.glsl | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/default_frag.glsl b/source/blender/draw/engines/eevee/shaders/default_frag.glsl index b50eb481f94..db8ed2d04fe 100644 --- a/source/blender/draw/engines/eevee/shaders/default_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/default_frag.glsl @@ -4,17 +4,19 @@ uniform float metallic; uniform float specular; uniform float roughness; -out vec4 FragColor; - -void main() +Closure nodetree_exec(void) { vec3 dielectric = vec3(0.034) * specular * 2.0; vec3 diffuse = mix(basecol, vec3(0.0), metallic); vec3 f0 = mix(dielectric, basecol, metallic); - vec3 radiance = eevee_surface_lit((gl_FrontFacing) ? worldNormal : -worldNormal, diffuse, f0, roughness, 1.0); -#if defined(USE_ALPHA_BLEND) - FragColor = vec4(radiance, 1.0); -#else - FragColor = vec4(radiance, length(viewPosition)); + vec3 ssr_spec; + vec3 radiance = eevee_surface_lit((gl_FrontFacing) ? worldNormal : -worldNormal, diffuse, f0, roughness, 1.0, 0, ssr_spec); + + Closure result = Closure(radiance, 1.0, vec4(ssr_spec, roughness), viewNormal.xy, 0); + +#if !defined(USE_ALPHA_BLEND) + result.opacity = length(viewPosition); #endif + + return result; } |