POV-Ray : Newsgroups : povray.binaries.images : Converting a constrained projected heightfield pigment to an isosurface : Converting a constrained projected heightfield pigment to an isosurface Server Time
29 Jul 2024 22:21:45 EDT (-0400)
  Converting a constrained projected heightfield pigment to an isosurface  
From: Jörg 'Yadgar' Bleimann
Date: 22 Jul 2013 21:25:44
Message: <51eddb98@news.povray.org>
Hi(gh)!

After a hint from Christoph Lipka, I solved my problem of constraining 
an image_map to a certain geographical region of a sphere:

// begin of code

     pigment
     {
       image_map
       {
	concat(path, tilename, ".png")
	interpolate 3
	once
       }
       scale <1/360, 1/180, 1>
       translate <(180+longstart)/360, (90+(latstart-1))/180, 0>
       warp
       {
	spherical
	orientation z
	dist_exp 0
       }
       rotate <0, 90, 0>
     }

// end of code

Went fine, as you see in the first image attached here... but then I 
tried to convert it into a function usable for an isosurface and futher 
transform it as in the demo script on Christoph Hormann's "Imagico" 
Earth view pages:

// begin of code

   #declare fn_GeoTile=
   function
   {
     pigment
     {
       image_map
       {
	concat(path, tilename, ".png")
	interpolate 3
	once
       }
       scale <1/360, 1/180, 1>
       translate <(180+longstart)/360, (90+(latstart-1))/180, 0>
       warp
       {
	spherical
	orientation z
	dist_exp 0
       }
       rotate <0, 90, 0>
     }
   }

   #local fn_DEM_Height=function { (fn_GeoTile(x, y, 0).red - 0.5)*2 * 
32.767 }

   #local fn_Shape=function { f_sphere(x, y, z, rd)  }

   #local fn_Pattern=
   function { fn_DEM_Height(1-(f_th(x,z,y)+pi)/(2*pi), f_ph(x,-z,y)/pi, 
0)  }

   // #local fn_Iso=function { fn_Shape(x,y,z)-fn_Pattern(x,y,z)/rd }

  #local fn_Iso=function { fn_Shape(x,y,z)-fn_DEM_Height(x,y,z)/rd }

   #declare Earth_Slice=
   /* sphere
   {
     0, rd
     texture
     {
       pigment { P_GeoTile }
       finish { ambient 0.1 diffuse 1 brilliance 0.4 }
     }
   } */
   isosurface{
	function { fn_Iso(x,y,z) }
	max_gradient 1.2
	accuracy 0.001
	contained_by{ sphere{ Earth_Pos, rd+9000 } }
	texture
	{
	  pigment { color rgb <0.95, 0.9, 0.7> }
           finish { ambient 0.1 diffuse 1 brilliance 0.4 }
         }
         hollow
         }

// end

Note: rd is an overall scaling factor which I set to 1, so keeping it or 
leaving it out would not make any difference.

All I ever got is a featureless surface (attached image: view from 
10,000 metres altitude), when viewed from much higher altitude, the 
terminator shows hints of some relief (grainy shadows), but spread over 
the entire globe rather than constrained to a one square degree area...

The heightfield generated from the original ASTER DEM data is 3600 x 
3600 pixels and thus too large to be posted here.

See you in Khyberspace!

Yadgar


Post a reply to this message


Attachments:
Download 'scene.png' (4 KB)

Preview of image 'scene.png'
scene.png


 

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