POV-Ray : Newsgroups : povray.general : Using a function in a height_field declaration : Re: Using a function in a height_field declaration Server Time
28 Oct 2024 04:59:23 EDT (-0400)
  Re: Using a function in a height_field declaration  
From: Bald Eagle
Date: 15 Feb 2023 06:40:00
Message: <web.63ecc40243a1dd881f9dae3025979125@news.povray.org>
My simple test scene.

Note the vector swizzling.

#version 3.8;
global_settings {assumed_gamma 1}
#declare E = 0.00001;



camera {
 //orthographic
 //location <image_width/2, image_height/2,  -image_width*4>

 location <0, 10, -5>/2

 right x*image_width/image_height
 up y
 //sky y
 look_at <0, 0, 0>
 rotate y*0
}

light_source {<1, 30, -1> rgb 1}
plane {y, 0 pigment {checker}}


#declare BWCM = color_map {
 [0 rgb 0]
 [1 rgb 1]
}

#declare RGCM = color_map {
 [0.0 rgb x]
 [0.54 rgb x+y]
 [0.54 rgb 0] // black elevation line
 [0.55 rgb 0]
 [0.55 rgb x+y]
 [1.0 rgb y]
}


#declare eps = 0.00001;
#declare r = function {sqrt (x*x + y*y) + eps}
#declare Z = function {(18 * sin (r(x, y, z))/ r(x, y, z))+5}

#declare F = function {pigment {onion color_map {BWCM}}}

cylinder {0, y*2, 0.01 pigment {rgb y}}




height_field {
 //function 100 100 {Z (x*8, y*8, z)/25}
 function 100 100 {F(x, z, y).red}
 scale < 1, 1, -1>
 translate <0, 0, 1>
 pigment {gradient y color_map {RGCM} }
}

union {
cylinder {0, y*2, 0.01 pigment {rgb y}}

isosurface {
 //function {y-(Z (x*8, z*8, 0) - 0)/25}
 //function {y-F(x, y, z).red}
 function {y-F(x, 0, z).red}
 threshold 0
 accuracy 0.001
 max_gradient 200
 //open
 all_intersections
 contained_by {box {0, 1}}
 texture {pigment {gradient y color_map {RGCM}} finish {diffuse 1}}
}
 translate -x*2


}


Post a reply to this message

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