POV-Ray : Newsgroups : povray.advanced-users : Get function from a height_field to define height dependent colors? : Re: Get function from a height_field to define height dependent colors? Server Time
28 Jul 2024 10:14:50 EDT (-0400)
  Re: Get function from a height_field to define height dependent colors?  
From: Christoph Hormann
Date: 18 May 2006 18:05:03
Message: <e4iqta$o1r$1@chho.imagico.de>
Icetoaster wrote:
> Hi,
> 
> I like evaluate values from a height_field image:
> something like
> #declare f=function(x,y) { height_field { tga "mountains.tga" } }

That won't work.  The only way to use an object in a function is with 
the object pattern.  But what you probably want is something like:

#declare f=function { pattern { image_pattern { ... } } }

> with x,y between [0,1].
> 
> Is this possible?
> 
> I like to use this function to define colors dependent from the height
> (e.g. starting with blue for sea level, green for middle values, gray for
> high values, and white for snow on top of the mountains.

This is much easier, simply use a vertical gradient.

> A second idea is to calculate a gradient from this function, in order to
> define the color from the steepness of the landscape (e.g. on steep
> passages there is no grass because there is no soil...).

That's what the slope pattern is for.  There are sample scenes coming 
with POV-Ray that show how this works (for example 
textures/patterns/slopemt.pov).

Christoph

-- 
POV-Ray tutorials, include files, Landscape of the week:
http://www.imagico.de/ (Last updated 04 May. 2006)
MegaPOV with mechanics simulation: http://megapov.inetart.net/


Post a reply to this message

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