|
![](/i/fill.gif) |
Elias Pschernig wrote:
>
> > You can add, subtract, divide and multiply pigment vectors the same as any
> > other vector:
> >
> > rgb <1,1,1>*5
> > rgb <1,0,0>+<1,1,0>
> > rgb <1,1,1>*<1,2,1>
> > ....etc.
>
> Yes, vectors, but not pigments. Not even pigment functions. By now I think I
> already have the simplest solution for what I want to do, but it is very
> complicated:
>
> (All it does is adding two pigments)
>...
>...
> Now it is understandable why I thought there's a simpler solution I guess :)
> I still hope someone can simplify it..
Elias, see my code below.
It isn't tested much...
- Maybe you can give it a few tests ?
Tor Olav
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
// Copyright 2001 by Tor Olav Kristensen
// mailto:tor### [at] hotmail com
// http://www.crosswinds.net/~tok
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
#version 3.5;
#include "colors.inc"
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
#macro MixPigments(Pigment1, Pigment2)
#local Alpha = color rgbt <0, 0, 0, 1>;
#local PFn1 = function { pigment { Pigment1 } }
#local PFn2 = function { pigment { Pigment2 } }
#local R_Pigment =
pigment {
function { PFn1(x, y, z).x + PFn2(x, y, z).x }
color_map { [ 0 color Black ] [ 1 color 4*Red ] }
}
#local G_Pigment =
pigment {
function { PFn1(x, y, z).y + PFn2(x, y, z).y }
color_map { [ 0 color Black ] [ 1 color 4*Green ] }
}
#local B_Pigment =
pigment {
function { PFn1(x, y, z).z + PFn2(x, y, z).z }
color_map { [ 0 color Black ] [ 1 color 4*Blue ] }
}
#local T_Pigment =
pigment {
function { PFn1(x, y, z).t + PFn2(x, y, z).t }
color_map { [ 0 color Black ] [ 1 color 4*Alpha ] }
}
#local MixedPigment =
pigment {
average
pigment_map {
[ R_Pigment ]
[ G_Pigment ]
[ B_Pigment ]
[ T_Pigment ]
}
}
MixedPigment
#end // macro MixPigments
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
#declare InputPigment1 =
pigment {
bozo
scale 0.3
color_map {
[ 0 color Cyan ]
[ 1 color Magenta ]
}
}
#declare InputPigment2 =
pigment {
gradient y
turbulence 0.3
color_map {
[ 0 color Yellow ]
[ 1 color Blue ]
}
}
sphere {
<0, 0, 0>, 1
pigment { MixPigments(InputPigment1, InputPigment2) }
}
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
light_source { <1, 2, -2>*100 color White }
camera {
location <0, 0, -5>
look_at <0, 0, 0>
}
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
Post a reply to this message
|
![](/i/fill.gif) |