POV-Ray : Newsgroups : povray.binaries.animations : Planetary fly-overs with height-fields : Re: Planetary fly-overs with height-fields Server Time
23 Feb 2024 14:15:22 EST (-0500)
  Re: Planetary fly-overs with height-fields  
From: Jörg "Yadgar" Bleimann
Date: 3 Dec 2020 06:16:24
Message: <5fc8c908$1@news.povray.org>

On 22.11.20 12:02, M�tes wrote:
> Hi Yadgar,
> the original pictures are all 8-bit greyscale, and to convert them into 16-bit
> didnt help. I want to ask a co-worker if there are some Gimp-Filters to better
> them, maybe that helps. At them moment there are only 265 steps in height, hope
> that I can smooth them a littlebit.
> To get better pics I have to invest many hours of look and search in the
> internet, there was no time for this in the past month.
> Your movie looks nice, more detailed than mine.
> I plan to check out meshes to but didnt start with it.
> Do you have a skript as a starting-point for me?
> Yes, I am from cologne, you're right.
> I have a small personal blog but my website is down at the moment.
> Will inform the povray-world when its online again :)
> Alaaf,
> Mätes

To get "spherical" heightfields which follow the planet's curvature it's 
best to have a topographical bitmap in simple cylindrical projection 
(side ratio 2:1, which is important!) and then start getting the color 
values for each pixel using eval_pigment(), in a nested loop running 
from 90 to -90 degrees (latitude) and -180 to 180 degrees (longitude). 
Then you convert each color value to a height within the elevation range 
of the planet - with Earth and greyscales this would be (assuming a 
scale of 1 km per POV unit):

height = radius (i. e. 6377.5-11.022 for Earth - sealevel radius minus 
deepest point of the ocean) + (gray value*255)*((11.022 [Mariana trench] 
+ 8.8848 [Mt. Everest])/255)

(or height = radius (6377.5-0.422) + (gray value*255)*(0.422 [Dead Sea] 
+ 8.8848 [Mt. Everest])/255), if your map doesn't include ocean depths)

This height value translates as follows to a 3D point for each mesh vertex:

vertpos = height*<radians(sin(-longitude))*radians(cos(latitude)), 
radians(sin(latitude)), radians(cos(-longitude))*radians(cos(latitude))>

Note that the longitude value has to be multiplied with -1, as Earth 
longitudes increase counter-clockwise from west to east!

I think you will be able to transfer this to your Martian project 
without much effort...

...of course, after that you will have to set up the mesh2 faces from 
the index values of the vertices!

The faces are constructed this way:

#declare a = 0;
#declare c = 0;
#while (a < ydim-1)
   #declare b = 0;
   #while (b < xdim-1)
     #declare Faces[a*ydim+b]  = <a*res+b, a*res+b+1, (a+1)*res+b>;
     #declare Faces[a*ydim+b+1] = <a*res+b+1, (a+1)*res+b+1, (a+1)*res+b>;
     #declare c = c+2;
     #declare b = b+1;
   #declare a = a+1;

I hope I could help you...

See you in Khyberspace!


Now playing: Madeleine (Bernhard Brink)

Post a reply to this message

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