POV-Ray : Newsgroups : povray.advanced-users : Get function from a height_field to define height dependent colors? Server Time
1 Nov 2024 11:17:03 EDT (-0400)
  Get function from a height_field to define height dependent colors? (Message 1 to 5 of 5)  
From: Icetoaster
Subject: Get function from a height_field to define height dependent colors?
Date: 18 May 2006 17:35:01
Message: <web.446ce78e2fa6fdce71103870@news.povray.org>
Hi,

I like evaluate values from a height_field image:
something like
#declare f=function(x,y) { height_field { tga "mountains.tga" } }

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.

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

Thanks for help,
Icetoaster


Post a reply to this message

From: Christoph Hormann
Subject: Re: Get function from a height_field to define height dependent colors?
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

From: Warp
Subject: Re: Get function from a height_field to define height dependent colors?
Date: 18 May 2006 18:07:23
Message: <446cf01b@news.povray.org>
Icetoaster <icetoaster_at_gmx.de> wrote:
> I like evaluate values from a height_field image:
> something like
> #declare f=function(x,y) { height_field { tga "mountains.tga" } }

  How would this be different from simply reading the image map directly
(as a pigment function) converted to grayscale?

  Heightfields are, after all, calculated from precisely that info.

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

  Wouldn't it be much easier to simply apply a "gradient y" texture map
to the heightfield directly?

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

  You can create a texture which depends on the slope of an object by using
the slope pattern (details in the documentation).

-- 
                                                          - Warp


Post a reply to this message

From: Icetoaster
Subject: Re: Get function from a height_field to define height dependent colors?
Date: 18 May 2006 18:40:00
Message: <web.446cf7acfdb94041e71103870@news.povray.org>
Thanks a lot for your help!
I have not seen the wood for the trees... :-)


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Get function from a height_field to define height dependent colors?
Date: 18 May 2006 22:55:51
Message: <446d33b7$1@news.povray.org>
"Icetoaster" <icetoaster_at_gmx.de> wrote in message 
news:web.446cf7acfdb94041e71103870@news.povray.org...
> Thanks a lot for your help!
> I have not seen the wood for the trees... :-)
>
>
>
>

You can try "woods.inc" for starters, then develop your own from there :P

-tgq


Post a reply to this message

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