|
![](/i/fill.gif) |
CShake <cshake+pov### [at] gmail com> wrote:
> stbenge wrote:
> > If you want to mix colors this way, just use Gimp or another paint
> > program and use the eyedropper tool to the get RGB values, and divide
> > that color vector by 256.
>
> Actually, divide by 255 since there are 256 colors, but they are in the
> range 0-255. #FFFFFF; = <255,255,255>/255 = <1,1,1>
Yes! This is a very common mistake that I've seen in lots of code (in various
languages) over the years.
Here are a couple of colour mixing formulas that I find useful. In these
formulas, C, C0 & C1 are colour vectors, and A is a float, 0 <= A <= 1.
//A weighted mean between colours C0 and C1
C0 * A + C1 * (1-A)
//A muted version of colour C
rgb A + C * (1 - A)
In POV-Ray, it's possible to use negative colours, eg rgb<-1, 0, 0> is identical
to rgb <0, 1, 1>. It's also possible to use colours with components greater than
1, but such colours will get clipped in strong light, so it's probably a good
idea to avoid using this "feature".
Post a reply to this message
|
![](/i/fill.gif) |