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:21:13 EDT (-0400)
  Re: Change color based on number and color_map  
From: Alain
Date: 14 Mar 2012 22:37:24
Message: <4f6155e4$1@news.povray.org>
Le 2012/03/12 11:12, Le_Forgeron a écrit :
> 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.

A color_map values are limited to the 0..1 range, a spline can go from 
3000°K (IR) to 120000°K (UV) if you want/need to. You can use something 
like this:
pigment{BlackBodySpline[5700]} for a 5700°K colour.

>
> 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)

In this case, it's used to relate a colour to a temperature. Just 
prolong the range into IR and UV areas outside the visible range or 
untill it's no longer signifiant. You need to go farther in the high 
temperatues beyong the violet.

>
> 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.

Alain


Post a reply to this message

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