Eevee: Fix broken default coordinate (reported via IRC by Dalai Felinto).
authorClément Foucault <foucault.clem@gmail.com>
Thu, 29 Jun 2017 18:22:52 +0000 (20:22 +0200)
committerClément Foucault <foucault.clem@gmail.com>
Thu, 29 Jun 2017 18:23:06 +0000 (20:23 +0200)
source/blender/gpu/shaders/gpu_shader_material.glsl
source/blender/nodes/shader/nodes/node_shader_tex_environment.c

index 37f9eb0500b4bcb14f833dde66bcee94321aacda..2633c2965b131cb1e54b6251a3f0c24922bffadc 100644 (file)
@@ -2845,24 +2845,13 @@ void background_transform_to_world(vec3 viewvec, out vec3 worldvec)
        vec4 co_homogenous = (ProjectionMatrixInverse * v);
 
        vec4 co = vec4(co_homogenous.xyz / co_homogenous.w, 0.0);
-#ifdef WORLD_BACKGROUND
+#if defined(WORLD_BACKGROUND) || defined(PROBE_CAPTURE)
        worldvec = (ViewMatrixInverse * co).xyz;
 #else
        worldvec = (ModelViewMatrixInverse * co).xyz;
 #endif
 }
 
-#if defined(PROBE_CAPTURE) || defined(WORLD_BACKGROUND)
-void environment_default_vector(out vec3 worldvec)
-{
-#ifdef WORLD_BACKGROUND
-       background_transform_to_world(viewPosition, worldvec);
-#else
-       worldvec = normalize(worldPosition);
-#endif
-}
-#endif
-
 void node_background(vec4 color, float strength, out vec4 result)
 {
        result = color * strength;
index e090f26ab6b840df26d3aa6fbd35cf17d6ceacf8..2f8f95b0675f4fe751d856fa7ba1c8489947c6de 100644 (file)
@@ -69,10 +69,8 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat, bNode *node, bNodeE
                
                if (type == GPU_MATERIAL_TYPE_MESH)
                        in[0].link = GPU_builtin(GPU_VIEW_POSITION);
-               else if (type == GPU_MATERIAL_TYPE_WORLD)
-                       GPU_link(mat, "background_transform_to_world", GPU_builtin(GPU_VIEW_POSITION), &in[0].link);
                else
-                       GPU_link(mat, "environment_default_vector", &in[0].link);
+                       GPU_link(mat, "background_transform_to_world", GPU_builtin(GPU_VIEW_POSITION), &in[0].link);
        }
        
        node_shader_gpu_tex_mapping(mat, node, in, out);