





 
 




 
 


"yesbird" <nomail@nomail> wrote:
> > Another quick example.
> >
>
> Do not see anything, except "Black Square" by kazimir Malevich:
>
Although you #declared your height_field as HF00, you forgot to actually use it
in the scene. A simple mistake. ;)
......
#declare HF00 = height_field {
function 800, 800 { Fn02(x,y,z) }
smooth
pigment { color Orange }
translate <0.5,0,0.5>
scale <2,0.05,2>
}
object{HF00} // or simply HF00, which also works...sometimes...depending on
// other code that comes before its use. Stick to object{HF00} for now.

By the way: Somewhere in the documentation, it states that when using a function
for a height_field, and creating that function from a pigment/pattern like
granite, the function 'sees' (or uses) only a 2dimensional 'slice' of the 3D
pattern and in the x/y plane, not the x/z plane as you might imagine.
Otherwise,
function { pattern { granite scale 0.5 } }
IS fully 3dimensional.
(I HOPE I have this information correct.)
Post a reply to this message


 
 




 
 


> Although you #declared your height_field as HF00, you forgot to actually use it
> in the scene. A simple mistake. ;)
Ooo, thanks for correction, the reason was a 'blind' copy/paste ...
Now I see, that relief is really beautiful, will use this function for
landscaping :)

YB
Post a reply to this message


 
 




 
 


Yet another mystery. In following example 50 is resolution, but how to set range
for x,z ? Only small part of surface is visible.

#version 3.8;
global_settings { assumed_gamma 1 }
camera
{ location <1,1,1> * 2
look_at <0,0,0>
angle 50
}
light_source { <10,10,10>, rgb <1,1,1> }
height_field
{
function 50, 50 { sin (sqrt (x*x + y*y)) / (sqrt (x*x + y*y)) }
smooth
scale <1, 0.3, 1>
pigment { green 0.8 }
}

YB
Post a reply to this message


 
 




 
 


"yesbird" <nomail@nomail> wrote:
> Yet another mystery. In following example 50 is resolution, but how to set range
> for x,z ? Only small part of surface is visible.
>
Ah, that's simple too:
By default, a height_field is only 1X1 units square (x and z). That's the way
POVray creates it, regardless of the resolution that you give to the function.
So, you would need to simply scaleup the entire height_field afterward say,
10X10. BUT, that also requires that you change two other things, to keep the
height_field looking nice and detailed:
1) increase the given resolution of the function. That is, instead of
function 50,50{...}
it should now be function 50*10,50*10 {...}. Or 500,500. Of course, this higher
resolution takes longer to process, because there are now more triangles that
have to be created. By the way, the resolution is not the square size of the
height_field, but its 'detail'... the number of triangles.
2) (optional) If you want the granite pattern to look 'the same size'
as in your original 1X1 render but spread over the larger area you
will need to either scaledown the original pattern by 1/10, OR use a
function trick to do it afterward:
#declare HF00 = height_field {
function 500, 500 { Fn02(x*10,y*10,z*10) }
(Actually, the z does not need this when making a height_field; z is
ignored.)
The interesting thing to notice is that a function's 'scaling' is the opposite
of what would seem normal 10 instead of 1/10.
Post a reply to this message


 
 




 
 


"yesbird" <nomail@nomail> wrote:
> Yet another mystery. In following example 50 is resolution, but how to set range
> for x,z ? Only small part of surface is visible.
>
> height_field
> {
> function 50, 50 { sin (sqrt (x*x + y*y)) / (sqrt (x*x + y*y)) }
> smooth
> scale <1, 0.3, 1>
> pigment { green 0.8 }
> }
That's because the sine waves are too 'large' to see in the 1X1 height_field.
Try this function 'scaling' trick for an interesting if oddlooking  result.
(I changed your light_source position to <10,4,10> to make it easier to see, and
gave the function a higher resolution):
function 200, 200 { sin (sqrt (x*x + y*y)*20) / (sqrt (x*x + y*y)*20)}
As you can see, playing around with function values can be quite fun!
Post a reply to this message


 
 




 
 


Thanks, Kenneth.
Of сourse 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.

#version 3.8;
global_settings { assumed_gamma 1 }
camera
{ location <1,1,1> * 2
look_at <0,0.5,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*10, y*10) }
smooth
scale <1, 0.3, 1>
pigment { green 0.8 }
}

YB
Post a reply to this message
Attachments:
Download 'height_field.png' (34 KB)
Preview of image 'height_field.png'


 
 




 
 


"yesbird" <nomail@nomail> wrote:
> Of сourse 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.
You're using multiplication.division to scale.
You shift it over from the origin in the same way, just with
addition/subtraction.
So where you have (x*x), you would use ( (x+3)*(x+3) ) to shift everything to
the left. Same works for y with up/down and z with backwards/forwards.
 BW
Post a reply to this message


 
 




 
 


> You shift it over from the origin in the same way, just with
> addition/subtraction.
I know, but why I should shift it ? We are looking straight at the origin, peak
should be there, or I am missing something ?

YB
Post a reply to this message


 
 




 
 


"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 longstanding problem with how functions
are kind of mirrorreversed 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'


 
 




 
 


> If you mean that the 'center' of the sine wave circle is not 'at the origin'
Exactly, this was a reason of confusion, now everything in on the "place",
almost ... :).
Thanks for beautiful illustration.

YB
Post a reply to this message


 
 




 

