Fix T48818: Objects with alpha maps cast wrong ray shadows in BI
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 12 Jul 2016 13:40:40 +0000 (15:40 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 12 Jul 2016 13:41:00 +0000 (15:41 +0200)
source/blender/render/intern/raytrace/rayobject.cpp

index f511042749eef6740921ae31171cc1c03742efdc..2104315dc003f518b4a67dfcea6b7ca545ea0601 100644 (file)
@@ -145,8 +145,8 @@ MALWAYS_INLINE int isec_tri_quad(float start[3], const struct IsectRayPrecalc *i
        if (isect_ray_tri_watertight_v3(start, isect_precalc, face->v1, face->v2, face->v3, &l, uv)) {
                /* check if intersection is within ray length */
                if (l > -RE_RAYTRACE_EPSILON && l < *lambda) {
-                       r_uv[0] = uv[0];
-                       r_uv[1] = uv[1];
+                       r_uv[0] = -uv[0];
+                       r_uv[1] = -uv[1];
                        *lambda = l;
                        return 1;
                }
@@ -157,8 +157,8 @@ MALWAYS_INLINE int isec_tri_quad(float start[3], const struct IsectRayPrecalc *i
                if (isect_ray_tri_watertight_v3(start, isect_precalc, face->v1, face->v3, face->v4, &l, uv)) {
                        /* check if intersection is within ray length */
                        if (l > -RE_RAYTRACE_EPSILON && l < *lambda) {
-                               r_uv[0] = uv[0];
-                               r_uv[1] = uv[1];
+                               r_uv[0] = -uv[0];
+                               r_uv[1] = -uv[1];
                                *lambda = l;
                                return 2;
                        }