|
|
Thomas de Groot <tho### [at] degrootorg> wrote:
> On 18-3-2013 3:04, Richard wrote:
> > ...... What I am
> > having trouble with is gradients. I have tried the simple example file in the
> > documentation which produces repeating bands of color. However I would like to
> > be able to choose two colors to evenly transition between. For example, this
> > code:
> >
> > #include "colors.inc"
> > camera {
> > location <0,4,6 >
> > look_at <0,0,0 >
> > }
> > light_source { <2, 4, 3> color White}
> > sphere {
> > <0,0,0>, 2
> > pigment {
> > gradient z //this is the PATTERN_TYPE
> > color_map {
> > [-4 color Red]
> > [4 color Yellow]
> > }
> > translate -1
> > }
> > }
> >
> > I thought this should have created a smooth transition from Red to Yellow on the
> > entire sphere oriented about the z axis but it has not. Instead it produces
> > alternating color bands from yellow to red. Additionally, I tested a gradient in
> > the above molecule example but when povray traced the code the section with the
> > gradient was no longer transmitting colors through it. So, the two problem I
> > need help with are creating a gradient with a smooth transition and making that
> > gradient transparent to the molecule underneath it. THANKS!
> >
> >
> To answer the two question, a colour_map goes from 0.0 to 1.0. To adapt
> it to the sphere radius in your example, you have to scale and translate
> it accordingly. I used a gradient x to better show the result. Adding
> the parameter transmit to the color makes it transparant:
>
> sphere {
> <0,0,0>, 2
> pigment {
> gradient x //this is the PATTERN_TYPE
> color_map {
> [0 color Red transmit 0.5]
> [1 color Yellow transmit 0.5]
> }
> scale 4
> translate 2*x
> }
> }
>
>
> Thomas
That did the trick! Thanks a million!
-Richard
Post a reply to this message
|
|