Fix T48533: camera node view vector wrong for Cycles GLSL.
Reviewed By: brecht Differential Revision: https://developer.blender.org/D2033
This commit is contained in:
parent
94e18c59f8
commit
739bf147a9
Notes:
blender-bot
2023-10-13 01:54:23 +02:00
Referenced by issue #48533, View Vector output from Camera Data node gives wrong result in Cycles GLSL.
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue