POV-Ray : Newsgroups : povray.binaries.images : isosurface <> height_field Server Time
4 Nov 2024 15:14:09 EST (-0500)
  isosurface <> height_field (Message 1 to 9 of 9)  
From: Thomas de Groot
Subject: isosurface <> height_field
Date: 1 Mar 2006 09:24:09
Message: <4405ae89@news.povray.org>
OK. Time for one of my stupid questions.

From one function, I want to render an isosurface as well as a height_field,
following Mike Williams' tutorial. After some trial and error, I obtain the
image posted here. The problem is that the height_field (to the right) is
not centered at exactly the same location as the isosurface (to the left).
And I am unable to find out why, or what I should do about it. I am sure the
answer is ridiculously simple and if a gentle soul could help me in my
darkness, I would be most grateful :-)

I shall post the scene file in p.b.s-f under the same name.

Thanks (many!)

Thomas


Post a reply to this message


Attachments:
Download 'Iso-HF_test.jpg' (38 KB)

Preview of image 'Iso-HF_test.jpg'
Iso-HF_test.jpg


 

From: Vincent LE CHEVALIER
Subject: Re: isosurface <> height_field
Date: 1 Mar 2006 10:16:15
Message: <4405babf@news.povray.org>
Thomas de Groot wrote:
> OK. Time for one of my stupid questions.
> 
> From one function, I want to render an isosurface as well as a height_field,
> following Mike Williams' tutorial. After some trial and error, I obtain the
> image posted here. The problem is that the height_field (to the right) is
> not centered at exactly the same location as the isosurface (to the left).
> And I am unable to find out why, or what I should do about it. I am sure the
> answer is ridiculously simple and if a gentle soul could help me in my
> darkness, I would be most grateful :-)
> 
> I shall post the scene file in p.b.s-f under the same name.
> 
> Thanks (many!)
> 
> Thomas
> 
> 
> 

The problematic code is :

[...]
isosurface {
   function {y - P(x, 0, 1-z)}
[...]

which you can replace with

[...]
isosurface {
   function {y - P(x, 0, -z)}
[...]

which works fine :-) Amazing what a nasty char can do...

The explanation is that you just want to reverse the z-axis to be 
coherent with the height field. By writing  P(x, 0, 1-z) not only do you 
reverse the z axis, but you translate it as well...

Hope this helps

-- 
Vincent


Post a reply to this message

From: Bruno Cabasson
Subject: Re: isosurface <> height_field
Date: 1 Mar 2006 13:40:00
Message: <web.4405e8ec12c4035382fc96790@news.povray.org>
Vincent LE CHEVALIER <gal### [at] libertysurffr> wrote:
> Thomas de Groot wrote:
> > OK. Time for one of my stupid questions.
> >
> > From one function, I want to render an isosurface as well as a height_field,
> > following Mike Williams' tutorial. After some trial and error, I obtain the
> > image posted here. The problem is that the height_field (to the right) is
> > not centered at exactly the same location as the isosurface (to the left).
> > And I am unable to find out why, or what I should do about it. I am sure the
> > answer is ridiculously simple and if a gentle soul could help me in my
> > darkness, I would be most grateful :-)
> >
> > I shall post the scene file in p.b.s-f under the same name.
> >
> > Thanks (many!)
> >
> > Thomas
> >
> >
> >
>
> The problematic code is :
>
> [...]
> isosurface {
>    function {y - P(x, 0, 1-z)}
> [...]
>
> which you can replace with
>
> [...]
> isosurface {
>    function {y - P(x, 0, -z)}
> [...]
>
> which works fine :-) Amazing what a nasty char can do...
>
> The explanation is that you just want to reverse the z-axis to be
> coherent with the height field. By writing  P(x, 0, 1-z) not only do you
> reverse the z axis, but you translate it as well...
>
> Hope this helps
>
> --
> Vincent

Here is a general code to illustrate the principle of the conversion HF <->
ISO:

#include "colors.inc"
#include "functions.inc"
global_settings {
  assumed_gamma 1.0
}

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

camera {
  location  <0.0, 10, -30.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
}

background {Gray10}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-30, 30, -30>*100
}

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


