[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13096] trunk/blender/source/blender/ render/intern:

Brecht Van Lommel brechtvanlommel at pandora.be
Wed Jan 2 15:20:15 CET 2008


Revision: 13096
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13096
Author:   blendix
Date:     2008-01-02 15:20:15 +0100 (Wed, 02 Jan 2008)

Log Message:
-----------

Bugfix for incorrect strand clipping in shadow maps, not sure yet it
actually fixes the problem.

Modified Paths:
--------------
    trunk/blender/source/blender/render/intern/include/strand.h
    trunk/blender/source/blender/render/intern/source/strand.c

Modified: trunk/blender/source/blender/render/intern/include/strand.h
===================================================================
--- trunk/blender/source/blender/render/intern/include/strand.h	2008-01-02 13:51:44 UTC (rev 13095)
+++ trunk/blender/source/blender/render/intern/include/strand.h	2008-01-02 14:20:15 UTC (rev 13096)
@@ -64,6 +64,7 @@
 	float co1[3], co2[3];
 	float hoco1[4], hoco2[4];
 	float zco1[3], zco2[3];
+	int clip1, clip2;
 
 	/* screen space */
 	float hoco[4];

Modified: trunk/blender/source/blender/render/intern/source/strand.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/strand.c	2008-01-02 13:51:44 UTC (rev 13095)
+++ trunk/blender/source/blender/render/intern/source/strand.c	2008-01-02 14:20:15 UTC (rev 13096)
@@ -388,9 +388,9 @@
 	Crossf(cross, spoint->co, spoint->tan);
 
 	w= spoint->co[2]*strandbuf->winmat[2][3] + strandbuf->winmat[3][3];
-	dx= strandbuf->winx*cross[0]*strandbuf->winmat[0][0];
-	dy= strandbuf->winy*cross[1]*strandbuf->winmat[1][1];
-	w= sqrt(dx*dx + dy*dy)/w;
+	dx= strandbuf->winx*cross[0]*strandbuf->winmat[0][0]/w;
+	dy= strandbuf->winy*cross[1]*strandbuf->winmat[1][1]/w;
+	w= sqrt(dx*dx + dy*dy);
 
 	if(w > 0.0f) {
 		if(strandbuf->flag & R_STRAND_B_UNITS) {
@@ -777,7 +777,7 @@
 		projectvert(p2->co, winmat, hoco2);
 
 		/* render both strand and single pixel wire to counter aliasing */
-		zbufclip4(zspan, 0, 0, p1->hoco2, p1->hoco1, p2->hoco1, p2->hoco2, 0, 0, 0, 0);
+		zbufclip4(zspan, 0, 0, p1->hoco2, p1->hoco1, p2->hoco1, p2->hoco2, p1->clip2, p1->clip1, p2->clip1, p2->clip2);
 		zbufsinglewire(zspan, 0, 0, hoco1, hoco2);
 	}
 }
@@ -817,6 +817,8 @@
 	else {
 		projectvert(p.co1, winmat, p.hoco1);
 		projectvert(p.co2, winmat, p.hoco2);
+		p.clip1= testclip(p.hoco1);
+		p.clip2= testclip(p.hoco2);
 	}
 
 	if(!strand_segment_recursive(re, winmat, spart, zspan, sseg, p1, &p, depth+1))
@@ -852,6 +854,10 @@
 		projectvert(p1->co2, winmat, p1->hoco2);
 		projectvert(p2->co1, winmat, p2->hoco1);
 		projectvert(p2->co2, winmat, p2->hoco2);
+		p1->clip1= testclip(p1->hoco1);
+		p1->clip2= testclip(p1->hoco2);
+		p2->clip1= testclip(p2->hoco1);
+		p2->clip2= testclip(p2->hoco2);
 	}
 
 	if(!strand_segment_recursive(re, winmat, spart, zspan, sseg, p1, p2, 0))





More information about the Bf-blender-cvs mailing list