[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36165] trunk/blender/source/blender/ render/intern/source/rayshade.c: fix [#26902] Raytracing black dots
Campbell Barton
ideasman42 at gmail.com
Thu Apr 14 18:13:33 CEST 2011
Revision: 36165
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36165
Author: campbellbarton
Date: 2011-04-14 16:13:32 +0000 (Thu, 14 Apr 2011)
Log Message:
-----------
fix [#26902] Raytracing black dots
derivatives from reflected duplis were not taking object instance transformation into account.
Modified Paths:
--------------
trunk/blender/source/blender/render/intern/source/rayshade.c
Modified: trunk/blender/source/blender/render/intern/source/rayshade.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/rayshade.c 2011-04-14 16:04:51 UTC (rev 36164)
+++ trunk/blender/source/blender/render/intern/source/rayshade.c 2011-04-14 16:13:32 UTC (rev 36165)
@@ -487,12 +487,9 @@
/* if(shi->osatex) */
static void shade_ray_set_derivative(ShadeInput *shi)
{
- float *v1= shi->v1->co;
- float *v2= shi->v2->co;
- float *v3= shi->v3->co;
float detsh, t00, t10, t01, t11, xn, yn, zn;
int axis1, axis2;
-
+
/* find most stable axis to project */
xn= fabs(shi->facenor[0]);
yn= fabs(shi->facenor[1]);
@@ -503,9 +500,27 @@
else { axis1= 1; axis2= 2; }
/* compute u,v and derivatives */
- t00= v3[axis1]-v1[axis1]; t01= v3[axis2]-v1[axis2];
- t10= v3[axis1]-v2[axis1]; t11= v3[axis2]-v2[axis2];
-
+ if(shi->obi->flag & R_TRANSFORMED) {
+ float v1[3], v2[3], v3[3];
+
+ mul_v3_m3v3(v1, shi->obi->nmat, shi->v1->co);
+ mul_v3_m3v3(v2, shi->obi->nmat, shi->v2->co);
+ mul_v3_m3v3(v3, shi->obi->nmat, shi->v3->co);
+
+ /* same as below */
+ t00= v3[axis1]-v1[axis1]; t01= v3[axis2]-v1[axis2];
+ t10= v3[axis1]-v2[axis1]; t11= v3[axis2]-v2[axis2];
+ }
+ else {
+ float *v1= shi->v1->co;
+ float *v2= shi->v2->co;
+ float *v3= shi->v3->co;
+
+ /* same as above */
+ t00= v3[axis1]-v1[axis1]; t01= v3[axis2]-v1[axis2];
+ t10= v3[axis1]-v2[axis1]; t11= v3[axis2]-v2[axis2];
+ }
+
detsh= 1.0f/(t00*t11-t10*t01);
t00*= detsh; t01*=detsh;
t10*=detsh; t11*=detsh;
More information about the Bf-blender-cvs
mailing list