/* * Usage: Additive_Blend(Color, Additiveness, Transparency) * Use where a color is expected; do not precede with 'rgb' * * * If Additiveness is set to zero, then what you get is equivalent to the * usual "rgbt " * * If Transparency is set to zero, then by modifying Additiveness, you get a * mixture between the usual "rgb " (Additiveness = 0), and the full * addition of with whatever's behind it (Additiveness = 1). * * With Additiveness set the way you want it, you can then bring Transparency * up to "fade out" towards total transparency. * * Note that Additiveness values greater than one (or less than zero) are * supported and make the background even brighter than usual * (much like using "rgbt ") * * (Although Transparency values greater than one or less than zero are * also supported as usual, they will be less effective when Additiveness * is close to 1.) * * * Example: * Additive_Blend( <1, 0.1, 0.1>, 1, 0 ) * */ // Color: the color to show // Additiveness: how much of the background is added to the color (0: only color shows, 1: color + background color shows) // Transparency: how much of the background replaces the result (0: original result, 1: fully transparent (background color completely replaces the result)) #macro Additive_Blend(Color, Additiveness, Transparency) // (Can't have Additiveness == 1 as the hackish nature of this will cause division by zero) #if (Additiveness > 0.99999 & Additiveness <= 1.0) #local Additiveness = 0.99999; #end #if (Additiveness > 1.0 & Additiveness < 1.00001) #local Additiveness = 1.00001; #end #local Color = <1,1,1> * Color / (1 - Additiveness); rgbt #end