POV-Ray : Newsgroups : povray.advanced-users : Spherical Heightfields Server Time
21 Feb 2025 23:35:18 EST (-0500)
  Spherical Heightfields (Message 1 to 3 of 3)  
From: Maetes
Subject: Spherical Heightfields
Date: 18 Feb 2025 07:30:00
Message: <web.67b47b18cb1bd5e34d0a98d30225ff5@news.povray.org>
I'm currently trying my hand at spherical heightfields, but I'm running into
strange problems.
I put a height map (DEM) of the moon around a sphere, based on these forum
posts:
https://news.povray.org/povray.binaries.images/thread/%3C38a2dc5b%40news.povray.org%3E
https://news.povray.org/povray.text.scene-files/thread/%3C38A037EB.504C1A6%40inapg.inra.fr%3E/?ttop=444549&toff=750

Everything looks good in the global view, but when I zoom in closer, radial
errors appear at the day-night boundary.
A higher resolution of the DEM does not change anything, and it works fine when
using bump_map.
But the larger the sphere (contained_by), the finer the disturbances?!

Unfortunately, I have no idea what the functions in the script do.
This one in particular puzzles me:
x*x+y*y+z*z + 0.1 - hftext(x,y,z).y * 0.03

Can someone help me with that?
Is there a reasonable tutorial that explains the working of user-defined
functions well?
Or does anyone find the bug in the script that causes the glitches?

doesnt helps me to understand the stuff:
https://www.povray.org/documentation/view/3.6.2/231/


My code used, greatly simplified:

 #declare hftext = function {
  pigment {
   image_map {
    png "moon_dem.png"
    map_type 1
   }
  }
 }
 #local mResult = isosurface {
  function {
   x*x+y*y+z*z + 0.1 -
   hftext(x,y,z).y * 0.03
  }
  contained_by {
   sphere {0,1}
  }
  max_gradient 10
  threshold 0.95
  //threshold 2
  texture {
    pigment {
     color rgb <0.3, 0.3, 0.3>
    }
  }
 }

Thanks,
Martin


Post a reply to this message


Attachments:
Download 'ma_po_error_02_without_sf_small.png' (457 KB)

Preview of image 'ma_po_error_02_without_sf_small.png'
ma_po_error_02_without_sf_small.png


 

From: Bald Eagle
Subject: Re: Spherical Heightfields
Date: 18 Feb 2025 10:00:00
Message: <web.67b4a0486a47dfbba5a6be6925979125@news.povray.org>
"Maetes" <nomail@nomail> wrote:

> Unfortunately, I have no idea what the functions in the script do.
> This one in particular puzzles me:
> x*x+y*y+z*z + 0.1 - hftext(x,y,z).y * 0.03
>
> Can someone help me with that?
> Is there a reasonable tutorial that explains the working of user-defined
> functions well?
> Or does anyone find the bug in the script that causes the glitches?

Do you get any messages about a max gradient and/or your isosurface may have
holes?

x*x+y*y+z*z + 0.1 - hftext(x,y,z).y * 0.03

So, the standard equation for a sphere is sqrt (x*x + y*y + z*z) - Radius = 0
What you're doing with the above equation is using the elevation of the
heightfield to modify the radius at any given point on the sphere.

and yes, your contained by object needs to be large enough to hold the entire
displaced surface, else it will get clipped.

(just curious: try adding the sqrt() around the x y z parts and see if that
helps any)


> My code used, greatly simplified:
>
>  #declare hftext = function {
>   pigment {
>    image_map {
>     png "moon_dem.png"
>     map_type 1
>    }
>   }
>  }
>  #local mResult = isosurface {
>   function {
>    x*x+y*y+z*z + 0.1 -
>    hftext(x,y,z).y * 0.03
>   }
>   contained_by {
>    sphere {0,1}
>   }
>   max_gradient 10
>   threshold 0.95
>   //threshold 2
>   texture {
>     pigment {
>      color rgb <0.3, 0.3, 0.3>
>     }
>   }
>  }
>
> Thanks,
> Martin

Also look at:

https://news.povray.org/povray.binaries.images/thread/%3C5f16dc29%40news.povray.org%3E/


- BE


Post a reply to this message

From: kurtz le pirate
Subject: Re: Spherical Heightfields
Date: 18 Feb 2025 11:03:52
Message: <67b4af68$1@news.povray.org>
On 18/02/2025 13:25, Maetes wrote:
> I'm currently trying my hand at spherical heightfields, but I'm running into
> strange problems.
> I put a height map (DEM) of the moon around a sphere, based on these forum
> posts:
>
https://news.povray.org/povray.binaries.images/thread/%3C38a2dc5b%40news.povray.org%3E
>
https://news.povray.org/povray.text.scene-files/thread/%3C38A037EB.504C1A6%40inapg.inra.fr%3E/?ttop=444549&toff=750
> 
> Everything looks good in the global view, but when I zoom in closer, radial
> errors appear at the day-night boundary.
> A higher resolution of the DEM does not change anything, and it works fine when
> using bump_map.
> But the larger the sphere (contained_by), the finer the disturbances?!
> 
> Unfortunately, I have no idea what the functions in the script do.
> This one in particular puzzles me:
> x*x+y*y+z*z + 0.1 - hftext(x,y,z).y * 0.03
> 
> Can someone help me with that?
> Is there a reasonable tutorial that explains the working of user-defined
> functions well?
> Or does anyone find the bug in the script that causes the glitches?
> 

The moon... very good subject. Have you looked at LUNEX ?
Lots of examples and code :

<https://www.phpsciencelabs.com/lunex-for-pov-ray/>




-- 
kurtz le pirate
compagnie de la banquise


Post a reply to this message

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