home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / www / breed / files / tkgobj.doc < prev    next >
Text File  |  1997-10-31  |  24KB  |  526 lines

  1.  
  2. Designing a vector object
  3. =========================
  4.  
  5. Each vector object in Alien Breed 3D II is made up of
  6. one or more smaller objects.  These smaller objects
  7. are each made up of a number of polygons which are
  8. defined as a set of points.  For example a simple cube
  9. would require only one of the 'smaller objects'
  10. consisting of six polygons defined around eight points.
  11.  
  12. The following is a simple tutorial to show you how to
  13. define a simple object, in this case the cube mentioned
  14. above.  These simple objects are designed using the ObjEd
  15. program, the AnimEditor will be described later.  As both
  16. of these programs were written using Amos Professional 2.0,
  17. if you wish to switch back to workbench at any time after
  18. you have started the program you can do so by pressing
  19. the 'Left Amiga' and 'A' keys simultaneously.  Switching
  20. back the program is achieved by the same process.  This is
  21. true of all the support programs that come with The Killing
  22. Grounds.
  23.  
  24.  
  25. Part I - Objed
  26. --------------
  27.  
  28. Double click on the ObjEd icon to run the object editor.
  29.  
  30. The main screen is divided into four sections, three with
  31. gridded areas, one without.  The three gridded areas are
  32. orthographic projections, whereas the fourth area is a
  33. perspective view (if you don't understand these terms,
  34. don't worry, all will become clear).
  35.  
  36. The top left window shows the view from above
  37. The bottom left window shows the view from infront
  38. The bottom right window shows the view from the left
  39. The top right window is alterable to show the view from
  40. any direction.
  41.  
  42. The first step in designing an object is to put in the
  43. points.  The program starts off in 'add points' mode, it
  44. should say this in the bottom left corner of the
  45. perspective window.  You can change back to the add points
  46. mode by pressing the 'a' key or by selecting 'add point'
  47. from the mode menu.  Note that because the right mouse
  48. button is used to speed up the editing process, holding
  49. it down will only access the menu if the mouse cursor is at
  50. the top of the screen.
  51.  
  52. Now let's add some points.  This is done by clicking the
  53. left mouse button in any of the three orthographic
  54. projections.  The coordinates of the point will be those
  55. shown in the bottom right of the perspective window.  As we
  56. are desiging a cube, add four points, in a square shape
  57. in the overhead view (top left window) at roughly the
  58. coords (-32,0,32) (32,0,32) (32,0,-32) (-32,0,-32).  These
  59. points will appear in the other three windows aswell.
  60.  
  61. We want to make a cube, so we need to add another four
  62. points either above or below the first four.  The easiest
  63. way to do this is to move all the existing points and then
  64. add the new points where the old ones were.
  65.  
  66. Press 'm' or select 'move point' from the 'mode' menu to
  67. change to 'move point' mode.  In this mode you can select
  68. one or more points and move them around simultaneously.
  69. To select a point, click the right mouse button (the
  70. nearest point will turn red indicating that it has been
  71. selected), now, holding down the shift key, select the
  72. remaining points.  As we wanted to select all the points it
  73. would have been quicker to hold down the right amiga key
  74. and press 'a' (a shortcut for 'select all' in the 'edit'
  75. menu).
  76.  
  77. The selected points can be moved by holding down the left
  78. mouse button (in any of the orthographic projections) and
  79. moving the mouse until the points are in the desired
  80. position.  The coords displayed in the bottom right corner
  81. of the perspective window are those of the first point
  82. selected.  Move the points until the y coord is 64.  Now
  83. change back to 'add point' mode by pressing 'a' or
  84. selecting 'add point' from the 'mode' menu and click with
  85. the left button over the top of the four points in the
  86. overhead view.  You now have the eight corners of your cube
  87. defined.  Next comes the complicated bit.
  88.  
  89. In order for TKG to run quickly, a few restrictions had to
  90. be placed on the design of vector objects, these
  91. restrictions are detailed below, but for now all you need
  92. to know about is the polygon definition order (read it
  93. below).  To change to 'new polygon' mode press 'p' or
  94. select 'new polygon' from the 'mode' menu. Bearing in mind
  95. the restrictions given below,  the faces are added to the
  96. object by clicking on each of the points of the face in
  97. turn, ending with the one you started with. If you make a
  98. mistake and click on the wrong point, you can cancel the
  99. definition so far by clicking the right mouse button or by
  100. changing mode.  If you accidentaly complete the polygon
  101. (missing out a point, or putting an incorrect point in) you
  102. can delete it by changing to the 'select face' mode (press
  103. 'f' or select it from the menu).  Use the left and right
  104. cursor keys to select the face you wish to delete (it will
  105. be highlighted in green and drawn solid).  Now press 'd' or
  106. select 'delete face' from the edit menu.  Return to 'new
  107. polygon' mode and continue defining the faces as before.
  108. Note that you can also use the perspective window for the
  109. purpose of defining polygons.  The perspective view can be
  110. moved around by holding down the 'alt' key and either of
  111. the mouse keys while the cursor is over the perspective
  112. window.  The mouse keys have different effects, the right
  113. mouse button will show the object as it normally appears
  114. when editing, the left mouse button, only shows the visible
  115. polygons (so if you haven't defined any polygons, the view
  116. will turn black).
  117.  
  118. Once you have defined your object, you can view
  119. it in its simplest form by pressing 'v', click a mouse
  120. button to cancel and return to the editor.
  121.  
  122. Now that the object has been defined the textures have to
  123. be added.  Change to 'select face' mode and select the
  124. first face.  Now press 't' to add a texture.  If you have
  125. only just  installed the program onto your hard drive, then
  126. you will have to define the directory containing all the
  127. textures you wish to use.  These should be in the
  128. graphics/textures/ draw where you installed the editing
  129. programs, but you can put them wherever you like.  Once you
  130. have selected this directory, the editors configuration
  131. will be saved to a file in your s: directory.
  132.  
  133. The additional screen that is displayed at the bottom of
  134. the editing screen is split into three sections.  On the
  135. left is the texture (if you wish to design your own
  136. textures, see the limitations below), in the middle is the
  137. texture after it has been squashed into the shape of the
  138. polygon, and on the right is a list of shortcut texture
  139. positions.
  140.  
  141. The position of the texture on the polygon is defined by
  142. moving the points on the texture at the left of the screen.
  143. Pressing 'a' will make the computer attempt an 'auto-fit',
  144. this tries to squash the polygon shape onto the texture
  145. (with varying degrees of success).  Each point can be
  146. individually moved by moving the mouse pointer over it and
  147. holding down the left mouse button, pressing the right
  148. mouse button whilst still holding down the left mouse
  149. button will return the point to its original position.  As
  150. you drag the point around, you will see the result on the
  151. polygon to the right. The polygons usually look better if
  152. you make the shape of the texture map the same or similar
  153. to that of the polygon, to see how much distortion may
  154. occur, hold down the 'r' key, this will rotate the polygon,
  155. if the texture appears to bend and warp, that is probably
  156. what will will happen in the game.
  157.  
  158. If you want to use the same texture positions on several
  159. polygons you can save the texture positions by pressing
  160. shift and one of the function keys, you will be asked to
  161. type in a name for this texture definition and the settings
  162. will be saved to your s: directory.  You can recall these
  163. settings by pressing the corresponding function key.
  164.  
  165. There are other settings available for polygons which are
  166. displayed above the texture map area.  The first is the
  167. polygon brightness, this is a value from 1-100 indicating
  168. the brightness of the polygon.  To change this, press 'b'
  169. and type in the new value.  Next is gourade shading, this
  170. can be toggled on and off by pressing the 'g' key.  When
  171. gourade shading is on, attempts are made to shade the
  172. polygon along with adjoining polygons to make them appear
  173. smoother.  The next option is glare.  This is special in
  174. that it has special textures defined for it.  Glare is
  175. toggled on/off by pressing 'l'.  When a glare polygon is
  176. drawn, it alters the colour of the pixel already on the
  177. screen (making it either darker or lighter).  Colour zero
  178. does nothing to the existing colour (transparent), then the
  179. colours 1-16 go from very bright to slightly brighter than
  180. the original colour, and 17-31 go from slightly darker to
  181. much darker than the original colour.  This enables you to
  182. do the strange 'light through mist' lighting effects.  The
  183. final option is transparency, this simply takes any colour
  184. in the texture that is 'black' (i.e. red=0 green=0 blue=0)
  185. and doesn't draw a pixel there.  This enables you to do
  186. grills with holes in, vent fans, etc.  This option is
  187. toggled on and off using the 't' key.  Once you have
  188. finished texturing this polygon, press 'esc' to return to
  189. the main editor.
  190.  
  191. This has to been done for each polygon on the object.  When
  192. you have finished you can save the object by pressing 's'
  193. or selecting save from the 'project' menu.  As a
  194. suggestion, put the extension '.obj' on the end of the
  195. filename to help distinguish it from other files.  You need
  196. not bother making a special directory for you objects as
  197. the AnimEditor will do it for you later.  If you need any
  198. additional help, there is an on-line help facility
  199. available by pressing the 'help' key.
  200.  
  201.  
  202. Part II - AnimEditor
  203. --------------------
  204.  
  205. If you want to see the vector object you designed in part
  206. one of this tuorial in the game, you first have load it
  207. into the animation editor and convert it into the correct
  208. format for the game.  Double click on the AnimEditor icon
  209. and wait for the program to load.  The main editor screen
  210. looks and operates in a very similar manner to that of
  211. the object editor.
  212.  
  213. To load in your cube, or any other object either press 'l'
  214. or select 'load object' from the project menu.  Select the
  215. object you wish to load, and it will be loaded and
  216. displayed on the screen.  To write this file out in the 
  217. format that is required by TKG press 'w' or select 'write
  218. incbin' from the project menu.  The name write incbin
  219. is left over from the very begining of Alien Breed 3D when
  220. the vector objects were an included binary file, needless
  221. to say the files are now loaded in.
  222.  
  223. When you press 'w' you will be presented with a file
  224. requester in which you should specify the name of a file
  225. for this binary file.  You will be asked if you wish 
  226. repeated and unused points to be removed.  The advantage
  227. of removing points is speedier rendering times in the game,
  228. but you can lose sharp edges between objects the have
  229. adjoining gourade shaded polygons, and the points are only
  230. checked for collision in the current frame, so if two
  231. points are in the same place in the current frame of
  232. animation but not in others, they may be removed, causing
  233. the object to bend and strech.
  234.  
  235. If you decide to remove the extra points, the project must
  236. be saved, so that it can be restored afterwards.  Simply
  237. enter a name for the project and it will be saved.  Note
  238. that a project actually consists of a directory of the name
  239. you specify containing a file 'project' containing
  240. information about the project itself.  When saving for the
  241. first time, you will be asked if you wish to move the
  242. objects in the project into this new directory, this is
  243. advisable, because your hard-drive will quickly become
  244. cluttered otherwise.
  245.  
  246.  
  247. Part III - Animating a Leg
  248. --------------------------
  249.  
  250. I have designed three simple components of a leg, saved as:
  251.  
  252.    UpperLeg.obj
  253.    LowerLeg.obj
  254.    Foot.obj
  255.    
  256. Load these three objects into the AnimEditor and I'll take
  257. you through the simple steps involved in animating it.
  258.  
  259. To start with, the view looks a little cluttered, this is
  260. because the three objects have been loaded atop one
  261. another.  Select the lower leg, either by clicking near
  262. it with the right mouse button, or by using 'n' and 'p'
  263. (next & previous) to cycle through the objects.  If you're
  264. not sure which object you have selected, press 'i' for
  265. additional information.
  266.  
  267. Using the view in the lower right window (side view) move
  268. the lower leg up and to the right of the foot, out of the
  269. way, by holding down the left mouse button over the lower
  270. right window and moving the mouse.
  271.  
  272. Now do the same with the upper leg, moving it above and to
  273. the right.  that has cleared things up considerably.
  274.  
  275. Rotate the perspective view throught 90 degrees by holding 
  276. down the left mouse button and moving the mouse so that
  277. the view is similar to the one directly below it.
  278.  
  279. Press the '=' key to zoom in a little, and use the cursor
  280. keys while the mouse pointer is over the bottom right
  281. window to centre the view again.
  282.  
  283. Now that we have our three leg parts, we want to attach
  284. them together at the knee and ankle.  Press 'c' or select
  285. 'connect objects' from the menu to change to that mode.
  286. When two objects are connected, the childs axis is placed
  287. at the same coords as a specified point relative to the
  288. parent.  This point must be a point defined in the object
  289. editor, although it need not be used in any polygons.
  290. Such points are removed if the option is requested when
  291. writing out the file for TKG.
  292.  
  293. Select the foot object (the child) by clicking the right
  294. mouse button near it's centre.  The foot wants to be joined
  295. to the left-most ankle point of the lower leg in the front
  296. view (lower left window).  This is done by clicking on it
  297. with the left mouse button.  If you want to use the
  298. perpsective window, you can, additionally, using the right
  299. mouse button to rotate the view will reveal all the points
  300. available for connection.
  301.  
  302. When you connect the objects together, the child will move
  303. to it's joined position with it's parent.  If you connect
  304. the foot to the wrong place, you can disconnect the object
  305. again by pressing 'd' while it is still selected, then try
  306. again.  Now select the lower leg and connect it to the
  307. left-most point at the bottom of the upper leg.  This
  308. forms the knee and completes the leg.
  309.  
  310. Change to 'move object' mode by pressing 'm' or selecting
  311. the option from the mode menu.  Now selet the upper leg by
  312. clicking the right ouse button near its centre.  If you
  313. have a faster computer (a bit of fast ram will do) you can
  314. select the 'Update is Quick' optin from the 'view' menu, it
  315. should change to 'Update is Informative'.  You can do this
  316. on a slower A1200 aswell, but the speed the screen updates
  317. will be reduced.  Move the upper leg by moving the mouse
  318. whilst holding down the left mouse button until the foot
  319. stands on the floor (the orange axis), if you are using the
  320. 'Update is Informative' mode, the whole leg will move
  321. (because the lower leg and foot are children of the upper
  322. leg), if you are using the 'Update is Quick' mode, only the
  323. upper leg will move, with the lower leg and foot positions
  324. being updated when you release the mouse button.  Note that
  325. you can move the axes around using the cursor keys so that
  326. you can see the whole leg.
  327.  
  328. We are now ready to animate the leg.  First we need some
  329. more animation frames.  Press 'f' or select 'set number of
  330. frames' from the animation menu.  Type in 21 as the new
  331. number of frames.  Frames added in this way are always
  332. added to the end of the animation and are exact copies of
  333. the previous last frame.  If you type in a number that is
  334. less than than the current number of frames, the frames
  335. will be deleted from the end of the current animation.
  336.  
  337. For a simple walk, all we need is four 'key frames', the
  338. rest of the frames can be generated by morphing or
  339. 'tweening' between these frames.  We have the first of our
  340. frames already with the leg straight and the foot directly
  341. below us on the floor.  We also need a frame with the leg
  342. stretched out infront, one stretched out behind, and one
  343. directly underneath us, but with the leg bent and the foot
  344. off the floor.
  345.  
  346. Goto frame 5 by either by pressing 'g' or by selecting
  347. 'Goto frame...' from the animation menu, then typing 5 at
  348. the prompt.  This frame can be the 'leg stretched out
  349. behind' frame.  To do this, first change to 'rotate object'
  350. mode by pressing 'r' or selecting 'rotate object' from the
  351. mode menu.  Select the upper leg by clicking the right
  352. mouse button near the middle of it, then with the mouse
  353. over the lower right window, hold down the left mouse
  354. button to rotate the leg to about 30 degrees behind, select
  355. the lower leg and bend it slightly aswell so the leg isn't
  356. quite straight.
  357.  
  358. Goto frame 10 using the same method as before.  This frame
  359. is going to be the one with the leg directly beneath the
  360. body, but bent.  Select the upper leg, and rotate it
  361. forwards a little, then select the lower leg and rotate it
  362. backwards.  You should notice at this point that the lower
  363. leg no longer rotates along with the upper leg, instead it
  364. stays vertical, this is because the rotation of objects is
  365. only linked if at the time of connection the axes pointed
  366. in the same direction, and the child object has not been
  367. rotated independantly.  Once you have rotated both the
  368. upper and lower leg objects, rotate the foot so the sole
  369. points backwards slightly.
  370.  
  371. Goto frame 15 using the same method as before.  This will
  372. be the frame with the leg stretched out infont.  Rotate the
  373. upper leg to about 30 degrees infront, then rotate the
  374. lower leg so that it appears straight again.  Finally
  375. rotate the foot so that it is the sole is perpendicular
  376. to the rest of the leg.  We want the foot to be on the
  377. floor in both frames 5 and 15.  Select the upper leg and
  378. change to 'move object' mode (press 'm' or select it from
  379. the mode menu).  Now move the leg down slightly until the
  380. foot touches the floor.  Goto frame 5 and do the same.
  381.  
  382. All that remains is to create the inbetween frames.  We
  383. have to morph between frames 1 and 5, then frames 5 and 10,
  384. then frames 10 and 15, then frames 15 and 1.  Note however,
  385. that it is not possible to morph between frames 15 and 1,
  386. this is why 21 frames were created instead of 20.  We
  387. simply morph between frames 15 and 21 (which is the same as
  388. frame 1) and then delete frame 21.
  389.  
  390. Morphing is acheived by pressing 't' (for tween) or by
  391. selecting 'Object Tweening' from the animation menu.  You
  392. will be asked which objects you wish to tween, all of them
  393. (press 'a') or just the selected ones (press 's').  We want
  394. to tween them all, so press 'a'.  Next you will be asked
  395. for the start and end tweening frames.  Type 1 (then press
  396. return) then type 5 (and press return).  You can also set
  397. acceleration and deceleration frames, useful for really
  398. smooth animations, but not required here, enter zero in
  399. both these requests.  The first 5 frames have just been
  400. tweened.  Repeat this process for the other 3 ranges given
  401. above.
  402.  
  403. Finally, we want to delete the last frame.  Press 'f' or
  404. select 'Set number of Frames' from the  animation menu.
  405. Type in 20 and press return.  As you will be destroying a
  406. frame, you will be asked to confirm your request by
  407. pressing 'y' (or cancel by pressing 'n').  The animation
  408. is complete.  Press 'a' to view the animation.  You have
  409. successfully completed your first animation.  Okay, so it's
  410. not very complex, and it looks a bit silly with only one
  411. leg, but it's a start.
  412.  
  413. I've covered most of the basic facilities in both editors,
  414. there are others, all of which are fairly obvious or simple
  415. to understand, and all of which are documented in the
  416. on-line help available by pressing the 'help' key.
  417.  
  418.  
  419. ***********************************************************
  420.  
  421. Restrictions on object design
  422. =============================
  423.  
  424. In the Object Editor
  425. --------------------
  426.  
  427. i) All objects must be convex.
  428.    If you imagine yourself to be standing inside
  429.    the object, you must be able to see all the other
  430.    places inside the object.  A cube, for instance,
  431.    is convex, whereas a horse-shoe is not.
  432.    
  433.    This restriction arises because each object is
  434.    simply drawn in the order it was defined, so the
  435.    polygon ordering would be incorrect in some cases
  436.    if the object were not convex.  You can, however,
  437.    use this fact to define the polygons in the order
  438.    you wish them to be drawn, an L-shaped object can
  439.    be achieved provided the two 'inner' polygons are
  440.    defined first.
  441.    
  442. ii)   All polygons must be convex.
  443.    This rule is similar to that above, but there
  444.    is no way round it,  the fact that lines drawn
  445.    up are on the left and down are on the right is
  446.    exploited for speedy polygon rendering, making
  447.    a polygon none-convex will at best make it be drawn
  448.    incorrectly, at worst, make the program crash.
  449.    For this reason there is the aditional restriction
  450.    that polygons must be flat, three sided polygons
  451.    are always flat, but polygons with more sides
  452.    aren't.  None-flat polygons will appear non-convex
  453.    from some directions.
  454.    
  455. iii)  Polygons must be defined in clockwise order.
  456.    This is a definition rather than a rule, a polygon
  457.    can only be seen from one side, if you're looking
  458.    at the polygon from the front, the points making
  459.    up the polygon must be in clockwise order,
  460.    otherwise you will be able to see the other side
  461.    but not this one.
  462.    
  463. iv)   Textures.  These must be in 32 colours, you can
  464.    draw them in any 32 of the 16.7 million colours
  465.    available with the AGA chipset, although they
  466.    will only be displayed in the 4096 colours
  467.    available through Amos Professional, and will be
  468.    remapped to the 256 colours available in the game.
  469.    The textures must be saved as 64x64 pixel pictures,
  470.    this is easily done in Brilliance, but in Deluxe
  471.    Paint, you will have to save the picture as brush.
  472.    For other paint packages, play around to see what
  473.    works.  If for some reason the object editor can't
  474.    load the picture, the screen area will appear
  475.    blank.
  476.    
  477. In the AnimEditor
  478. -----------------
  479.  
  480. i) You can have no more than 21 objects in any one
  481.    project.  Theoretically, you could have 32, but
  482.    some of the machine code was hard-wired with the
  483.    value 21, and some b****** infected my compter
  484.    with a virus that formatted my hard drive (don't
  485.    worry, the stupid thing killed itself along with
  486.    2 weeks work), and I forgot to back up the machine
  487.    code bits, I could still make it 32 objects, but
  488.    that would involve rewriting the horrible routines
  489.    used in the core of the program, sorry.
  490.    
  491. ***********************************************************
  492.  
  493. DISCLAIMER
  494. ----------
  495. Before anybody starts complaining, this is not a fully
  496. featured rendering package, nor even a partly featured
  497. object designer package, you're getting it FREE with TKG,
  498. it may blow up occasionally, it probably has a few unfixed
  499. bugs, but don't blame me, I won't be held responsible if
  500. you loose a few hours work, because I did and I don't have
  501. anyone to complain to.
  502.  
  503. ***********************************************************
  504.  
  505. CREDITS
  506. -------
  507.  
  508. Program design and coding  Charles Blessing
  509. Object Design        Charles Blessing
  510. Alien Design         Micheal Green
  511. Textures       Micheal Green
  512. Music          Ben Chanter
  513. Switch Design        Andrew Clitheroe
  514.  
  515. ***********************************************************
  516.  
  517.  ================================ ======================
  518. |   __      __  __       __   __ | I wish I could fly,  |
  519. |  /   /_/ /_/ /_/ /  / /_   /_/ | right up to the sky, |
  520. | /_  / / / / / | /_ / /_   /_/  | but I can`t.         |
  521. |                                |   (Orvil & K.Harris) |
  522.  ================================ ======================
  523.  
  524.  
  525.  
  526.