[Bf-blender-cvs] [296527eab79] master: Eevee: Fix volumetric shader if nodetree uses a bsdf node

Clément Foucault noreply at git.blender.org
Thu May 30 13:45:58 CEST 2019


Commit: 296527eab79495b8fe253368e1a08359fec73a95
Author: Clément Foucault
Date:   Thu May 30 01:26:45 2019 +0200
Branches: master
https://developer.blender.org/rB296527eab79495b8fe253368e1a08359fec73a95

Eevee: Fix volumetric shader if nodetree uses a bsdf node

===================================================================

M	source/blender/gpu/shaders/gpu_shader_material.glsl

===================================================================

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)



More information about the Bf-blender-cvs mailing list