diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-11-08 15:16:06 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-11-08 21:20:40 +0300 |
commit | 9d12a5aa9e20c33c49bd86e956d0b3d5fbf6fd46 (patch) | |
tree | fd18dfc5c3f9955ddb7eb39819c5e2721f527694 /source/blender/nodes | |
parent | 1250ace641814098ed8e6715f6e69c5cbd46f8dd (diff) |
Eevee: Fix geometry node for environments and support true_normal
Also minor cleanup for the Bump node.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_bump.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_bump.c b/source/blender/nodes/shader/nodes/node_shader_bump.c index b71a59d8c11..c806827b71d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bump.c +++ b/source/blender/nodes/shader/nodes/node_shader_bump.c @@ -47,19 +47,13 @@ static bNodeSocketTemplate sh_node_bump_out[] = { static int gpu_shader_bump(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - if (!in[3].link) - in[3].link = GPU_builtin(GPU_VIEW_NORMAL); - else - GPU_link(mat, "direction_transform_m4v3", in[3].link, GPU_builtin(GPU_VIEW_MATRIX), &in[3].link); - float invert = node->custom1; - GPU_stack_link(mat, node, "node_bump", in, out, GPU_builtin(GPU_VIEW_POSITION), GPU_constant(&invert)); - /* Other nodes are applying view matrix if the input Normal has a link. - * We don't want normal to have view matrix applied twice, so we cancel it here. - * - * TODO(sergey): This is an extra multiplication which cancels each other, - * better avoid this but that requires bigger refactor. - */ - return GPU_link(mat, "direction_transform_m4v3", out[0].link, GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &out[0].link); + if (!in[3].link) { + GPU_link(mat, "world_normals_get", &in[3].link); + } + + float invert = (node->custom1) ? -1.0 : 1.0; + + return GPU_stack_link(mat, node, "node_bump", in, out, GPU_builtin(GPU_VIEW_POSITION), GPU_constant(&invert)); } /* node type definition */ |