POV-Ray : Newsgroups : povray.general : Using a function in a height_field declaration : Re: Using a function in a height_field declaration Server Time
20 May 2024 20:16:24 EDT (-0400)
  Re: Using a function in a height_field declaration  
From: yesbird
Date: 14 Feb 2023 20:40:00
Message: <web.63ec373a43a1dd8868fd655b10800fb2@news.povray.org>
This small playground localizes this issue (shifting by Y):

----------------------------------------------------------------
#include "colors.inc"

#version 3.8;
global_settings { assumed_gamma 1 }

//
// Axis textures
//
#declare tex_axis_common = texture {
          pigment{ rgb <0.70, 0.70, 0.70>}
          finish { phong 1 reflection {0.10 metallic 0.4} }}

#declare tex_axis_x = texture {
          pigment{ rgb <1.00, 0.00, 0.00>}
          finish { phong 1 reflection {0.10 metallic 0.4} }}

#declare tex_axis_y = texture {
          pigment{ rgb <0.00, 1.00, 0.00>}
          finish { phong 1 reflection {0.10 metallic 0.4} }}

#declare tex_axis_z = texture {
          pigment{ rgb <0.00, 0.00, 1.00>}
          finish { phong 1 reflection {0.10 metallic 0.4} }}
//
// Axis
//
#macro axis( len, rad, tex_odd, tex_even)
union{
    cylinder { <0, -len, 0>,<0, len, 0>, rad
               texture{ checker texture{ tex_odd } texture{ tex_even }
               translate <0.1, 0, 0.1> }}

    cone{<0, len, 0>, rad * 2, <0, len + rad * 7, 0>, 0 texture{tex_even}} }
#end

#macro axis_xyz( len_x, len_y, len_z, rad, tex_common, tex_x, tex_y, tex_z)
union{
    #if (len_x != 0) object { axis(len_x, rad, tex_common, tex_x) rotate<  0,
0,-90>} #end
    #if (len_y != 0) object { axis(len_y, rad, tex_common, tex_y) rotate<  0, 0,
 0>} #end
    #if (len_z != 0) object { axis(len_z, rad, tex_common, tex_z) rotate< 90, 0,
 0>} #end }
#end

axis_xyz( 1.5, 1.5, 1.5, 0.02,tex_axis_common,tex_axis_x,tex_axis_y,tex_axis_z)


//
// Camera from +X +Y +Z
//
/*
camera
{ orthographic
  location <5,5,5>
  look_at <0,0,0>
  angle 40
}
*/

//
// Camera from +Y
//
/*
camera
{ orthographic
  location <0,10,0> / 1.5
  look_at <0,0,0>
  angle 40
}
*/

//
// Camera from +X
//

camera
{ orthographic
  location <10,0,0> / 1.5
  look_at <0,0,0>
  angle 40
}


//
// Light
//
light_source { <0, 10, 0>, rgb <1,1,1> }
light_source { <10,0,  0>, rgb <1,1,1> }
light_source { <0, 0, 10>, rgb <1,1,1> }


//
// Poly0_2 common function
//
#declare FnPoly0_2 = function { pattern {
         granite poly_wave 0.2 scale 0.7 }}

//
// No scale - shift by Y
//
#declare HF_Poly0_2_1 = height_field {
     function 800, 800 { FnPoly0_2(x,y,z) }
     pigment {Green}}

//
// With scale - shift by Y even more
//
#declare HF_Poly0_2_2 = height_field {
     function 800, 800 { FnPoly0_2(x,y,z) }
     scale   <2, 2, 2>
     pigment {Red}}


object { HF_Poly0_2_1 }
object { HF_Poly0_2_2 }
----------------------------------------------------------------


Post a reply to this message


Attachments:
Download 'scale_y_shift.png' (46 KB)

Preview of image 'scale_y_shift.png'
scale_y_shift.png


 

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