POV-Ray : Newsgroups : povray.programming : Tell me what you think... Server Time
29 Jul 2024 04:32:51 EDT (-0400)
  Tell me what you think... (Message 1 to 2 of 2)  
From: Nathan Kopp
Subject: Tell me what you think...
Date: 14 Dec 1998 00:54:10
Message: <3674A831.7E3A0EEB@Kopp.com>
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

From: Mike
Subject: Re: Tell me what you think...
Date: 14 Dec 1998 05:56:10
Message: <3675895C.82A36EF6@aol.com>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.