POV-Ray : Newsgroups : povray.newusers : Changing the colour of a surface depending on its height Server Time
24 Nov 2024 02:50:20 EST (-0500)
  Changing the colour of a surface depending on its height (Message 1 to 3 of 3)  
From: Colaroid
Subject: Changing the colour of a surface depending on its height
Date: 6 Oct 2010 04:50:01
Message: <web.4cac37f84570371cc0abfa3e0@news.povray.org>
Hi all

I am creating a landscape-type image from a tiff file (which I have been able to
do thanks to the great advice on this forum), but was wondering if I can colour
in different areas of the landscape in different colours, depending on the
height of the area.

For example, like a map that shows different contours with different colours
representing different altitudes.

Really, I want to accenuate the different heights of the image by using
different colours or, perhaps more specifically, by using a colour scale.

Does anybody know if this is possible or not?

Cheers


Post a reply to this message

From: Kenneth
Subject: Re: Changing the colour of a surface depending on its height
Date: 6 Oct 2010 05:35:00
Message: <web.4cac3f51e58419fa196b08580@news.povray.org>
"Colaroid" <nomail@nomail> wrote:

> Does anybody know if this is possible or not?
>

Yes indeed.  The simplest way is with a 'gradient y' color_map. You can blend
one color into another over a distance. (The default distance of the gradient y
pattern is from a height of 0.0 to a height of 1.0, but you can scale that.)
Since the base of your height_field is at 0.0 by default, you can get the color
blend to go from the base, up to the tip of your highest mountain peak. (The
color_map repeats after that.)

For example:
height_field{.....
     texture{
          pigment{
               gradient y
               color_map{
                       [0.0 rgb <.3,1,.3>] // green--starts at bottom
                       [1.0 rgb .6] // gray--ends at top
                        }
                       scale 2.5 // or whatever (to match the height of
                                 // your height_field)
                 }
             finish{ambient .2 diffuse .8}
            }
            } // end of height_field

BTW, you can have *many* colors in the color_map, between the 0.0-to-1.0 values
of the index list.

Hope this helps.

Ken


Post a reply to this message

From: Colaroid
Subject: Re: Changing the colour of a surface depending on its height
Date: 6 Oct 2010 06:40:01
Message: <web.4cac51f7e58419fac0abfa3e0@news.povray.org>
That's amazing!

Thanks Ken, very very helpful indeed.

Cheers


Post a reply to this message

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