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:11:03 EDT (-0400)
  Re: Change color based on number and color_map  
From: Le Forgeron
Date: 12 Mar 2012 11:12:33
Message: <4f5e1261@news.povray.org>
Le 11/03/2012 18:52, Alain a écrit :
> 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.

IIRC:
If you are using a linear spline, I guess there is no gain from using a
color_map. linear Interpolation is performed on color_map when the value
is not found in the map.

Using a non-linear spline might be trickier: some points are used only
as control and will not ever appear. And such points vary with the kind
of spline. (cubic_spline eats the first and last points, for instance,
something that should be considered when doing mapping)

Also, the 3 other splines available (*) in povray are subject to provide
values outside the control points range. (it might surprise you to get a
blue component of 1.2 when all your blue controls were in the 0 to 1 range!)

*: cubic_spline, natural_spline and quadratic_spline.


Post a reply to this message


Attachments:
Download 'leforgeronspline11.png' (9 KB) Download 'leforgeronspline03.png' (8 KB) Download 'leforgeronspline09.png' (7 KB) Download 'leforgeronspline10.png' (8 KB)

Preview of image 'leforgeronspline11.png'
leforgeronspline11.png

Preview of image 'leforgeronspline03.png'
leforgeronspline03.png

Preview of image 'leforgeronspline09.png'
leforgeronspline09.png

Preview of image 'leforgeronspline10.png'
leforgeronspline10.png


 

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