POV-Ray : Newsgroups : povray.newusers : Create a globe Server Time
1 Nov 2024 03:15:40 EDT (-0400)
  Create a globe (Message 1 to 2 of 2)  
From: Sanix
Subject: Create a globe
Date: 4 May 2006 04:55:01
Message: <web.4459c0de5e5702f3c2ceb9180@news.povray.org>
Hello everybody
I want to create a globe. But I don't know how to do that. Is it difficult
to create a sphere and put the image around this sphere and then it's done?
I'm not sure because I've already downloaded a script but it doesn't work.
Maybe I'm using it wrongly. The image doesn't fit to the sphere
(http://planetpixelemporium.com/images/earthmaps/earthmap1k.jpg):

#include "colors.inc"

//////////////////////////////////////
//------------- Parameters ---------//

#declare lines_color=rgbt <0,0,0,.5>; //grid map color
#declare lines_thick=.1;      //earth's grid map: thickness of the lines (in
degrees*2)
#declare lines_angle=20;      //earth's grid map: angle between lines (in
degree)
#declare earth_radius=6366;   //earth sphere's radius
#declare groundpigment=Green  //earth's pigment when no image map is chosen

#declare lines=false;         //set to true if you want to have a grid map
on the earth
#declare earthbump=true;      //set to true if you want to apply a bump map
to the earth
#declare earthimg=true;       //set to true if you want to apply an image
map to the earth
#declare atmosphere=false;    //set to true if you want the earth sphere to
have an atmosphere media around
                              //         (not very good, needs improvement!)

//                                  //
//////////////////////////////////////

#macro make_hlines(deg_interval,line_pig,line_thick_deg)

  #local line_thick=line_thick_deg/180*pi;
  #local i=0;
  #while (i<pi/2)
   [sin(i-line_thick) rgbft 1]
   [sin(i-line_thick) line_pig]
  [sin(i+line_thick) line_pig]
   [sin(i+line_thick) rgbft 1]
    #local i=i+deg_interval/180*pi;
  #end

#end

#declare piglines_h=pigment{
  gradient y
 pigment_map{
   make_hlines(lines_angle,lines_color,lines_thick)
   }
  scale earth_radius
 }

#declare piglines_v=pigment{
  radial
 pigment_map{
   [0 rgbft 1]
  [0 lines_color]
  [lines_thick/lines_angle*3 lines_color]
  [lines_thick/lines_angle*3 rgbft 1]
  }
 frequency 360/lines_angle
 }


#if (earthimg=true)

#declare pigmap1=
pigment{
   average

  pigment_map{
  [1
   image_map{
       png "earth.png"   //path to the IMAGE MAP file
    map_type 1
    interpolate 4
     }
   scale earth_radius
     ]
    }
   }

#end

#if (earthbump=true)

#declare earthbumps=
  normal{
    bump_map{
    tga
   "EarthBumpBIG.tga"  //path to the BUMP MAP file
   map_type  1
   bump_size 7
   }
   scale earth_radius
    }

#end


#declare earth=union{

sphere{0,earth_radius

texture{
  #if (earthimg=true)
  pigment{pigmap1}
 #else
 pigment{groundpigment}
 #end
 #if (earthbump=true)
 normal{earthbumps}
 #end
  }
#if (lines=true)
texture{pigment{ piglines_v}}
texture{pigment{ piglines_h}}
#end



}

#if (atmosphere=true)

difference{
sphere{0,earth_radius+100}
sphere{0,earth_radius+0.01}

hollow
pigment{rgbf 1}

interior{
 media{
  scattering{2,<0.0005,0.0005,0.001>*.5}
  intervals 5
  }

 }

}

#end

}

////////////////////////////////////////////////////////

//uncomment following for a test render
/*

camera{

location<0,0,-40000>
look_at 0

angle 30
}

light_source{
<1000,100,-100000>
color White*1.4

}

background{rgb .05}

object{earth rotate y*-130 rotate x*-20}
*/


Post a reply to this message

From: Chris B
Subject: Re: Create a globe
Date: 4 May 2006 05:43:49
Message: <4459ccd5$1@news.povray.org>
"Sanix" <nomail@nomail> wrote in message 
news:web.4459c0de5e5702f3c2ceb9180@news.povray.org...
> Hello everybody
> I want to create a globe. But I don't know how to do that. Is it difficult
> to create a sphere and put the image around this sphere and then it's 
> done?
> I'm not sure because I've already downloaded a script but it doesn't work.
> Maybe I'm using it wrongly. The image doesn't fit to the sphere
> (http://planetpixelemporium.com/images/earthmaps/earthmap1k.jpg):
>

No it's not difficult.

camera {location  <-1,1,-1> look_at <0,0.5,0> angle 50}
light_source {<30, 10, -300> color rgb 2}

sphere {<0,0.5,0>,0.5
  pigment {
    image_map {jpeg "earthmap1k.jpg" map_type 2}
  }
}

gives a cylindrical mapping (map_type 2) which I think is probably right for 
this image.
For some images you may need a spherical mapping (depending on the type of 
projection used for the image). For example:

camera {location  <-3,1,-3> look_at <0,0,0> angle 50}
light_source {<30, 10, -300> color rgb 2}

sphere {0,1
  pigment {
    image_map {jpeg "earthmap1k.jpg" map_type 1}
  }
}

map_type 1 gives a spherical mapping of an image centred at the origin.

Regards,
Chris B.


Post a reply to this message

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