Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-12-10 17:12:54 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2014-12-10 17:12:54 +0300
commitd9ddc99a27a4b50b54c1582d780c21f78483375d (patch)
treec5323b6f92e55d1588d095043145c8166812a820 /source/blender/nodes
parentd68521df7bb18204a4ccadd3a48fe75e794ac4ad (diff)
Fix T42184: Normal not displayed correctly in Material Viewport
There was a differences between how Cycles and BI treats Normal shader: - Different normal direction assumption - Different policy about vector normalization Previous idea of trying to use single function and flip the output if needed becomes more tricky, so i've just added new GLSL function which corresponds to how Cycles deals with the Normal shader.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_normal.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_normal.c b/source/blender/nodes/shader/nodes/node_shader_normal.c
index 847d2e6a5de..092fc201aa7 100644
--- a/source/blender/nodes/shader/nodes/node_shader_normal.c
+++ b/source/blender/nodes/shader/nodes/node_shader_normal.c
@@ -61,12 +61,12 @@ static void node_shader_exec_normal(void *UNUSED(data), int UNUSED(thread), bNod
static int gpu_shader_normal(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
{
GPUNodeLink *vec = GPU_uniform(out[0].vec);
- int ret = GPU_stack_link(mat, "normal", in, out, vec);
- if (ret && GPU_material_use_new_shading_nodes(mat)) {
- float fac[3] = {-1.0f, -1.0f, -1.0f};
- GPU_link(mat, "math_multiply", GPU_uniform(fac), out[1].link, &out[1].link);
+ if (GPU_material_use_new_shading_nodes(mat)) {
+ return GPU_stack_link(mat, "normal_new_shading", in, out, vec);
+ }
+ else {
+ return GPU_stack_link(mat, "normal", in, out, vec);
}
- return ret;
}
void register_node_type_sh_normal(void)