Commit: bf0f3a04ccb927ec01a9059e56b0ac4fb80870a0
Author: Sergey Sharybin
Date: Tue Sep 2 15:34:07 2014 +0600
Branches: master
https://developer.blender.org/rBbf0f3a04ccb927ec01a9059e56b0ac4fb80870a0
Fix second part of T41068 -- reflection mapping was wrong
Few things:
- reflect() takes arguments in this order: N, I, it was swapped
in the previous code for some reason.
- Normal and view vectors are to be normalized. For the view
vector we're now using shade_view() in order to deal with the
ortho camera. However, Cycles does not support ortho camera
for reflection, but this is easy to do in a separate commit.
- Reflection vector is to be in the world space. Kudos to
Antony Riakiotakis for figuring this out!
===================================================================
M source/blender/gpu/shaders/gpu_shader_material.glsl
===================================================================
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl
b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 3866ec2..a60421a 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -2323,8 +2323,11 @@ void node_tex_coord(vec3 I, vec3 N, mat4 viewinvmat,
mat4 obinvmat,
object = (obinvmat*(viewinvmat*vec4(I, 1.0))).xyz;
camera = I;
window = gl_FragCoord.xyz;
- reflection = reflect(N, I);
+ vec3 shade_I;
+ shade_view(I, shade_I);
+ vec3 view_reflection = reflect(shade_I, normalize(N));
+ reflection = (viewinvmat*vec4(view_reflection, 0.0)).xyz;
}
/* textures */
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs