POV-Ray : Newsgroups : povray.general : Height field averaging? : Re: Height field averaging? Server Time
5 Nov 2024 18:26:42 EST (-0500)
  Re: Height field averaging?  
From: Christopher James Huff
Date: 15 Feb 2003 11:40:32
Message: <cjameshuff-C02A93.11392815022003@netplex.aussie.org>
In article <3e4e5ad3@news.povray.org>,
 "Tim McMurdo" <tmc### [at] prodigynet> wrote:

> Is it possible to average 2 heightfields within POV? I am thinking of doing
> this to generate an ocean surface.

Many ways. First, declare 2 pigment functions with the height maps as 
image_maps:

#declare HghtFn1 = function {pigment {image_map {...}}}
#declare HghtFn2 = function {pigment {image_map {...}}}

Now there are several ways you can use these. The most obvious would be 
an isosurface:

isosurface {
    function {y - (HghtFn1(x, y, z) + HghtFn2(x, y, z))/2}
    threshold 0
}

You could also use them to create a height field with the built-in 
height_field primitive:

height_field {
    function XRes, YRes {(HghtFn1(x, y, z) + HghtFn2(x, y, z))/2}
}

Or you could use the height field macros from shapes.inc.

HF_Square(function {(HghtFn1(x, y, z) + HghtFn2(x, y, z))/2},
    no, no, < XRes, YRes>, yes, "hf.pov", <-1,-1,-1>, < 1, 1, 1>)

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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