POV-Ray : Newsgroups : povray.binaries.animations : Flying through space : Flying through space Server Time
28 Sep 2024 07:44:39 EDT (-0400)
  Flying through space  
From: Rune
Date: 22 Sep 2007 04:01:57
Message: <46f4cbf5@news.povray.org>
Timothy Groves asked in povray.advanced-users for suggestions on how to make 
high speed in space visible, possible using many small objects flying past.

The animation here shows the effect of speed by making many small objects 
fly past the camera in a cube area around the camera. The good thing is that 
no matter how far the camera travels, the number of objects is constant - in 
this case only 600 objects. To add richness to the feel of vast space, I 
used a small cube with small objects and a bigger cube with bigger objects, 
to both simulate close objects flying fast past the camera and bigger 
objects that can be seen at a longer distance.

The savings in parse time and memory may not be very big in this small demo 
animation, but for a longer animation, where the camera travels much 
further, the savings will be huge by using this method.

Complete source code below:


#declare CameraLocation = vrotate(20*x,360*y*clock);

camera {location CameraLocation}

#macro Mod(A,B) mod(A,B)+B*(A<0?1:0) #end

#declare CubeSize = 30;
#declare C = 0;
#declare Seed = seed(123);
#while (C<300)

   // Create Points
   #declare ObjLoc =
      <rand(Seed),rand(Seed),rand(Seed)>*CubeSize-CameraLocation;
   #declare ObjLoc =
      <Mod(ObjLoc.x,CubeSize),Mod(ObjLoc.y,CubeSize),Mod(ObjLoc.z,CubeSize)>;
   #declare ObjLoc =
      ObjLoc+CameraLocation-CubeSize*<1,1,1>/2;

   // Make object
   sphere {ObjLoc, 0.03 pigment {rgb 1} finish {ambient 1 diffuse 0}}

   #declare C = C+1;
#end

#declare CubeSize = 10;
#declare C = 0;
#declare Seed = seed(123);
#while (C<300)

   // Create Points
   #declare ObjLoc =
      <rand(Seed),rand(Seed),rand(Seed)>*CubeSize-CameraLocation;
   #declare ObjLoc =
      <Mod(ObjLoc.x,CubeSize),Mod(ObjLoc.y,CubeSize),Mod(ObjLoc.z,CubeSize)>;
   #declare ObjLoc =
      ObjLoc+CameraLocation-CubeSize*<1,1,1>/2;

   // Make object
   sphere {ObjLoc, 0.01 pigment {rgb 1} finish {ambient 1 diffuse 0}}

   #declare C = C+1;
#end


Rune
-- 
http://runevision.com


Post a reply to this message


Attachments:
Download 'showspeed.mpg' (377 KB)

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