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:
authorAndrea Weikert <elubie@gmx.net>2013-09-20 15:55:43 +0400
committerAndrea Weikert <elubie@gmx.net>2013-09-20 15:55:43 +0400
commitcdc2cf4fd3460d48f8613d08001249ccbfec515e (patch)
tree12bed6daf80b7a83ec5a3cf268f618bbc60de705 /source/blender/gpu/intern/gpu_material.c
parent2cca73eeb17abc59d08926b84a81dcf4e085f618 (diff)
FIX: [#27536] GLSL object space normal maps have wrong shading
Added object and world space for normal map in GLSL view.
Diffstat (limited to 'source/blender/gpu/intern/gpu_material.c')
-rw-r--r--source/blender/gpu/intern/gpu_material.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 0ca929da65d..9319ac53db6 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -1126,8 +1126,15 @@ static void do_material_tex(GPUShadeInput *shi)
else { /* otherwise use accumulated perturbations */
GPU_link(mat, "mtex_nspace_tangent", GPU_attribute(CD_TANGENT, ""), shi->vn, tnor, &newnor);
}
+ } else if (mtex->normapspace == MTEX_NSPACE_OBJECT) {
+ /* transform normal by object then view matrix */
+ GPU_link(mat, "mtex_nspace_object", GPU_builtin(GPU_VIEW_MATRIX), GPU_builtin(GPU_OBJECT_MATRIX), tnor, &newnor);
+ } else if (mtex->normapspace == MTEX_NSPACE_WORLD) {
+ /* transform normal by view matrix */
+ GPU_link(mat, "mtex_nspace_world", GPU_builtin(GPU_VIEW_MATRIX), tnor, &newnor);
}
else {
+ /* no transform, normal in camera space */
newnor = tnor;
}