POV-Ray : Newsgroups : povray.binaries.images : 3D earth Server Time
13 Nov 2024 18:38:28 EST (-0500)
  3D earth (Message 1 to 4 of 4)  
From: Brad Paul
Subject: 3D earth
Date: 25 Apr 2003 13:29:33
Message: <3ea9707d@news.povray.org>
This is my first post so I have followed the rule of a ball and
reflective plane. My ball is an earth on a green and white checked
plane. However, you will notice that the larger image looks real
bad. This is because it is intended to be printed out at exactly
2in x 2in and placed behind a 40lpi lenticular lens sheet. Then this
image will really look 3D.

One of the programs of Meagpov, ABX has given me the code to add to
the povray-3.50c Linux code which provides a camera called
user_defined. This special camera will be included in Megapov 1.1 (I
think and I hope). One can think of a camera as a ray origin (C) and
initial direction (R). The user_defined camera allows the user to map
the values u,v which cover the image and both run from 0 to 1 to two
vectors C and R. I have used this to do a ray tracing that takes into
account the application of a lenticular lens sheet.

To view this image in real 3D you must get a piece of 40lpi lenticular
plastic. Then print out the image such that it is 2 inches square (at
360dpi). Then place the lenticular plastic on the print out and you
will see a 3D globe floating on the page.

Because the code is so short I have just placed it here:
(of course you will need to find your own earth image map)

//All units in in

#include "colors.inc"	// Standard Color definitions
background{White}
global_settings { ambient_light White }

#declare xsize=2; //The physical x size on paper when printed in inches
#declare ysize=2;   //The physical y size on paper when printed in inches

#declare Avec=<0,0,0>; //Where camera is looking
#declare Lvec=<0,0,-30>; //Location of camera plane
#declare Up=<0,ysize,0>;
#declare Right=<xsize,0,0>;
#declare n=1.576; //index of refraction of lens sheet n=0 will remove 
the effect of the
//lens sheet and give a normal image.
#declare f=.089; //focal length of lens on lens sheet
#declare p=1/40; //one over the real lpi of the lens sheet.

//Make the functions
#declare ax=Avec.x;
#declare ay=Avec.y;
#declare az=Avec.z;
#declare lx=Lvec.x;
#declare ly=Lvec.y;
#declare lz=Lvec.z;
#declare ux=Up.x;
#declare uy=Up.y;
#declare uz=Up.z;
#declare uUp=vnormalize(Up);
#declare uux=uUp.x;
#declare uuy=uUp.y;
#declare uuz=uUp.z;
#declare rl=vlength(Right);
#declare rx=Right.x;
#declare ry=Right.y;
#declare rz=Right.z;

#declare dirxnxy=uux*(ax*uux-lx*uux+ay*uuy-ly*uuy+az*uuz-lz*uuz);
#declare dirynxy=uuy*(ax*uux-lx*uux+ay*uuy-ly*uuy+az*uuz-lz*uuz);
#declare dirznxy=uuz*(ax*uux-lx*uux+ay*uuy-ly*uuy+az*uuz-lz*uuz);
#declare 
dirx=function(x,y){cos((n*(p-2*rl*x+2*p*int(rl*x*pow(p,-1)))*pow(f,-1))/2)*(ax+uux*(-(ay*uuy)+ly*uuy-az*uuz+lz*uuz)+lx*(-1+pow(uux,2))-ax*pow(uux,2))+(-(az*uuy)+lz*uuy+(ay-ly)*uuz)*sin((n*(p-2*rl*x+2*p*int(rl*x*pow(p,-1)))*pow(f,-1))/2)}
#declare 
diry=function(x,y){cos((n*(p-2*rl*x+2*p*int(rl*x*pow(p,-1)))*pow(f,-1))/2)*(ay+uuy*(-(ax*uux)+lx*uux-az*uuz+lz*uuz)+ly*(-1+pow(uuy,2))-ay*pow(uuy,2))+(az*uux-lz*uux+(-ax+lx)*uuz)*sin((n*(p-2*rl*x+2*p*int(rl*x*pow(p,-1)))*pow(f,-1))/2)}
#declare 
dirz=function(x,y){cos((n*(p-2*rl*x+2*p*int(rl*x*pow(p,-1)))*pow(f,-1))/2)*(az+(-(ax*uux)+lx*uux-ay*uuy+ly*uuy)*uuz+lz*(-1+pow(uuz,2))-az*pow(uuz,2))+(-(ay*uux)+ly*uux+(-ax+lx)*uuy)*sin((n*(p-2*rl*x+2*p*int(rl*x*pow(p,-1)))*pow(f,-1))/2)}
#declare 
locx=function(x,y){((ax*(ay-ly)+ly*(rx*(0.5-x)+ux*(0.5-y))+ay*(rx*(-0.5+x)+ux*(-0.5+y)))*diry(x,y)+(ax*(az-lz)+lz*(rx*(0.5-x)+ux*(0.5-y))+az*(rx*(-0.5+x)+ux*(-0.5+y)))*dirz(x,y)+dirx(x,y)*(ax*lx+2*ay*ly+2*az*lz-0.5*ax*rx+0.5*lx*rx-0.5*ax*ux+0.5*lx*ux+ax*rx*x-lx*rx*x+ax*ux*y-lx*ux*y-pow(ay,2)-pow(az,2)-pow(lx,2)-pow(ly,2)-pow(lz,2)))*pow((ax-lx)*dirx(x,y)+(ay-ly)*diry(x,y)+(az-lz)*dirz(x,y),-1)}
#declare 
locy=function(x,y){((lx*(-ay+ry*(0.5-x)+uy*(0.5-y))+ax*(ay+ry*(-0.5+x)+uy*(-0.5+y)))*dirx(x,y)+(ay*(az-lz)+lz*(ry*(0.5-x)+uy*(0.5-y))+az*(ry*(-0.5+x)+uy*(-0.5+y)))*dirz(x,y)+diry(x,y)*(2*ax*lx+ay*ly+2*az*lz-0.5*ay*ry+0.5*ly*ry-0.5*ay*uy+0.5*ly*uy+ay*ry*x-ly*ry*x+ay*uy*y-ly*uy*y-pow(ax,2)-pow(az,2)-pow(lx,2)-pow(ly,2)-pow(lz,2)))*pow((ax-lx)*dirx(x,y)+(ay-ly)*diry(x,y)+(az-lz)*dirz(x,y),-1)}
#declare 
locz=function(x,y){((lx*(-az+rz*(0.5-x)+uz*(0.5-y))+ax*(az+rz*(-0.5+x)+uz*(-0.5+y)))*dirx(x,y)+(ly*(-az+rz*(0.5-x)+uz*(0.5-y))+ay*(az+rz*(-0.5+x)+uz*(-0.5+y)))*diry(x,y)+dirz(x,y)*(2*ax*lx+2*ay*ly+az*lz-0.5*az*rz+0.5*lz*rz-0.5*az*uz+0.5*lz*uz+az*rz*x-lz*rz*x+az*uz*y-lz*uz*y-pow(ax,2)-pow(ay,2)-pow(lx,2)-pow(ly,2)-pow(lz,2)))*pow((ax-lx)*dirx(x,y)+(ay-ly)*diry(x,y)+(az-lz)*dirz(x,y),-1)}


