POV-Ray : Newsgroups : povray.text.scene-files : trace function for camera path over HF Server Time
1 Nov 2024 15:27:28 EDT (-0400)
  trace function for camera path over HF (Message 1 to 3 of 3)  
From: Bob Hughes
Subject: trace function for camera path over HF
Date: 18 Apr 2000 04:30:11
Message: <38fc1d13@news.povray.org>
// Persistence of Vision Ray Tracer Scene Description File
// File: trace_HF.pov
// Vers: unofficial MegaPov 0.4
// Desc: using 'trace' to make a camera path over a height field
// Date: 00.3
// Auth: Bob Hughes
// Mail: inv### [at] aolcom?Subject=Pov-Scene
// Note: ugly script writing as usual for me, sorry.
// The idea here is to create a text file of vectors made using the trace function
// then use that to spline a path for the camera which also uses it for sky vector.
// Apparently the #while keyword refuses to be left out of the loop (pun).
// Reason for trying to leave the loop out was so a non-splined version could be made.
// Render about 30 or more frames to see the results okay.

#version unofficial MegaPov 0.4;

/* SET THIS TO 1 TO MAKE TEXT OF VECTORS, 2 or MORE FOR SPLINED PATH ANIMATION
// if set to 1 and the #while #end loop keywords only commented out non-spline path is
done.
*/
#declare Splined=2;

light_source {<10,10,-10>,1.5}

#if (Splined<=1)

#declare CLK=clock*6;

#while (CLK<6) // comment this out unless making the Flight text file

// you'll need your own HF image but any should be okay
#declare TracedObject =
height_field {
  png "mountainsmall.png" smooth
 translate -.5 scale <6,.25,6> }
#declare Norm = <0, 0, 0>;
#declare Start = <1, 1, 1>;
#declare Travel= <-2.5+((CLK/6)*4), 0, 2.5-((CLK/6)*4)>; // diagonal trek
#declare Intersect= trace (TracedObject, Start, Travel-Start, Norm);

object {
//  TracedObject
height_field {
  png "mountainsmall.png" smooth
   translate -.5 scale <6,.25,6> }
  texture {
    pigment { image_map {png "mountainsmall.png"}
     translate -.5 scale <6,6,1> rotate 90*x }
     finish {ambient .2 diffuse .9 specular .3 roughness .1}
  }
}

#if (Norm.x != 0 | Norm.y != 0 | Norm.z != 0)
#if (Norm.x > .995) #else
// #if (Norm.y > .5) #else
#if (Norm.z > .995) #else

#if (Splined=1)

// define and save the vectors to text file (crude example)

#switch (CLK)
#case (0)
#declare V1=Intersect+(Norm*<1,.275,1>);
#declare V1a=Intersect+<1,-.5,-1>;
#declare V1b=Norm;
#break
#case (1)
#declare V2=Intersect+(Norm*<1,.275,1>);
#declare V2a=Intersect+<1,-.5,-1>;
#declare V2b=Norm;
#break
#case (2)
#declare V3=Intersect+(Norm*<1,.275,1>);
#declare V3a=Intersect+<1,-.5,-1>;
#declare V3b=Norm;
#break
#case (3)
#declare V4=Intersect+(Norm*<1,.275,1>);
#declare V4a=Intersect+<1,-.5,-1>;
#declare V4b=Norm;
#break
#case (4)
#declare V5=Intersect+(Norm*<1,.275,1>);
#declare V5a=Intersect+<1,-.5,-1>;
#declare V5b=Norm;
#break
#case (5)
#declare V6=Intersect+(Norm*<1,.275,1>);
#declare V6a=Intersect+<1,-.5,-1>;
#declare V6b=Norm;
#break
#end

#declare CLK=CLK+1;
#end // loop // comment this out unless making the Flight text file

#end // splined? yes or no

// this camera is just here to prevent parse error
camera {location Intersect+(Norm*<1,.275,1>) sky Norm look_at Intersect+<1,-.5,-1>}
#end #end #end // #end

#if (Splined=1)
#fopen Flight "c:\pr3\flight.txt" write
#write
(Flight,V1,",",V1a,",",V1b,",",V2,",",V2a,",",V2b,",",V3,",",V3a,",",V3b,",",V4,",",V4a,",",V4b,",",V5,",",V5a,",",V5b,"
,",V6,",",V6a,",",V6b,"\n")
#fclose Flight
#end // splined? yes or no

#else // splined? yes or no

  #fopen Flight "c:\pr3\flight.txt" read
  #while (defined(Flight))
    #read (Flight,V1,V1a,V1b,V2,V2a,V2b,V3,V3a,V3b,V4,V4a,V4b,V5,V5a,V5b,V6,V6a,V6b)
  #end

#declare Cpos=
spline { cubic_spline
       0, V1
       .2, V2
       .4, V3
       .6, V4
       .8, V5
       1, V6
}
#declare Clat=
spline { cubic_spline
       0, V1a
       .2, V2a
       .4, V3a
       .6, V4a
       .8, V5a
       1, V6a
}
#declare Csky=
spline { cubic_spline
       0, V1b
       .2, V2b
       .4, V3b
       .6, V4b
       .8, V5b
       1, V6b
}

camera {location Cpos(clock) sky Csky(clock) look_at Clat(clock)}

height_field {
  png "mountainsmall.png" smooth translate -.5 scale <6,.25,6>
  texture {
    pigment { image_map {png "mountainsmall.png"} translate -.5 scale <6,6,1> rotate
90*x }
     finish {ambient .2 diffuse .9 specular .3 roughness .1}
  }
}

#end // splined? yes or no

// omniVerse http://users.aol.com/persistenceofv/all.htm


Post a reply to this message

From: Bob Hughes
Subject: Re: trace function for camera path over HF
Date: 18 Apr 2000 04:33:09
Message: <38fc1dc5@news.povray.org>
Oh for Pete's sake!  I left a directory path in there.  Please notice the #write and
#read parts need to have a path on
your system in order to work right. Sorry folks.

Bob


Post a reply to this message

From: Bob Hughes
Subject: Re: trace function for camera path over HF
Date: 21 Apr 2000 23:50:40
Message: <39012190$1@news.povray.org>
Think I might need to clarify that the flight.txt creation is to be a non-animated
render only
and that the animated part is intended for 'clock' to be 0 to 1, any number of frames
though.
Sorry, but I never have been good at giving directions.

Bob


Post a reply to this message

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