POV-Ray : Newsgroups : povray.advanced-users : Spherical Heightfields Server Time
14 Mar 2025 04:56:12 EDT (-0400)
  Spherical Heightfields (Message 1 to 8 of 8)  
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

From: Maetes
Subject: Re: Spherical Heightfields
Date: 25 Feb 2025 21:50:00
Message: <web.67be801b6a47dfbb40074f6e30225ff5@news.povray.org>
Sorry for the long response-time, was a "strange" week here in Germany.

Thanks for the answers so far, but still I dont get it.


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

=> no, none.

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

=> I tried with various diameters, with strange effects and new errors

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

=> no effect

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

=> hard stuff, but I will try to understand it.

> The moon... very good subject. Have you looked at LUNEX ?

=> Good tip, thanks for that. I didn't know it before, I played around a bit.
Maybe I can learn something from that, because the results look better and
error-free after the first tests.

I will set up a new test environment in the next days/weeks, try to incorporate
Lunex's approach there. Maybe I'll get ahead with it. I can't use Lunex
completely for my purposes, but maybe I can learn from it.

Martin


Post a reply to this message

From: Maetes
Subject: Re: Spherical Heightfields
Date: 26 Feb 2025 02:05:00
Message: <web.67bebbab6a47dfbb40074f6e30225ff5@news.povray.org>
Hmmm... maybe I just see light at the end of a very long tunnel.

I picked out the most important lines from Lunex, cut them down to the bare
minimum, and now it seems to work.

One suspicion is: Size does matter.
So far I have used radii between 1 and 10 for the sphere, Lunex uses > 1000.

I'll continue to play around with it, it's far from perfect, but it looks better
than before, see picture.

Thanks again for the tips.

Martin


Post a reply to this message


Attachments:
Download 'ma_po_00.png' (1882 KB)

Preview of image 'ma_po_00.png'
ma_po_00.png


 

From: William F Pokorny
Subject: Re: Spherical Heightfields
Date: 1 Mar 2025 09:35:01
Message: <67c31b15@news.povray.org>
On 2/26/25 02:01, Maetes wrote:
> One suspicion is: Size does matter.
> So far I have used radii between 1 and 10 for the sphere, Lunex uses > 1000.

Your "Size does matter" comment got me thinking about adding a short 
article and image to my yuqk documentation. Initial versions of both 
attached; Perhaps of some help.

Bill P.


Post a reply to this message


Attachments:
Download 'issueswithsphericalisosurfaces.jpg' (121 KB) Download 'issueswithsphericalisosurfaces.txt' (5 KB)

Preview of image 'issueswithsphericalisosurfaces.jpg'
issueswithsphericalisosurfaces.jpg

From: Maetes
Subject: Re: Spherical Heightfields
Date: 10 Mar 2025 22:40:00
Message: <web.67cfa1516a47dfbb91d9a21130225ff5@news.povray.org>
Hi William,
thanks for your textfile.

I had to struggle with artifacts like in the left column of your picture, they
are now gone.
Looks good so far, only at high magnifications I have to deal with vertical
lines, see picture.
I want to work on it again in the next few days and see if I can improve it.
Will try the hints in your article, especially change accuracy settings.

On my blog I have uploaded some results that are quite impressive.
Several images, some in stereo, and a video.
More is in the works, publication maybe next week.

Blog:
https://www.maetes.com/en/astro/moon-renderings-first-results

Youtube (Bad Quality, dont know why):
https://youtu.be/WbDMOhXn8FI

Adios,
M


Post a reply to this message


Attachments:
Download 'copernicus_pic_c_0099.jpg' (286 KB)

Preview of image 'copernicus_pic_c_0099.jpg'
copernicus_pic_c_0099.jpg


 

From: William F Pokorny
Subject: Re: Spherical Heightfields
Date: 11 Mar 2025 05:37:26
Message: <67d00456$1@news.povray.org>
On 3/10/25 22:36, Maetes wrote:
> On my blog I have uploaded some results that are quite impressive.
> Several images, some in stereo, and a video.
> More is in the works, publication maybe next week.
> 
> Blog:
> https://www.maetes.com/en/astro/moon-renderings-first-results

Those look pretty good!

A long time ago - 20yrs maybe - I did a bunch of renders of the moon and 
doubt any as were good as those you've posted. :-)

One thing I saw on your first post in this thread 'I think', but I 
didn't mention is that you were not using any interpolation with your 
image_map{} (people often us 2 or 3).

This can help smooth things out with isosurfaces using images for 
offsets when your rendered image resolution nears the resolution of the 
displacement image. At some magnification the limits of the actual image 
information will show - and first away from the poles in a spherical image.

Blurring the image with an image processing tool an option too.

Blurring and interpolation come with the price of distortion, but more 
or less we are always approximating things to some degree.

Bill P.


Post a reply to this message

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