camera{
   user_defined
   location {
     function{locx(u,v)}
     function{locy(u,v)}
     function{locz(u,v)}
   }
   direction {
     function{ dirx(u,v) }
     function{ diry(u,v) }
     function{ dirz(u,v) }
   }
}


light_source {<0,10,-20> White}
//****************************************************************
// Add pov code after this point
#declare zmax_in=-2;
#declare zmax_out=1.5;

//#######################################################
// Earth declares
#declare R=.25*xsize;

#declare Earth=
   sphere {0, R
     pigment {image_map
       {png 
"/home/paulb/devlopment_flip/planet_maps/land_ocean_ice_cloud_2048.png"
	map_type 1}}
     finish {ambient .5 diffuse 1}
     rotate <0,210,0>
     rotate <-10,0,0>
   }

//%%%%%%%%%%%%%%%%%%%%%%%%%
// The earth
object{Earth
   translate <0,.25*ysize,0>
}
//%%%%%%%%%%%%%%%%%%%%%%%%%
box{<-2*xsize,0,2*zmax_in>,<2*xsize,-.1,2*zmax_out>
   pigment { checker Green, White
     rotate <0,75,0>
     scale .3
   }
   finish {
     ambient .2
     diffuse .6
     specular .85
     roughness .001
     reflection {
       .75
     }
   }
    rotate <-30,0,0>
}


Post a reply to this message


Attachments:
Download 'view.png' (43 KB) Download 'earth_360dpi.png' (497 KB)

Preview of image 'view.png'
view.png

Preview of image 'earth_360dpi.png'
earth_360dpi.png


 

From: ABX
Subject: Re: 3D earth
Date: 25 Apr 2003 13:39:39
Message: <9dsiavcb5nrtt5sfuneonl5uh49t1e6vi1@4ax.com>
On Fri, 25 Apr 2003 13:29:23 -0400, Brad Paul
<bradpaul!spam@maps!bdp-optics.com> wrote:
> To view this image in real 3D you must get a piece of 40lpi lenticular
> plastic. Then print out the image such that it is 2 inches square (at
> 360dpi). Then place the lenticular plastic on the print out and you
> will see a 3D globe floating on the page.

I have never expected this patch will be usefull so soon. Thanks. You made me
happy for whole weekend and increased my willingness to patching :-)

ABX


Post a reply to this message

From: James Hughes
Subject: Re: 3D earth
Date: 9 Jul 2003 12:13:38
Message: <Xns93B3737B96A39marihugh7cscom@204.213.191.226>
forgive me if this question has been answered but does anyone know where
i can actually get a lenticular lens? i spent DAYS searching for a place
to buy them a few months ago. Thanks.


Post a reply to this message

From: ABX
Subject: Re: 3D earth
Date: 9 Jul 2003 13:13:34
Message: <i0jogvc11pbq93brlbhphr22raof1m73vk@4ax.com>
On 9 Jul 2003 12:13:38 -0400, James Hughes <mar### [at] cscom> wrote:
> forgive me if this question has been answered but does anyone know where
> i can actually get a lenticular lens? i spent DAYS searching for a place
> to buy them a few months ago. Thanks.

Contact Brad Paul personaly. I'm not sure if he is still actively here.
He is here: http://www.bdp-optics.com/

ABX


Post a reply to this message

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