[Bf-blender-cvs] [d7945b7] master: Fix T37704: cycles hair render error with hair density vertex group.

Brecht Van Lommel noreply at git.blender.org
Tue Dec 10 19:48:25 CET 2013


Commit: d7945b7202c666cb8fcfb31e3f16caa46dc69ea6
Author: Brecht Van Lommel
Date:   Tue Dec 10 19:47:27 2013 +0100
http://developer.blender.org/rBd7945b7202c666cb8fcfb31e3f16caa46dc69ea6

Fix T37704: cycles hair render error with hair density vertex group.

Zero length hairs were causing problems, now it skips rendering them as they
are invisible anyway.

===================================================================

M	intern/cycles/blender/blender_curves.cpp

===================================================================

diff --git a/intern/cycles/blender/blender_curves.cpp b/intern/cycles/blender/blender_curves.cpp
index b780877..da4acf1 100644
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@ -400,6 +400,8 @@ void ExportCurveTrianglePlanes(Mesh *mesh, ParticleCurveData *CData, float3 RotC
 
 	for( int sys = 0; sys < CData->psys_firstcurve.size() ; sys++) {
 		for( int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys] ; curve++) {
+			if(CData->curve_length[curve] == 0.0f)
+				continue;
 
 			float3 xbasis;
 			float3 v1;
@@ -460,6 +462,8 @@ void ExportCurveTriangleGeometry(Mesh *mesh, ParticleCurveData *CData, int resol
 
 	for( int sys = 0; sys < CData->psys_firstcurve.size() ; sys++) {
 		for( int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys] ; curve++) {
+			if(CData->curve_length[curve] == 0.0f)
+				continue;
 
 			float3 firstxbasis = cross(make_float3(1.0f,0.0f,0.0f),CData->curvekey_co[CData->curve_firstkey[curve]+1] - CData->curvekey_co[CData->curve_firstkey[curve]]);
 			if(len_squared(firstxbasis)!= 0.0f)
@@ -593,7 +597,7 @@ void ExportCurveSegments(Scene *scene, Mesh *mesh, ParticleCurveData *CData)
 
 		for( int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys] ; curve++) {
 
-			if(CData->curve_keynum[curve] <= 1)
+			if(CData->curve_keynum[curve] <= 1 || CData->curve_length[curve] == 0.0f)
 				continue;
 
 			size_t num_curve_keys = 0;
@@ -644,7 +648,7 @@ static void ExportCurveSegmentsMotion(Scene *scene, Mesh *mesh, ParticleCurveDat
 			continue;
 
 		for(int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys]; curve++) {
-			if(CData->curve_keynum[curve] <= 1)
+			if(CData->curve_keynum[curve] <= 1 || CData->curve_length[curve] == 0.0f)
 				continue;
 
 			for(int curvekey = CData->curve_firstkey[curve]; curvekey < CData->curve_firstkey[curve] + CData->curve_keynum[curve]; curvekey++) {
@@ -683,6 +687,8 @@ void ExportCurveTriangleUV(Mesh *mesh, ParticleCurveData *CData, int vert_offset
 		for( int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys] ; curve++) {
 
 			for( int curvekey = CData->curve_firstkey[curve]; curvekey < CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 1; curvekey++) {
+				if(CData->curve_length[curve] == 0.0f)
+					continue;
 
 				time = CData->curvekey_time[curvekey]/CData->curve_length[curve];
 
@@ -724,6 +730,8 @@ void ExportCurveTriangleVcol(Mesh *mesh, ParticleCurveData *CData, int vert_offs
 
 	for( int sys = 0; sys < CData->psys_firstcurve.size() ; sys++) {
 		for( int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys] ; curve++) {
+			if(CData->curve_length[curve] == 0.0f)
+				continue;
 
 			for( int curvekey = CData->curve_firstkey[curve]; curvekey < CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 1; curvekey++) {




More information about the Bf-blender-cvs mailing list