POV-Ray : Newsgroups : povray.programming : Tell me what you think... : Tell me what you think... Server Time
29 Jul 2024 02:20:27 EDT (-0400)
  Tell me what you think...  
From: Nathan Kopp
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

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