home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / msdos / raytrace / pov / gen / campath1 / campath.doc < prev    next >
Encoding:
Text File  |  1991-09-17  |  16.9 KB  |  291 lines

  1.           +-------------------------------------------------------+ 
  2.           |  John Hammerton      CamPATH v1.0      Sept 17, 1991  | 
  3.           +-------------------------------------------------------+  
  4.  
  5.                    ------- CAMPATH1.ZIP contains: ------- 
  6.                    campath.exe  -  Version 1.0 executable
  7.                    campath.bas  -  QuickBasic 4.5 source
  8.                    campath.doc  -  This document
  9.  
  10. 1. Description
  11.                                   
  12.    A. What it does:               
  13.  
  14.       CamPATH is a tool for the DKB Raytracer that helps to create animations.
  15.    (I wrote it for DKB, but it should work just fine for PV-Ray as well.)
  16.    What it actually generates is a user defined path for the camera to follow 
  17.    from frame to frame, giving the effect of 'flying' around your scene. It
  18.    does this by creating a batch file that runs DKB once for each frame of
  19.    animation and alters your camera's LOCATION statement each time. With
  20.    version 1.0, you can chose from camera paths like a simple circle or
  21.    ellipse, or the more complex lemniscate or limacon. You will be asked for
  22.    shape, size and location of the camera path and the number of frames of
  23.    animation that you desire. CamPATH will give you an instant preview of
  24.    the path, showing the location of the camera for each frame as a point 
  25.    on a grid so you can visualize how to build your scene, or how to make
  26.    the path fit into a scene that you've already done. (More on this later)
  27.  
  28.    B. What it doesn't:
  29.  
  30.       CamPATH v1.0 does not create data files and does not attempt to
  31.    show a 'preview' of what the animation will look like from the camera's
  32.    point of view. It does not require that you even HAVE a scene yet -
  33.    it ONLY creates a batch file to render a series of frames where the
  34.    camera moves in a smooth, user-defined path. This program does NOT convert
  35.    the resulting Targa files into animation format, nor attempt to play the
  36.    animation. Use your favorite post-processing Targa Animator and Player
  37.    for this purpose.
  38.  
  39.    C. What you need:
  40.  
  41.       Since the program doesn't write DKB script, it will work for any version 
  42.    of DKBTrace. (And since the DECLARE's haven't changed in PV-Ray, it should
  43.    work on that as well. Be forewarned - the SAVE defaults are set to DKB-like
  44.    terms, however.) It requires basic 640x480x16 VGA (mode 12) and doesn't do
  45.    anything tricky with interrupts or registers, so it should work with any
  46.    version of DOS and machine.
  47.  
  48. 2. Operation
  49.  
  50.      There are NO command line options. Simply execute the file and you
  51.    are presented with a grid with the axes labeled and the commands below.
  52.    <ESC> will exit to DOS. "5" will give you a two page summary of what
  53.    CamPATH does and how to do it. Numbers "1" through "4" create the
  54.    corresponding path using your input on size, shape and offset from center.
  55.    The default for each question is colored, which will be used if you 
  56.    press the Enter key, shown in [brackets]. The defaults are usually the
  57.    most simple path that can be created from the selected shape. (I don't
  58.    recommend saving these default paths directly - they have no OFFSET.)
  59.  
  60.       You will immediately notice that the grid is labeled as X and Z. This
  61.    is because the "standard" for DKB is that the Y-axis is the UP direction.
  62.    (your .dat file contains the command UP <0 1 0>)  The camera will move
  63.    through the scene HORIZONTALLY. This means the path's height is FIXED
  64.    and is determined by you, while the camera's X and Z position will
  65.    constantly change throughout the animation. This way, your camera will fly 
  66.    through the scene parallel to the floor - a very easy thing to visualize. 
  67.    (Pretend you're looking down at your scene; the grid is on the FLOOR.)
  68.    Each grid line is 50 units apart, with the edges of the VGA screen at
  69.    -300 to 300 for the X-direction and -200 to 200 for the Z-direction.
  70.    Your paths can be as big as you want, but this first version of CamPATH
  71.    will only show the points that fall inside the screen limits. This will
  72.    be changed for v2.0, but for now it's good enough for scenes with "small"
  73.    dimensions. (Spheres scaled to 10's and 20' and NOT 100's and 200's)
  74.  
  75.       Each point on the screen represents ONE frame of animation. If you
  76.    choose 100 frames, then there will be 100 little points on the screen
  77.    to draw out the shape of the path. This gives you a feel of how SMOOTH
  78.    the animation will be. You can quesstimate the distance between frames
  79.    (using the grid for reference) and choose a 'good' number of frames
  80.    accordingly. Also notice that on all shapes besides the circle, the
  81.    points are not EVENLY spaced about the path - but rather, they bunch-up
  82.    around the tight curves and are spaced-out in the long stretches. This
  83.    is a feature of the SINE's and COSINE's used to create the paths - and
  84.    makes for VERY nice animations that actually accelerate and decelerate
  85.    as they twist, turn and loop around! The effect IS definitely worth it. 
  86.    
  87.       When you're satisfied with a path that you've created, simply answer
  88.    'YES' to SAVE this path. The screen will clear and you will be asked a
  89.    series of tough questions that the program MUST know before it can
  90.    create it's batch file. If you become confused or simply forget the
  91.    answers, sensible defaults are provided at no additional cost.  
  92.    The interrogation looks like this:
  93.  
  94.    "Name for the batch file (anim.bat)"
  95.      This is the name for the file that CamPATH is about to create.
  96.      This is the file you will execute to begin rendering all the frames.
  97.      
  98.    "Name for the include file (campath.inc)"
  99.       This is the file that will contain the DECLAREd variables that move 
  100.       the camera's position for each frame. (INCLUDE "campath.inc")
  101.       (or #include "campath.inc" for PV-Ray)
  102.  
  103.    "Name of the datafile to animate (test.dat)"
  104.       Enter the name of the datafile to animate if you have one or
  105.       pick the name you will call it once you have one. It won't check
  106.       either way - it just needs to tell the raytracer what it is.
  107.      
  108.  
  109.    "Name of the definition file (trace.def)"
  110.       DKB uses a file called trace.def to store it's command line defaults 
  111.       like resolution and image quality. You may want to create a "test.def"
  112.       or an "anim.def" that contains the specific options for THIS animation.
  113.       (pvray.def is the default definition file for PV-Ray)
  114.  
  115.    "Name of your executable file (dkb.exe)"  
  116.       Enter the name you use to do a trace. (filename AND extension, please)
  117.       (this can be pvray.exe or pvpro.exe or WHATEVER)
  118.  
  119.    "Up to 4 letters for the TGA output files (anim)"
  120.       Each frame will be in Targa format, numbered 0001, 0002, etc...
  121.       So the default is anim0001.tga, anim0002.tga, etc.
  122.       (just enter between 1 and 4 letters at the prompt)
  123.  
  124.        You can then Create the batch file, Re-enter all these inputs, 
  125.     or abort this SAVE completely. Choosing CREATE will blank the screen,
  126.     show the grid and axes, and write the file to the current directory while
  127.     charting it's progress on-screen. When it's done - CamPATH will present
  128.     you with a summary of what you've created and a reminder of how to get 
  129.     the animation going. It will explain how to place the camera's
  130.     XPOS and ZPOS variables into your datafile's LOCATION command, how to
  131.     INCLUDE the .inc file into you datafile, and how to begin rendering
  132.     all the frames automatically. It will do this using the filenames that
  133.     you supplied, so you know EXACTLY what to do and where to do it.
  134.  
  135. 3.  Starting Suggestions
  136.  
  137.        If you hate reading and want to play with the thing - go to it!
  138.     For starters just draw some nice simple paths and offset them so
  139.     they rotate around or pass by (0,0) but not THROUGH (0,0). Generally 
  140.     note where the path lies (use the grid), give it about 90 frames, 
  141.     and save it. Then go write a datafile that contains...
  142.  
  143.     INCLUDE "campath.inc"   {or whatever you told it your .inc would be}
  144.  
  145.     VIEW_POINT
  146.        LOCATION < XPOS 70 ZPOS >   {The 70 is the FIXED HEIGHT of the path}
  147.        UP       < 0 1 0 >          {The Y-axis is the UP direction}
  148.        RIGHT    < 1.33333 0 0 >    {Whatever you usually use here}
  149.        LOOK_AT  < 0 20 0 >         {Look at X=0,Z=0 like you did when you
  150.     END_VIEW_POINT                  made the path, and look at a height of 20}
  151.  
  152.     ...then just put some simple objects around <0 20 0>, perhaps a nice
  153.     green and yellow checkered floor like PLANE <0 1 0> 0 END_PLANE,
  154.     and a LIGHT_SOURCE and you're done. Make sure your definition file
  155.     (trace.def) is at -w80 -h50 (or something small) and type the name
  156.     of the batch file. The batch file will AGAIN remind you of what you
  157.     need to have done and where to do it. Pressing return will start the
  158.     process of rendering all the frames, automatically. When it's done, 
  159.     compile the targas into an animation file and take a look with a player.
  160.     If you put objects too close to the camera's path, then some frames
  161.     may be obscured or trashed. This is why you want to offset the path from
  162.     (0,0) and make that the scene's center. If the majority of your scene
  163.     was junk, then your objects are too darn big for the path or the
  164.     camera's height (70) just wasn't enough. You can experiment with the
  165.     different paths - personally, I think the SINGLE LIMACON with 2 loops
  166.     is a wild ride, (this is what I used in my TABLE-CP.ZIP sample animation)
  167.     and you can LOOK_AT anything you want. You could even remove the LOOK_AT 
  168.     command and put a DIRECTION <0 0 1> in the datafile, and then your camera 
  169.     would always look straight down the +Z axis while it moves around the 
  170.     scene. But now we're getting into...
  171.  
  172. 4.  In-Depth Suggestions
  173.  
  174.        I've not done a WHOLE LOT of testing yet. I've not even mastered
  175.     a good lemniscate orbit scene with a lot of objects. However, I have
  176.     learned what works and what doesn't and not all of it so obvious.
  177.  
  178.     A. If the camera path ever passes directly over it's LOOK_AT (say, at 0,0)
  179.         that frame will be garbage. The technical reason is that you're
  180.         tipping the camera over, face first, past it's vertical - and when it
  181.         gets past that point it has to snap around to conform to the UP<0 1 0>
  182.         vector. Any path that even gets NEAR passing right above it's LOOK_AT
  183.         will give this very undesirable effect. You can easily avoid this by: 
  184.            1. offset the path when you create it and LOOK_AT (0,0) or
  185.            2. leave the path with no offset and LOOK_AT some far away point.
  186.  
  187.     B. If the camera gets very close to an object, the object will come out
  188.         distorted in that frame and may not look right. If the camera goes
  189.         INTO a solid object, those frames will be garbage. You can avoid these
  190.         two VERY COMMON problems by imagining your scene when drawing the
  191.         path and making it big enough. (or offset far enough away from things)
  192.         I usually use the middle square of the grid as my object boundary - it's
  193.         a 100x100 square and if your path is way the heck away from it
  194.         and your object(s) are inside, then you're fine. The single, 1 loop
  195.         limacon is great if you make it big (say, 300x300) and LOOK_AT the
  196.         center of the inner loop and place some objects there.
  197.  
  198.     C. The green and yellow checkered floor will be your best friend
  199.         once again for a while. It makes an EXCELLENT reference for the
  200.         animation because it shows movement so well. Then put a nice Cube on 
  201.         top of that to LOOK_AT from your fixed height. This simple scene 
  202.         traces lightning fast at 80x50 and is a really good starting point for 
  203.         'feeling' what a path is like before getting complex.
  204.  
  205.     D. ALWAYS make sure that XPOS and ZPOS are in the LOCATION command before
  206.         you run the batch file. I've mentioned this so often because if you
  207.         forget, there will be no VARIABLES in the datafile, so DKB will
  208.         trace the same darn frame (fixed camera LOCATION) over and over.
  209.  
  210.     E. Give your LIGHT_SOURCES an ALPHA 1.0 in the COLOR definition.
  211.         You'd be surprised at how often you SEE one of your little white
  212.         lightsources go cruising by in the background. 
  213.        
  214.     F. Making paths with more than 5 or 6 loops is not very practical
  215.         (especially for both kinds of limacons) because for each loop you
  216.         need that many more frames to keep the animation SMOOTH. For instance,
  217.         do a circle path at 200x200 then a single, 2 loop limacon at 200x200 -
  218.         both at 120 frames. Notice how the circle's points are very closely
  219.         spaced and the limacon gets very spread-out. You'd need about 180
  220.         frames for the limacon to become as SMOOTH as the circle.
  221.         (oh, but THAT limacon path is definitely worth the extra frames!)
  222.  
  223.     G. The lemniscates aren't all that useful yet. Since all the petals
  224.         pass over one point, it becomes tough to create a good scene that
  225.         avoids all those crossings. CamPATH v2.0 will allow you to make
  226.         lemniscates that have an inner 'hole' of any radius so you can
  227.         do fly-by's of an object from all those different directions.
  228.         BUG: The 6-petaled rose does not work. It actually does 3 petals,
  229.         then goes over the same 3 instead of "filling-in" the gaps. Sorry.
  230.  
  231.     H. Feel free to substitute XPOS and ZPOS into objects or lightsources
  232.         instead of the camera. You can get some funky things happening
  233.         that way. But don't go too crazy, the next version will probably
  234.         have this as an option BEFORE you create the batch file.
  235.  
  236.     I. DO NOT use the DIRECTION command in your VIEW_POINT statement if you
  237.         are already using a LOOK_AT. This will only confuse the raytracer; 
  238.         since you're doing a total rotation (or two or three) - you end up 
  239.         looking in ALL directions, eventually corrupting the vectors.
  240.  
  241. 5. Questions, Comments, Fortune Telling...       
  242.        
  243.       If you try and try and can't seem to get anything great - please send
  244.    me a message and I'll put some test scenes w/batch's on the board.
  245.    
  246.       I am fast at work on v2.0, so if you have an idea for a new path or 
  247.    a suggestion on how to fix something you hate about this version -
  248.    please let me know. If you want to fool with the QuickBASIC code -
  249.    go right ahead. Be warned, it's simple but not very tidy. 
  250.         
  251.       ATTENTION, this first version IS A TOY! It took maybe two days to write
  252.    the code and about two weeks to tweak and test. I just wanted to throw my
  253.    ideas onto other YCCMR folks for input as quickly as possible. I already
  254.    know what v2.0 will look like. v1.0 has no interface, no help and no nice 
  255.    way to gradually alter the shape and size of a path. And you're stuck with 
  256.    only XZ movement, with a fixed height. Version 2.0 will definitely be 
  257.    somewhat 3-dimensional and I expect that if I keep at it, it may be fully 3D 
  258.    - meaning that a lissajous camera path is very possible! (but who knows 
  259.    what THAT sucker will look like to preview!?) And by then you'll be able 
  260.    to have objects rotating WHILE the camera flies around, and other great 
  261.    feats of the powerful DKB/PVRay INCLUDE file...
  262.  
  263. 6. Disclaimer:
  264.       I've done nothing 'unusual' in my code and I've given you a copy 
  265.    (campath.bas) so you can verify this. The program does not use any 
  266.    interrupts or bios calls or strange video page swapping. It opens and
  267.    writes a single batch file and has no delete function. It could have
  268.    been written by a 10 year-old in a couple of hours. OKAY, but I still have 
  269.    to say it. I cannot be held liable for any damage that may result from the 
  270.    use or misuse of this program. There. I feel better. You probably don't.
  271.    
  272. 7. Objective
  273.  
  274.       If even ONE damn good animation comes out of this, I will be honestly
  275.    thrilled. I love when a new .FLIck hits the board and have been trying
  276.    to make a worthwhile one for a month now. That started with simple
  277.    camera and object rotations and mutated into CamPATH one night last week
  278.    while looking through my Calculus books for new objects to play with.
  279.    I see a pretty endless future for the concept of a camera riding an
  280.    equation-generated path - perhaps we can get a DKB/PVRay jet cruising 
  281.    over a fractal landscape! (THAT idea goes back to the 60's with the advent 
  282.    of computer graphics...well, I guess Mandelbrot wasn't until the 70's...
  283.    anyway either put the LOOK_AT at infinity or keep it vectored in front of 
  284.    the camera (jet) with a little addition to the code...)
  285.       The problem is, I don't know what THE PEOPLE want. I slopped v1.0
  286.    into a ZIP file and uploaded it so I could see if anyone would run
  287.    with the idea as I have. Basically, you can let me know that you like 
  288.    it by swamping YCCMR with new CamPATH flicks. Or let me know it's a
  289.    total goner by dropping me a message.
  290.  
  291.