--- ray/src/rt/m_mirror.c 2010/09/26 15:51:15 2.13 +++ ray/src/rt/m_mirror.c 2014/01/25 18:27:39 2.15 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: m_mirror.c,v 2.13 2010/09/26 15:51:15 greg Exp $"; +static const char RCSid[] = "$Id: m_mirror.c,v 2.15 2014/01/25 18:27:39 greg Exp $"; #endif /* * Routines for mirror material supporting virtual light sources @@ -43,7 +43,8 @@ m_mirror( /* shade mirrored ray */ if (m->oargs.nfargs != 3 || m->oargs.nsargs > 1) objerror(m, USER, "bad number of arguments"); /* check for substitute material */ - if (m->oargs.nsargs > 0 && + /* but avoid double-counting */ + if (m->oargs.nsargs > 0 && !(r->crtype & (AMBIENT|SPECULAR)) && (r->rsrc < 0 || source[r->rsrc].so != r->ro)) { if (!strcmp(m->oargs.sarg[0], VOIDID)) { raytrans(r); @@ -55,8 +56,11 @@ m_mirror( /* shade mirrored ray */ if (r->rsrc >= 0 && source[r->rsrc].so != r->ro) return(1); - if (r->rod < 0.) /* back is black */ + if (r->rod < 0.) { /* back is black */ + if (!backvis) + raytrans(r); /* unless back visibility is off */ return(1); + } /* get modifiers */ raytexture(r, m->omod); /* assign material color */