diff options
author | Ralf Hölzemer <r.hoelzemer@googlemail.com> | 2016-05-28 12:34:08 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-05-28 12:38:10 +0300 |
commit | 739bf147a9f6a56a3cdca5dfbaf8c4a6b657bbb3 (patch) | |
tree | e83f3d3e2092c64a2df1675f0ea98e73b2c49893 /source/blender/nodes/shader | |
parent | 94e18c59f8311523ea72bd1d7b68daaa2e597e8d (diff) |
Fix T48533: camera node view vector wrong for Cycles GLSL.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D2033
Diffstat (limited to 'source/blender/nodes/shader')
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_camera.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_camera.c b/source/blender/nodes/shader/nodes/node_shader_camera.c index 49ebb15d7a4..3bdb5c36d69 100644 --- a/source/blender/nodes/shader/nodes/node_shader_camera.c +++ b/source/blender/nodes/shader/nodes/node_shader_camera.c @@ -54,7 +54,15 @@ static void node_shader_exec_camera(void *data, int UNUSED(thread), bNode *UNUSE static int gpu_shader_camera(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "camera", in, out, GPU_builtin(GPU_VIEW_POSITION)); + GPUNodeLink *viewvec; + + viewvec = GPU_builtin(GPU_VIEW_POSITION); + + /* Blender has negative Z, Cycles positive Z convention */ + if (GPU_material_use_new_shading_nodes(mat)) + GPU_link(mat, "invert_z", viewvec, &viewvec); + + return GPU_stack_link(mat, "camera", in, out, viewvec); } void register_node_type_sh_camera(void) |