POV-Ray : Newsgroups : povray.general : Change color based on number and color_map : Re: Change color based on number and color_map Server Time
29 Jul 2024 08:23:41 EDT (-0400)
  Re: Change color based on number and color_map  
From: Alain
Date: 11 Mar 2012 13:52:30
Message: <4f5ce65e$1@news.povray.org>

> I have a variable that can be set to a temperature and I am trying to get it to
> control the color. My current setup is to use a color_map to get the range of
> color needed, then map a pattern to that gradient. The only problem is that I
> can't use color_map with a solid color, and if I try first mapping some bozo to
> a gray value determined by STemperature and then to my color_map it maps the
> temp gradient directly to the noise, bypassing the effort to make it one solid
> color.
>
>

Don't use a color_map, but a spline.
Have controll points for various temperatures and access it with the 
desired temperatures you want to represent.
Use the returned value as a plain pigment.


If you use many temperature samples, a linear spline may be enough, but 
a cubic_spline will give you a smooth regular curve.
This is a big advantage compared to an array. An array only allow you to 
have discreete values, and may need to be vary large, while a spline 
gives you a continously changing value and support non-integer indexes.
It's accessed in a way that is similar to an array.



Alain


Post a reply to this message

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