| 
  | 
Ok... we've probably all heard of the transparancy/filter 'bug'.  You know...
you have two layers of texture, one uses rgbf<1,1,1,1> and the other uses
rgbt<1,1,1,1> and it turns out black.  Well, here's my solution.  I wanted to
run this past you all before I go posting to povray.bugreports or mailing to
Chris.
in compute_lighted_texture() in LIGHTING.C, change
      FilCol[0] *= LayCol[0];
      FilCol[1] *= LayCol[1];
      FilCol[2] *= LayCol[2];
      FilCol[3] *= LayCol[3];
      FilCol[4] *= LayCol[4];
into
      FilCol[0] *= (LayCol[0]*LayCol[3]+LayCol[4]);
      FilCol[1] *= (LayCol[1]*LayCol[3]+LayCol[4]);
      FilCol[2] *= (LayCol[2]*LayCol[3]+LayCol[4]);
      /* note FilCol[3] stays at 1.0 */
      FilCol[4] *= LayCol[4];
Then, a few lines down, change
    Trans = min(1.0, fabs(FilCol[FILTER] + fabs(FilCol[TRANSM]));
into
    Trans = min(1.0, fabs(FilCol[FILTER]*(FilCol[0]+FilCol[1]+FilCol[2])/3.0)
                + fabs(FilCol[TRANSM]));
(or maybe this should be a color-weighted average)
Preliminary tests have been encouraging.  The formula I use is not just a
guess.  Look later in the same function, and you'll find that the same formula
is used to compute ResCol[] (right after the call to Refract).
-Nathan
 Post a reply to this message 
 | 
  | 
 | 
  | 
I tried it out with a number of different layered texture options and it
seems to do a good job.  Overlapping objects with filter and transmit
work too.
The one thing I can't yet do with it, but I'm sure it wasn't your
intent, is make filtering act in a subtractive mixing manner - like the
classic yellow + blue = green situation.  Still, the colors don't turn
black.  It's more of a grey, which isn't nearly as bad. 
-Mike
 
 Post a reply to this message 
 | 
  |