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.
This commit is contained in:
parent
ebdaf4f192
commit
d7945b7202
Notes:
blender-bot
2023-02-14 11:43:52 +01:00
Referenced by issue #37704, Influence Density with Hair error Referenced by issue #37060, Bug with virtual parent of children hair particles and emitter rendering in cycles
|
@ -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++) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue