diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-07-17 00:49:25 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-07-24 16:28:27 +0300 |
commit | 2a84331f02d08092aa42b3870693d09b18744b4b (patch) | |
tree | f3d0a3d83f39bf43b2a69e651cde177ae2e95c95 /source/blender/draw/engines/eevee/shaders/default_frag.glsl | |
parent | 04f8e1b21c716b6d4eefed6678d036cd0c96d4d2 (diff) |
Eevee: SSR: Output ssr datas to buffers.
Output in 2 buffers Normals, Specular Color and roughness.
This way we can raytrace in a defered fashion and blend the exact contribution of the specular lobe on top of the opaque pass.
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; } |