home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / TUT11.ZIP / TUT11.TXT < prev    next >
Text File  |  1994-04-25  |  8KB  |  186 lines

  1.                    ╒═══════════════════════════════╕
  2.                    │         W E L C O M E         │
  3.                    │  To the VGA Trainer Program   │ │
  4.                    │              By               │ │
  5.                    │      DENTHOR of ASPHYXIA      │ │ │
  6.                    ╘═══════════════════════════════╛ │ │
  7.                      ────────────────────────────────┘ │
  8.                        ────────────────────────────────┘
  9.  
  10.                            --==[ PART 11 ]==--
  11.  
  12.  
  13.  
  14. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  15. ■ Introduction
  16.  
  17. Hello again everybody!
  18.  
  19. The reason _this_ one is delayed (every single trainer has been so far ;))
  20. is mainly due to a birthday (my 19th), and numerous tests at the
  21. university (ugh!).  But anyway, here it is. The sample program this time
  22. is on cross-fading. The reason for this is that many people have
  23. commented that I should be moving over to a few basic demo effects now
  24. that we have most of the basics of VGA programming.  I was also thinking
  25. of either doing sound in a future version of this trainer, or starting a
  26. separate "ASPHYXIA Sound Tutorial" series. Comments?
  27.  
  28. One major difference between this trainer and previous ones is that I am
  29. including binary files (pictures in this case). This means that it will
  30. not be available in the message bases of selected boards anymore, and it
  31. must be obtained from the file base.  Notice will however be given of
  32. it's existence in the message base.
  33.  
  34. Asphyxia has formalised things a bit, and we now have a few official
  35. distribution sites for all our demos and trainers. If you would like
  36. your BBS to become a distribution site, please email me at
  37. smith9@batis.bis.und.ac.za and I will send you the necessary info.
  38.  
  39.  
  40. If you would like to contact me, or the team, there are many ways you
  41. can do it : 1) Write a message to Grant Smith/Denthor/Asphyxia in private mail
  42.                   on the ASPHYXIA BBS.
  43.             2) Write to Denthor, EzE, Goth, Fubar or Nobody on Connectix.
  44.             3) Write to :  Grant Smith
  45.                            P.O.Box 270 Kloof
  46.                            3640
  47.                            Natal
  48.                            South Africa
  49.             4) Call me (Grant Smith) at (031) 73 2129 (leave a message if you
  50.                   call during varsity). Call +27-31-73-2129 if you call
  51.                   from outside South Africa. (It's YOUR phone bill ;-))
  52.             5) Write to smith9@batis.bis.und.ac.za in E-Mail.
  53.  
  54. NB : If you are a representative of a company or BBS, and want ASPHYXIA
  55.        to do you a demo, leave mail to me; we can discuss it.
  56. NNB : If you have done/attempted a demo, SEND IT TO ME! We are feeling
  57.         quite lonely and want to meet/help out/exchange code with other demo
  58.         groups. What do you have to lose? Leave a message here and we can work
  59.         out how to transfer it. We really want to hear from you!
  60.  
  61.  
  62.  
  63. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  64. ■ What is a "Crossfade"?
  65.  
  66. This is a simple question. When you are watching a TV program, you will
  67. often see one picture on the screen, which slowly fades to a new
  68. picture, with the new picture becoming more and more prominent and the
  69. old one becoming less and less prominent. This is a crossfade. Easy huh?
  70.  
  71. Perhaps, but it is not that easy to code on a computer...
  72.  
  73. In most demos, there is a crossfade of two colors, black and white, for
  74. example : The words 'MYDEMOTEAM' appears in large with letters, then
  75. crossfades to 'PRESENTS' in large white letters.
  76.  
  77. I decided to allow the programmer to have a bit of color to his
  78. crossfade, and the sample program can handle a many color crossfade.
  79.  
  80.  
  81. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  82. ■ How does a crossfade work?
  83.  
  84. Here comes the clever bit.
  85.  
  86. To do a crossfade, we load in two pictures, FROM and TO. Then, for every
  87. pixel in which they are different, put a new pixel in a third screen.
  88.  
  89. For example, wherever there is pixel color 9 on screen 1 and pixel color
  90. 45 on screen 2, put pixel color 1 on the third screen. You then repeat
  91. this for all combinations of pixels on screen one and two, and put the
  92. results into screen 3. Here it is in ascii ...
  93.  
  94.   Screen 1     Screen 2     Screen 3
  95.    .1...        .3...        .1...
  96.    .....        ..2..        ..2..
  97.    ...8.    +   ...1.    =   ...3.
  98.    .1...        ....2        .4..2
  99.  
  100. Note how the values on screen 3 are sequential? We keep a count for
  101. this... The two "2"'s on screen 3 are identical, so we do not use a new
  102. color for it...
  103.  
  104. We also keep to pallettes ... source and dest.
  105.  
  106. For the above example source[1] would be the pallette of 1 in screen 1,
  107. and dest[1] would be the pallette of 3 in screen 2 (Note that screen 1
  108. and screen 2 have different pallettes)
  109.  
  110. When we are finished with the picture, we flip screen 3 to the vga and
  111. do the following : move the pallette from source to dest or vice versa.
  112. Thats it. No fancy screen manipulations for the crossfade, we just
  113. change the pallette. Cool, huh? It also means that you can be doing fun
  114. stuff in the foreground with unused pallette colors without your program
  115. executing at two frames per second ;)
  116.  
  117. The sample program is fully documented, and you shouldn't have a problem
  118. deciphering it... If you ever use this effect in a demo or game, greet
  119. me! :-)
  120.  
  121.  
  122. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  123. ■ Problems with crossfades
  124.  
  125. The main problem with crossfading is this : there may only be 256 colors
  126. on screen 3, in other words, only 256 combinations of colors.  In the
  127. sample program, if you load up two pics with more then 256 combinations,
  128. the program gives an error message and exits to dos. To sort this
  129. problem out, you can do two things : reduce the number of places where
  130. the two pictures intersect, or squeeze down the pallette, using
  131. Autodesk Animators "SQUEEZE" command. This reduces the number of colors
  132. used by the picture, and therefore reduces the number of combinations.
  133. The picture does however lose a bit of quality.
  134.  
  135. The second problem with crossfading is this : It hogs most of the
  136. colors. Whatever you want to do in the foreground, make sure you do it
  137. with as few colors as possible.
  138.  
  139.  
  140. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  141. ■ In closing
  142.  
  143. So, what do you think? Should I continue with demo effects, or should I
  144. find more basic things to do? Perhaps I should stop and just do sound
  145. coding from now on? It is up to you, so leave me mail.
  146.  
  147. You will notice that the sample program can load in any .CEL files, you
  148. needn't be restricted by the ones I have given you. Try crossfading a
  149. few of your own pictures and see how it turns out. The picture of the
  150. robot was draw by Fubar for our demo Psycho Neurosis, and I then
  151. squeezed down the pallette somewhat in order for the crossfade to work.
  152. The word "ASPHYXIA" was drawn by me, also in Autodesk Animator.
  153.  
  154. Oh well, I had better get this off quickly, today is the last time for
  155. the next few days that I can get on to the Net. I will also be voting
  156. tomorrow! If I see a CNN camera, I'll wave (Thats me, the one on the
  157. left in the red shirt! ;-))  The next trainer will be coming from the
  158. New South Africa (TM)
  159.  
  160. See you next time!
  161.  - Denthor
  162.      - 9:16, 26 April, 1994
  163.  
  164. PS. Does anyone in Holland with net access want to act as a courier
  165. between myself and the Accidental Connection BBS? Please leave me mail
  166. at smith9@batis.bis.und.ac.za ....
  167.  
  168. The following are official ASPHYXIA distribution sites :
  169.  
  170. ╔══════════════════════════╦════════════════╦═════╗
  171. ║BBS Name                  ║Telephone No.   ║Open ║
  172. ╠══════════════════════════╬════════════════╬═════╣
  173. ║ASPHYXIA BBS #1           ║+27-31-765-5312 ║ALL  ║
  174. ║ASPHYXIA BBS #2           ║+27-31-765-6293 ║ALL  ║
  175. ║Connectix BBS             ║+27-31-266-9992 ║ALL  ║
  176. ║POP!                      ║+27-12-661-1257 ║ALL  ║
  177. ║Pure Surf BBS             ║+27-31-561-5943 ║A/H  ║
  178. ║Wasted Image              ║407-838-4525    ║ALL  ║
  179. ╚══════════════════════════╩════════════════╩═════╝
  180.  
  181. Leave me mail if you want to become an official Asphyxia BBS
  182. distribution site.
  183.  
  184. (I will find out the country code for Wasted Image later...)
  185.  
  186.