diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-07-09 13:01:29 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-07-11 13:39:35 +0300 |
commit | 05bef13b53e93978716aff8e2efba7ddf72264ed (patch) | |
tree | f1ff4fbf5a7d4c5e1a8f934b17fa47256d40177a /source/blender/gpu | |
parent | e2c0197a96dbac2aee519fbfb142441c6aed0963 (diff) |
Eevee: Add support for Alpha clip and Hashed Alpha transparency.
Hashed Alpha transparency offers a noisy output but has the benefit of being correctly ordered. Noise can be attenuated with Multisampling / AntiAliasing.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_material.glsl | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index e9f7fb338c9..3235dad8d04 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -14,7 +14,7 @@ uniform vec4 CameraTexCoFactors; /* Old glsl mode compat. */ -#ifndef NODETREE_EXEC +#ifndef CLOSURE_DEFAULT struct Closure { vec3 radiance; @@ -41,7 +41,7 @@ Closure closure_add(Closure cl1, Closure cl2) Closure nodetree_exec(void); /* Prototype */ -#endif /* NODETREE_EXEC */ +#endif /* CLOSURE_DEFAULT */ /* Converters */ @@ -2890,7 +2890,7 @@ void node_bsdf_transparent(vec4 color, out Closure result) { /* this isn't right */ result.radiance = color.rgb; - result.opacity = 0.0; + result.opacity = color.a; } void node_bsdf_velvet(vec4 color, float sigma, vec3 N, out Closure result) @@ -4031,7 +4031,11 @@ void node_eevee_specular( void node_output_eevee_material(Closure surface, out Closure result) { +#if defined(USE_ALPHA_HASH) || defined(USE_ALPHA_CLIP) + result = surface; +#else result = Closure(surface.radiance, length(viewPosition)); +#endif } #endif /* EEVEE_ENGINE */ |