Fix #21545: geometry node front/back incorrectly depended on camera angle, can
actually be implemented simpler now.
This commit is contained in:
@@ -54,7 +54,6 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **in, bNod
|
||||
NodeGeometry *ngeo= (NodeGeometry*)node->storage;
|
||||
ShadeInputUV *suv= &shi->uv[shi->actuv];
|
||||
static float defaultvcol[4] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
static float front= 0.0;
|
||||
int i;
|
||||
|
||||
if(ngeo->uvname[0]) {
|
||||
@@ -109,14 +108,8 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **in, bNod
|
||||
out[GEOM_OUT_NORMAL]->datatype= NS_OSA_VECTORS;
|
||||
}
|
||||
|
||||
/* front/back
|
||||
* check the original un-flipped normals to determine front or back side */
|
||||
if (shi->orignor[2] < FLT_EPSILON) {
|
||||
front= 1.0f;
|
||||
} else {
|
||||
front = 0.0f;
|
||||
}
|
||||
out[GEOM_OUT_FRONTBACK]->vec[0]= front;
|
||||
/* front/back, normal flipping was stored */
|
||||
out[GEOM_OUT_FRONTBACK]->vec[0]= (shi->flippednor)? 0.0f: 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -166,9 +166,6 @@ typedef struct ShadeInput
|
||||
int depth; /* 1 or larger on raytrace shading */
|
||||
int volume_depth; /* number of intersections through volumes */
|
||||
|
||||
/* stored copy of original face normal (facenor)
|
||||
* before flipping. Used in Front/back output on geometry node */
|
||||
float orignor[3];
|
||||
/* for strand shading, normal at the surface */
|
||||
float surfnor[3], surfdist;
|
||||
|
||||
|
||||
@@ -276,11 +276,6 @@ void shade_input_set_triangle_i(ShadeInput *shi, ObjectInstanceRen *obi, VlakRen
|
||||
/* facenormal copy, can get flipped */
|
||||
shi->flippednor= RE_vlakren_get_normal(&R, obi, vlr, shi->facenor);
|
||||
|
||||
/* copy of original pre-flipped normal, for geometry->front/back node output */
|
||||
VECCOPY(shi->orignor, shi->facenor);
|
||||
if(shi->flippednor)
|
||||
VECMUL(shi->orignor, -1.0f);
|
||||
|
||||
/* calculate vertexnormals */
|
||||
if(vlr->flag & R_SMOOTH) {
|
||||
VECCOPY(shi->n1, shi->v1->n);
|
||||
@@ -372,7 +367,6 @@ void shade_input_set_strand(ShadeInput *shi, StrandRen *strand, StrandPoint *spo
|
||||
|
||||
/* facenormal, simply viewco flipped */
|
||||
VECCOPY(shi->facenor, spoint->nor);
|
||||
VECCOPY(shi->orignor, shi->facenor);
|
||||
|
||||
/* shade_input_set_normals equivalent */
|
||||
if(shi->mat->mode & MA_TANGENT_STR) {
|
||||
|
||||
Reference in New Issue
Block a user