diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-05-30 02:26:45 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-05-30 14:43:34 +0300 |
commit | 296527eab79495b8fe253368e1a08359fec73a95 (patch) | |
tree | bb4c1aa8fb3f94b89800d259d1dd2534dabc5104 /source/blender/gpu | |
parent | 7cdd5ed7bd228d46b5eecc3355b01d00f26d1ca2 (diff) |
Eevee: Fix volumetric shader if nodetree uses a bsdf node
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_material.glsl | 57 |
1 files changed, 40 insertions, 17 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index aedc3c1873e..7dc3958d5b6 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -1673,23 +1673,6 @@ void node_ambient_occlusion( result_color = result_ao * color; } -#endif /* VOLUMETRICS */ - -/* emission */ - -void node_emission(vec4 color, float strength, vec3 vN, out Closure result) -{ -#ifndef VOLUMETRICS - color *= strength; - result = CLOSURE_DEFAULT; - result.radiance = color.rgb; - result.opacity = color.a; - result.ssr_normal = normal_encode(vN, viewCameraVec); -#else - result = Closure(vec3(0.0), vec3(0.0), color.rgb * strength, 0.0); -#endif -} - void node_wireframe(float size, vec2 barycentric, vec3 barycentric_dist, out float fac) { vec3 barys = barycentric.xyy; @@ -1716,6 +1699,46 @@ void node_wireframe_screenspace(float size, vec2 barycentric, out float fac) fac = max(s.x, max(s.y, s.z)); } +#else /* VOLUMETRICS */ + +/* Stub all bsdf functions not compatible with volumetrics. */ +# define node_bsdf_diffuse +# define node_bsdf_glossy +# define node_bsdf_anisotropic +# define node_bsdf_glass +# define node_bsdf_toon +# define node_bsdf_principled +# define node_bsdf_principled_dielectric +# define node_bsdf_principled_metallic +# define node_bsdf_principled_clearcoat +# define node_bsdf_principled_subsurface +# define node_bsdf_principled_glass +# define node_bsdf_translucent +# define node_bsdf_transparent +# define node_bsdf_velvet +# define node_subsurface_scattering +# define node_bsdf_refraction +# define node_ambient_occlusion +# define node_wireframe +# define node_wireframe_screenspace + +#endif /* VOLUMETRICS */ + +/* emission */ + +void node_emission(vec4 color, float strength, vec3 vN, out Closure result) +{ +#ifndef VOLUMETRICS + color *= strength; + result = CLOSURE_DEFAULT; + result.radiance = color.rgb; + result.opacity = color.a; + result.ssr_normal = normal_encode(vN, viewCameraVec); +#else + result = Closure(vec3(0.0), vec3(0.0), color.rgb * strength, 0.0); +#endif +} + /* background */ void node_tex_environment_texco(vec3 viewvec, out vec3 worldvec) |