POV-Ray : Newsgroups : povray.newusers : get an color from a color_map Server Time
30 Jul 2024 04:11:50 EDT (-0400)
  get an color from a color_map (Message 1 to 3 of 3)  
From: Rafal 'Raf256' Maj
Subject: get an color from a color_map
Date: 20 Nov 2004 13:02:13
Message: <Xns95A7C1F4A1CCEraf256com@203.29.75.35>
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 } } 
}

?



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


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: get an color from a color_map
Date: 20 Nov 2004 13:09:26
Message: <Xns95A7C32DC48C7raf256com@203.29.75.35>
spa### [at] raf256com news:Xns95A7C1F4A1CCEraf256com@203.29.75.35

> sphere { 0 1 pigment { resr2_map1(0.3) } }

Ofcourse the "0.3" is returned by a macro co I cant caluclate it "by hand".

Also, I came up with a trick - put somewhere a cone with gradient y and 
this color map and user trace() to get color for given value, but this dont 
seem as a nice trick, does it?


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


Post a reply to this message

From: Mike Andrews
Subject: Re: get an color from a color_map
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.