diff options
author | Andrea Weikert <elubie@gmx.net> | 2013-09-20 15:55:43 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2013-09-20 15:55:43 +0400 |
commit | cdc2cf4fd3460d48f8613d08001249ccbfec515e (patch) | |
tree | 12bed6daf80b7a83ec5a3cf268f618bbc60de705 /source/blender/gpu/shaders | |
parent | 2cca73eeb17abc59d08926b84a81dcf4e085f618 (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/shaders')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_material.glsl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index d2c9ad7cfd1..bab677da842 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -1415,6 +1415,16 @@ void mtex_nspace_tangent(vec4 tangent, vec3 normal, vec3 texnormal, out vec3 out outnormal = normalize(outnormal); } +void mtex_nspace_world(mat4 viewmat, vec3 texnormal, out vec3 outnormal) +{ + outnormal = normalize((viewmat*vec4(texnormal, 0.0)).xyz); +} + +void mtex_nspace_object(mat4 viewmat, mat4 obmat, vec3 texnormal, out vec3 outnormal) +{ + outnormal = normalize((viewmat*(obmat*vec4(texnormal, 0.0))).xyz); +} + void mtex_blend_normal(float norfac, vec3 normal, vec3 newnormal, out vec3 outnormal) { outnormal = (1.0 - norfac)*normal + norfac*newnormal; |