##declare TERRAIN_SIZE = 10;
#declare TERRAIN_HEIGHT = 2;

#declare fn_Terrain = function (x, y, z) {f_agate (x, 0, z)} // Or whatever
in x-z plane. For functions in x-y plane (wood): f_wood(x, z, 0)

#declare O_ISOTerrain = isosurface
{
    function {y - TERRAIN_HEIGHT*fn_Terrain(x/TERRAIN_SIZE, 0,
z/TERRAIN_SIZE)}
    max_gradient 4
    contained_by {box {<-TERRAIN_SIZE, 0, -TERRAIN_SIZE>, <TERRAIN_SIZE,
TERRAIN_HEIGHT,TERRAIN_SIZE>}}
}

#declare O_HFTerrain = height_field
{
    function 300, 300 {fn_Terrain ((x-0.5)*2, 0, -(y-0.5)*2)}
    smooth
    translate -x/2 -z/2
    scale <2*TERRAIN_SIZE,TERRAIN_HEIGHT,2*TERRAIN_SIZE>
}

// Superimpose the 2 versions to check they are close one to another
object {O_ISOTerrain pigment {Red}}
object {O_HFTerrain pigment {Green}}


     Bruno


Post a reply to this message

From: Slime
Subject: Re: isosurface <> height_field
Date: 1 Mar 2006 22:41:08
Message: <44066954$1@news.povray.org>
Incidentally, your image makes a cool stereoscopic effect if you view it
with your eyes crossed, lining the images up.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Thomas de Groot
Subject: Re: isosurface <> height_field
Date: 2 Mar 2006 03:07:10
Message: <4406a7ae@news.povray.org>
"Vincent LE CHEVALIER" <gal### [at] libertysurffr> schreef in
bericht news:4405babf@news.povray.org...
> The problematic code is :
>
> [...]
> isosurface {
>    function {y - P(x, 0, 1-z)}
> [...]
>
> which you can replace with
>
> [...]
> isosurface {
>    function {y - P(x, 0, -z)}
> [...]
>
> which works fine :-) Amazing what a nasty char can do...
>
> The explanation is that you just want to reverse the z-axis to be
> coherent with the height field. By writing  P(x, 0, 1-z) not only do you
> reverse the z axis, but you translate it as well...
>
> Hope this helps
>

oh-oh! A little error in Mike's tutorial, eh? :-)
I shall try this out! Thanks a lot!

Thomas


Post a reply to this message

From: Thomas de Groot
Subject: Re: isosurface <> height_field
Date: 2 Mar 2006 03:08:01
Message: <4406a7e1@news.povray.org>
"Slime" <fak### [at] emailaddress> schreef in bericht
news:44066954$1@news.povray.org...
> Incidentally, your image makes a cool stereoscopic effect if you view it
> with your eyes crossed, lining the images up.
>

LOL, I had not tried that!!

Thomas


Post a reply to this message

From: Thomas de Groot
Subject: Re: isosurface <> height_field
Date: 2 Mar 2006 03:10:25
Message: <4406a871$1@news.povray.org>
"Bruno Cabasson" <bru### [at] alcatelaleniaspacefr> schreef in bericht
news:web.4405e8ec12c4035382fc96790@news.povray.org...
>
> Here is a general code to illustrate the principle of the conversion HF
<->
> ISO:
>
> #include "colors.inc"
> #include "functions.inc"
> global_settings {
>   assumed_gamma 1.0
> }
>
> // ----------------------------------------
>
> camera {
>   location  <0.0, 10, -30.0>
>   direction 1.5*z
>   right     x*image_width/image_height
>   look_at   <0.0, 0.0,  0.0>
> }
>
> background {Gray10}
>
> light_source {
>   <0, 0, 0>            // light's position (translated below)
>   color rgb <1, 1, 1>  // light's color
>   translate <-30, 30, -30>*100
> }
>
> // ----------------------------------------
>
>
> ##declare TERRAIN_SIZE = 10;
> #declare TERRAIN_HEIGHT = 2;
>
> #declare fn_Terrain = function (x, y, z) {f_agate (x, 0, z)} // Or
whatever
> in x-z plane. For functions in x-y plane (wood): f_wood(x, z, 0)
>
> #declare O_ISOTerrain = isosurface
> {
>     function {y - TERRAIN_HEIGHT*fn_Terrain(x/TERRAIN_SIZE, 0,
> z/TERRAIN_SIZE)}
>     max_gradient 4
>     contained_by {box {<-TERRAIN_SIZE, 0, -TERRAIN_SIZE>, <TERRAIN_SIZE,
> TERRAIN_HEIGHT,TERRAIN_SIZE>}}
> }
>
> #declare O_HFTerrain = height_field
> {
>     function 300, 300 {fn_Terrain ((x-0.5)*2, 0, -(y-0.5)*2)}
>     smooth
>     translate -x/2 -z/2
>     scale <2*TERRAIN_SIZE,TERRAIN_HEIGHT,2*TERRAIN_SIZE>
> }
>
> // Superimpose the 2 versions to check they are close one to another
> object {O_ISOTerrain pigment {Red}}
> object {O_HFTerrain pigment {Green}}
>
>

Excellent! Many thanks! This should do the job!

Thomas


Post a reply to this message

From: Bruno Cabasson
Subject: Re: isosurface <> height_field
Date: 2 Mar 2006 03:40:01
Message: <web.4406ae9612c4035382fc96790@news.povray.org>
"Thomas de Groot" <t.d### [at] internlnet> wrote:
> "Vincent LE CHEVALIER" <gal### [at] libertysurffr> schreef in
> bericht news:4405babf@news.povray.org...
> > The problematic code is :
> >
> > [...]
> > isosurface {
> >    function {y - P(x, 0, 1-z)}
> > [...]
> >
> > which you can replace with
> >
> > [...]
> > isosurface {
> >    function {y - P(x, 0, -z)}
> > [...]
> >
> > which works fine :-) Amazing what a nasty char can do...
> >
> > The explanation is that you just want to reverse the z-axis to be
> > coherent with the height field. By writing  P(x, 0, 1-z) not only do you
> > reverse the z axis, but you translate it as well...
> >
> > Hope this helps
> >
>
> oh-oh! A little error in Mike's tutorial, eh? :-)
> I shall try this out! Thanks a lot!
>
> Thomas

Mike's code works OK, and his tutorial is fantastic. It just adresses a
different portion of the pattern (not centered, see mountain4.pov example:
the isosurface is contained_by { box {<0,0,0>, <1,1,1>}}, and not <-1/2,
-1/2, -1/2>, <1/2, 1/2, 1/2>). If you 'recenter' Mike's code, you get the
same.

   Bruno


Post a reply to this message

From: Thomas de Groot
Subject: Re: isosurface <> height_field
Date: 3 Mar 2006 02:42:41
Message: <4407f371@news.povray.org>
"Bruno Cabasson" <bru### [at] alcatelaleniaspacefr> schreef in bericht
news:web.4406ae9612c4035382fc96790@news.povray.org...
>
> Mike's code works OK, and his tutorial is fantastic. It just adresses a
> different portion of the pattern (not centered, see mountain4.pov example:
> the isosurface is contained_by { box {<0,0,0>, <1,1,1>}}, and not <-1/2,
> -1/2, -1/2>, <1/2, 1/2, 1/2>). If you 'recenter' Mike's code, you get the
> same.
>
Oh! Of course! I am just not thinking this through! Too thick a brain case
:-)

Thomas


Post a reply to this message

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