diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-08-12 23:48:15 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-08-12 23:48:15 +0400 |
commit | e5fd5599bc53183b3c919e9644ea6fd1eaa399e0 (patch) | |
tree | f484d55601ff9fb96643bb36b67292a11550f525 /source/blender/render | |
parent | e9ef7a83582bc3d1eb4c2b016cae8bcf295a752d (diff) |
Fix T40566: Light instances disappears in rendered viewport (Blender Internal)
This is just another issue caused by convertblender overwriting the object
matrix at the time of creating render object. What's even worse here is that
original matrix is not stored for the lamps, only lamp_matrix*view_matrix is
stored.
For sure we can combine lar->co and lar->mat back to mat4, multiply by the
inverse view matrix and get object matrix, but this is not suitable for the
viewport render because every viewport rotation will accumulate the error.
For now let's store worldspace lamp matrix in the LampRen structure and use
it when rotating the scene.
Diffstat (limited to 'source/blender/render')
-rw-r--r-- | source/blender/render/intern/include/render_types.h | 4 | ||||
-rw-r--r-- | source/blender/render/intern/source/convertblender.c | 1 | ||||
-rw-r--r-- | source/blender/render/intern/source/envmap.c | 4 |
3 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 536a2b8a85f..b87b1e6f367 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -595,7 +595,9 @@ typedef struct LampRen { float imat[3][3]; float spottexfac; float sh_invcampos[3], sh_zfac; /* sh_= spothalo */ - + + float lampmat[4][4]; /* worls space lamp matrix, used for scene rotation */ + float mat[3][3]; /* 3x3 part from lampmat x viewmat */ float area[8][3], areasize; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index c6ebe44c5da..55146162f25 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -3650,6 +3650,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) mul_m4_m4m4(mat, re->viewmat, ob->obmat); invert_m4_m4(ob->imat, mat); + copy_m4_m4(lar->lampmat, ob->obmat); copy_m3_m4(lar->mat, mat); copy_m3_m4(lar->imat, ob->imat); diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 28b29261e4e..06be00a5a5e 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -329,9 +329,9 @@ void env_rotate_scene(Render *re, float mat[4][4], int do_rotate) /* copy from add_render_lamp */ if (do_rotate == 1) - mul_m4_m4m4(tmpmat, re->viewmat, go->ob->obmat); + mul_m4_m4m4(tmpmat, re->viewmat, lar->lampmat); else - mul_m4_m4m4(tmpmat, re->viewmat_orig, go->ob->obmat); + mul_m4_m4m4(tmpmat, re->viewmat_orig, lar->lampmat); invert_m4_m4(go->ob->imat, tmpmat); copy_m3_m4(lar->mat, tmpmat); |