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:
authorBastien Montagne <montagne29@wanadoo.fr>2015-03-24 12:58:57 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-03-24 13:03:05 +0300
commit4685092fd8e40d523ccd6d4d2b7efe491823f07f (patch)
treebee20c3f0817d0f385a641bc246ebb71c466e672
parent0f0e080a267c5c4fc7bd18566be28dd01ffb9499 (diff)
Fix T44102: Mirrored objects render black with Blender Internal and Autosmooth.
Normals are not vertices, we cannot apply matrix's scale to them...
-rw-r--r--source/blender/render/intern/source/convertblender.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 2ebcb76e3d1..e900d29aa19 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -577,6 +577,17 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[4][4], shor
VlakRen *vlr;
int a, totvert;
+ float rot[3][3];
+
+ /* Note: For normals, we only want rotation, not scaling component.
+ * Negative scales (aka mirroring) give wrong results, see T44102. */
+ if (lnors) {
+ float mat3[3][3], size[3];
+
+ copy_m3_m4(mat3, mat);
+ mat3_to_rot_size(rot, size, mat3);
+ }
+
if (obr->totvert == 0)
return;
@@ -611,9 +622,8 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[4][4], shor
ver = RE_findOrAddVert(obr, a);
mul_m4_v3(mat, ver->co);
if (lnors) {
- mul_mat3_m4_v3(mat, ver->n);
+ mul_m3_v3(rot, ver->n);
negate_v3(ver->n);
- normalize_v3(ver->n);
}
}
for (a = 0; a < obr->totvlak; a++) {