POV-Ray : Newsgroups : povray.general : color shift : Re: color shift Server Time
2 Aug 2024 00:14:23 EDT (-0400)
  Re: color shift  
From: Slime
Date: 19 Feb 2005 00:04:51
Message: <4216c8f3$1@news.povray.org>
> Ok I am trying to make a box that starts at the top with a red color, ends
> at the bottem with black and the color morphs from red to black as you go
> from top to bottem. I am reading the manual to try to figure this but I am
> lost. and I have the strong feeling that this is in there somewhere

This can be done with a simple color_map:

box {
    <1,2,3>, <4,5,6>
    pigment {
        gradient y // pattern that goes from 0 to 1 over and over as you go
upwards
        color_map {
            [0 rgb <0,0,0>] // black at bottom
            [1 rgb <1,0,0>] // red at top
        }
        scale <1, 3.001, 1> // scale by slightly more than the box's height
in the y-direction
        translate 1.9995*y // translate so the bottom almost matches up with
the bottom of the box
    }
}

Note that I scaled the pattern slightly higher than the box's height so that
the top and bottom surface of the box would not be right at the place where
the red abruptly transitions into black, causing possible artifacts.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

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