POV-Ray : Newsgroups : povray.programming : Re: New way of specifying transparence? : Re: New way of specifying transparence? Server Time
28 Jul 2024 20:20:52 EDT (-0400)
  Re: New way of specifying transparence?  
From: Nathan Kopp
Date: 12 Jul 1999 23:08:13
Message: <378AAC7B.B72362EB@Kopp.com>
This message is a bit technical, so I'm putting it in .programming.
=========

First, I think it should go within the texture, not the interior.  Kind
of a decoupling of color(colour) and transparency.

One forumla that could be used for general transparancy is:

Result_Colur[red] = 
  Pigment_Colour[red] * w1[red]  <op> Colour_Behind_Object[red] * w2[red];

(same formula for green, blue)

<op> is the operator that combines the two (like +, -, *)

Transmit is:
  w1[red] = w1[green] = w1[blue] = 1.0 - Transmit_Value;
  w2[red] = w2[green] = w2[blue] = Transmit_Value;
  <op> = +

Filter is:
  w1[red] = w1[green] = w1[blue] = 1.0 - Filter_Value;
  w2[red]   = Filter_Value * Pigment_Colour[red];
  w2[green] = Filter_Value * Pigment_Colour[green];
  w2[blue]  = Filter_Value * Pigment_Colour[blue];

Of course, other formulas could be used for other effects (dodge, burn,
darken, lighten, etc.)  Notice that with this you have two weights
in the combination formula, which makes the 'amount of transparence'
somewhat ambiguous.  What does 100% additive transparance mean?
What about 0% additive?

I guess for additive/subtractive you could just use:
  w1[red] = w1[green] = w1[blue] = 1.0;
  w2[red] = w2[green] = w2[blue] = Transparence_Value;

For Multiplicitve you might want:
  w1[red] = w1[green] = w1[blue] = 1.0;
  w2[red] = 1.0 / (1.0-Colour_Behind_Object[red])*Transparence_Value+
                   Colour_Behind_Object[red])

  At Transparence_Value = 0, you get
    w1[] = 1,  w2[] = Colour_Behind_Object[],
    therefore ResultColour[] = Pigment_Colour[red];

  At Transparence_Value = 0, you get
    w1[] = 1,  w2[] = 1.0,
    therefore ResultColour[] = Pigment_Colour[]*Colour_Behind_Object[];

Does this make any sense?  Is there a better way to generalize this for
easier use.  There will probably have to be some compromises in how
general it is in order to make it less overwhelming.  Or have some good
defaults with the ability to change them if you so desire.

-Nathan


Post a reply to this message

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