POV-Ray : Newsgroups : povray.general : Using a function in a height_field declaration : Re: Using a function in a height_field declaration Server Time
30 Apr 2024 14:36:39 EDT (-0400)
  Re: Using a function in a height_field declaration  
From: Kenneth
Date: 14 Feb 2023 14:15:00
Message: <web.63ebdad843a1dd889b4924336e066e29@news.povray.org>
"yesbird" <nomail@nomail> wrote:
> Thanks, Kenneth.
>
> Of course I've tried to play with arguments scaling , but problem in shifting
> from origin (please look at attachment). Still can't figure out how it work.
>
Your camera was aimed toward -z, which confused me a bit, although I am still
not sure as to what problem you are seeing.

If you mean that the 'center' of the sine wave circle is not 'at the origin' but
at z=1 instead, that could be due to a long-standing problem with how functions
are kind of mirror-reversed when used in a height_field. (OR, maybe due to the
construction of your sin function itself?) I have not tested a function
height_field in awhile, so I am not sure if the odd mirroring problem was fixed
at some time in the past. (I thought it was.)

Anyway, here's my own version of your scene, with a different camera position.
Maybe it will help to clarify your question and my answer ;-)

--------
#version 3.8;
global_settings { assumed_gamma 1 }

camera
{ // location <1,1,1> * 2
  location <1.5,3,-2>
  look_at <.5,.3,0>
  angle 50
}

light_source { <10,10,10>, rgb <1,1,1> }

#declare somb = function (x,y) { sin (sqrt (x*x + y*y)) / sqrt (x*x + y*y) };

height_field
{
  function 500, 500 { somb(x*20, y*20) }
  smooth
  scale <1, 0.3, 1>
  pigment { green 0.8 }
  }

//----------

plane{y,0 pigment{rgb .2}}

//----- origin markers ---
  union{
cylinder{-5*x,5*x,.07 pigment{rgb .5*<0,1,1>}}
cylinder{-3*y,3*y,.07 translate .00001*z pigment{rgb <.4,1,.4>}}
cylinder{-5*z,5*z,.07 translate .00001*x pigment{rgb <.6,.6,1>}}

text {
    ttf "timrom.ttf" "x"
    .2, 0
    translate -.2*z
    scale 1
    rotate 90*x
    translate <5.5,0,0>
    pigment{rgb 1}
}

text {
    ttf "timrom.ttf" "y"
    .2, 0
    scale 1
    translate <0,3.5,0>
    pigment{rgb 1}
}

text {
    ttf "timrom.ttf" "z"
    .2, 0
    translate -.2*z
    scale 1
    rotate 90*x
    translate <0,0,5.5>
    pigment{rgb 1}
}
 scale .3
 no_shadow
 }


Post a reply to this message


Attachments:
Download 'temp test from newsgroup.jpg' (22 KB)

Preview of image 'temp test from newsgroup.jpg'
temp test from newsgroup.jpg


 

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