POV-Ray : Newsgroups : povray.general : smooth gradient color_map : Re: smooth gradient color_map Server Time
2 May 2024 02:50:29 EDT (-0400)
  Re: smooth gradient color_map  
From: clipka
Date: 22 Jul 2017 03:31:55
Message: <5972ff6b$1@news.povray.org>
Am 22.07.2017 um 00:28 schrieb jr:
> hi,
> 
> can someone please point me to a color_map example which provides a
> smooth blend/gradient from (ideally) blue at 0 to red at 1 in 254
> increments?  I'd prefer a solution which does not require (an array of)
> named colours.
> 
> thank you, jr.

For a smooth gradient, all you need are the two color_map entries at 0
and 1:

    pigment {
      gradient x
      color_map {
        [0, <0,0,1>]
        [1, <1,0,0>]
      }
    }

This will give the exact same gradient as omniverse's suggestion. If it
is not to your liking, you'll have to specify additional constraints for
the gradient.

If you're unhappy with the above gradient and feel that its brightness
appears non-linear, try the `blend_mode` parameter, and maybe also
`blend_gamma`. For aesthetically pleasing results, `blend_mode 3` is
currently the best choice; it interpolates chromaticity and brightness
separately, using non-linear interpolation for the latter:

    global_settings { assumed_gamma 1.0 }
    ...

    pigment {
      gradient x
      color_map {
        blend_mode 3
        blend_gamma 2.5 // default
        [0, <0,0,1>]
        [1, <1,0,0>]
      }
    }


If you're actually interested in the numerical values, you can use the
`eval_pigment` function.


Post a reply to this message

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