Eevee: Fix broken default coordinate (reported via IRC by Dalai Felinto).

This commit is contained in:
Clément Foucault
2017-06-29 20:22:52 +02:00
parent 98c8b5a6fb
commit cdb07ff30e
2 changed files with 2 additions and 15 deletions

View 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;

View 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);