POV-Ray : Newsgroups : povray.programming : Coloured attenuation. : Re: Coloured attenuation. Server Time
29 Jul 2024 10:28:28 EDT (-0400)
  Re: Coloured attenuation.  
From: Nathan Kopp
Date: 28 Aug 1999 17:46:52
Message: <37C85943.17F853E2@Kopp.com>
"Edward C." wrote:
> 
> I am working on an expansion for the object interior attenuation which
> allows the user to specify an extra keyword 'fade_colour', so that the
> attenuation tends to a specific colour, rather than just to black.  A sample
> image and explanation of why this is good are posted in p.b.i.
> My questions to you are:
> Do you care?  (ie would you find this handy?)
> Should I expand on this to allow the user to specify different fade rates
> for red, green and blue?
> Why are filter and transmit values attenuated in the shadow calculation code
> (compute_shadow_texture)?
> And why not in the visible texture calculation code
> (compute_lighted_texture)?

Actually, fade_distance and fade_color attenuation is computed in
compute_lighted_texture.  The code looks like this:

    /* Get distance based attenuation. */

    Att = Interior->Old_Refract;

    if ((Interior != NULL) && Interior_In_Ray_Container(Ray, Interior) >= 0)
    {
      if (fabs(Interior->Fade_Distance) > EPSILON)
      {
        Att /= (1.0 + pow(Intersection->Depth / Interior->Fade_Distance,
Interior->Fade_Power));
      }
    }

It is right after the call to Refract().

And, yes, fade_color is a great idea.  I was trying to make realistic colored
glass a few weeks ago and thought about adding this feature myself. 
Unfortunately, I never got around to it.

Possible implementations:
1)  Add a new keyword fade_color and multiply the attenuation by it.
2)  Change fade_distance and fade_power to accept a vector (color) instead
    of a float.  (no need for any extra keywords)

-Nathan


Post a reply to this message

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