POV-Ray : Newsgroups : povray.newusers : Gradient fill on a cone? Server Time
1 Nov 2024 03:14:36 EDT (-0400)
  Gradient fill on a cone? (Message 1 to 3 of 3)  
From: jlew
Subject: Gradient fill on a cone?
Date: 13 May 2006 23:25:01
Message: <web.4466a2654cda0b8aa38dfa5a0@news.povray.org>
I have a cone to which I would like to apply a rainbow-like gradient fill.
The closest I have gotten is a "gradient y color_map", which looks okay,
except that I would like the color bands to be parallel to the long edges
of the cone, and increase proportionally to the radius (as opposed to the
fixed with bands parallel to the center axis of the cone).  Is there a way
to do this?  Here's my code, thanks for any advice.

#include "colors.inc"
camera {
    location  <0,0,-3>
    look_at  0
}

light_source {<0,0,-10>, White}


 cone {
  <-1,0,0>, .1, <1,0,0>, .5
  texture {
    pigment {
     gradient y color_map {
        [0.0 color Violet]
       [1/6 color Blue]
       [2/6 color Green]
       [3/6 color Yellow]
       [4/6 color Orange]
       [5/6 color Red]
       [1.0 color Violet]
       }
     }
   }
   finish { ambient 1 }
  }


Post a reply to this message

From: Mike Williams
Subject: Re: Gradient fill on a cone?
Date: 14 May 2006 03:07:33
Message: <aqaF1HAwatZEFwzR@econym.demon.co.uk>
Wasn't it jlew who wrote:
>I have a cone to which I would like to apply a rainbow-like gradient fill.
>The closest I have gotten is a "gradient y color_map", which looks okay,
>except that I would like the color bands to be parallel to the long edges
>of the cone, and increase proportionally to the radius (as opposed to the
>fixed with bands parallel to the center axis of the cone).  Is there a way
>to do this?

#include "colors.inc"
camera {
    location  <0,0,-3>
    look_at  0
}

light_source {<0,0,-10>, White}


 cone {
  <-1,0,0>, .1, <1,0,0>, .5
  texture {
    pigment {
     radial frequency 2
      color_map {
        [0.0 color Violet]
       [1/6 color Blue]
       [2/6 color Green]
       [3/6 color Yellow]
       [4/6 color Orange]
       [5/6 color Red]
       [1.0 color Violet]
       }
     }
     rotate z*90
   }
   finish { ambient 1 }
  }

Change the frequency value to control how many times the colours go
round the cone.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: jlew
Subject: Re: Gradient fill on a cone?
Date: 14 May 2006 10:35:01
Message: <web.44673f8fde6d9494a38dfa5a0@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:
> Wasn't it jlew who wrote:
> >I have a cone to which I would like to apply a rainbow-like gradient fill.
> >The closest I have gotten is a "gradient y color_map", which looks okay,
> >except that I would like the color bands to be parallel to the long edges
> >of the cone, and increase proportionally to the radius (as opposed to the
> >fixed with bands parallel to the center axis of the cone).  Is there a way
> >to do this?
>
> #include "colors.inc"
> camera {
>     location  <0,0,-3>
>     look_at  0
> }
>
> light_source {<0,0,-10>, White}
>
>
>  cone {
>   <-1,0,0>, .1, <1,0,0>, .5
>   texture {
>     pigment {
>      radial frequency 2
>       color_map {
>         [0.0 color Violet]
>        [1/6 color Blue]
>        [2/6 color Green]
>        [3/6 color Yellow]
>        [4/6 color Orange]
>        [5/6 color Red]
>        [1.0 color Violet]
>        }
>      }
>      rotate z*90
>    }
>    finish { ambient 1 }
>   }
>
> Change the frequency value to control how many times the colours go
> round the cone.
>
> --
> Mike Williams
> Gentleman of Leisure

Sweet, thank you Mike!  I figured there was something like this but never
happened upon the radial keyword.


Post a reply to this message

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