--- ray/src/rt/aniso.c 1993/11/18 09:42:55 2.26 +++ ray/src/rt/aniso.c 1995/11/06 12:03:20 2.30 @@ -19,6 +19,8 @@ static char SCCSid[] = "$SunId$ LBL"; extern double specthresh; /* specular sampling threshold */ extern double specjitter; /* specular sampling jitter */ +extern int backvis; /* back faces visible? */ + static agaussamp(), getacoords(); /* @@ -185,7 +187,7 @@ register RAY *r; register int i; /* easy shadow test */ if (r->crtype & SHADOW) - return; + return(1); if (m->oargs.nfargs != (m->otype == MAT_TRANS2 ? 8 : 6)) objerror(m, USER, "bad number of real arguments"); @@ -201,9 +203,14 @@ register RAY *r; nd.v_alpha = m->oargs.farg[5]; if (nd.u_alpha < FTINY || nd.v_alpha <= FTINY) objerror(m, USER, "roughness too small"); - /* reorient if necessary */ - if (r->rod < 0.0) - flipsurface(r); + /* check for back side */ + if (r->rod < 0.0) { + if (!backvis && m->otype != MAT_TRANS2) { + raytrans(r); + return(1); + } + flipsurface(r); /* reorient if backvis */ + } /* get modifiers */ raytexture(r, m->omod); nd.pdot = raynormal(nd.pnorm, r); /* perturb normal */ @@ -256,8 +263,7 @@ register RAY *r; /* diffuse reflection */ nd.rdiff = 1.0 - nd.trans - nd.rspec; - if (r->ro != NULL && (r->ro->otype == OBJ_FACE || - r->ro->otype == OBJ_RING)) + if (r->ro != NULL && isflat(r->ro->otype)) nd.specfl |= SP_FLAT; getacoords(r, &nd); /* set up coordinates */ @@ -266,7 +272,7 @@ register RAY *r; agaussamp(r, &nd); if (nd.rdiff > FTINY) { /* ambient from this side */ - ambient(ctmp, r); + ambient(ctmp, r, nd.pnorm); if (nd.specfl & SP_RBLT) scalecolor(ctmp, 1.0-nd.trans); else @@ -276,7 +282,7 @@ register RAY *r; } if (nd.tdiff > FTINY) { /* ambient from other side */ flipsurface(r); - ambient(ctmp, r); + ambient(ctmp, r, nd.pnorm); if (nd.specfl & SP_TBLT) scalecolor(ctmp, nd.trans); else @@ -287,6 +293,8 @@ register RAY *r; } /* add direct component */ direct(r, diraniso, &nd); + + return(1); }