POV-Ray : Newsgroups : povray.newusers : get an color from a color_map : Re: get an color from a color_map Server Time
30 Jul 2024 02:21:03 EDT (-0400)
  Re: get an color from a color_map  
From: Mike Andrews
Date: 22 Nov 2004 05:50:00
Message: <web.41a1c39052a956835e1e98150@news.povray.org>
"Rafal 'Raf256' Maj" <spa### [at] raf256com> wrote:
> I have a color map like:
>
> #declare resr2_map1 = // power + -
> color_map {
>   [0.00 rgb z]
>   [0.25 rgb z*.4 + .4 + .1*x]
>   [0.50 rgb 1]
>   [0.75 rgb x*.4 + .4 + .1*z]
>   [1.00 rgb x]
> }
>
> now I want to do sometghing like:
>
> sphere { 0 1 pigment { resr2_map1(0.3) } }
>
> - to take color of value 0.3 from that color map and use it.
>
> Is there any beter way of doing this other then writting statement like:
>
> sphere { 0 1
>   pigment { function { 0.3 } color_map{ resr2_map1 } }
> }
>
> ?

I'd tend to use a spline instead for this sort of thing, ie

#declare resr2_map1 = // power + -
spline {
  linear_spline
  0.00, z
  0.25, z*.4 + .4 + .1*x
  0.50, 1
  0.75, x*.4 + .4 + .1*z
  1.00, x
}

#declare C = 0; #while (C <= 10)
  sphere { 0, 1
    pigment { rgb resr2_map1(C/10) }
    finish { ambient 1 diffuse 0 }
    scale <0.2,2,1> translate <(C-5)/2.5,0,5>
  }
#declare C = C + 1; #end

Hope this helps,

Mike Andrews.

>
>
>
> --
> http://www.raf256.com/3d/
> Rafal Maj 'Raf256', home page - http://www.raf256.com/me/
> Computer Graphics


Post a reply to this message

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