home *** CD-ROM | disk | FTP | other *** search
/ In'side Shareware 1994/1995 January / ish194-95.iso / stereo / enc / enc.txt < prev    next >
Text File  |  1994-02-10  |  10KB  |  269 lines

  1. Disclaimer.
  2.  
  3. This software was written in MicroSoft Visual Basic version 3.0.
  4. The Author takes no responsibility for its use, or any
  5. resultant damage to data, or computers on which it is used,
  6. or for that matter on the eyes and minds of those people who
  7. chose to stare at such things.
  8.  
  9. Introduction.
  10. The Emperor's New Clothes.
  11. One Upon A Time while walking in a shopping mall a man saw a
  12. crowd of people. He rushed over to see what was happening
  13. and found everybody staring at these funny pictures made up
  14. of dots. The salesman said "Just keep looking and you will
  15. see a wonderful picture appear". Suffice to say the man
  16. couldn't see the picture but played along so as not to look
  17. dumb.
  18.  
  19. This was my introduction to the art of 'SIRDS', after some
  20. time and staring I found I could see the pictures, and yes
  21. they were interesting, but how were they made? This program
  22. is the result of my attempts to find out.
  23.  
  24.  
  25.  
  26. Overview.
  27.  
  28. This program runs under Windows 3.1 and will accept picture 
  29. files in several formats (BMP,DIB,WMF,RLE,ICO) and translate
  30. them into random ( or otherwise) dot stereogram images. These 
  31. images can then be looked at on the screen, printed out, or saved
  32. as bitmap (BMP) files. The normal windows copy and paste is also 
  33. supported.
  34.  
  35.  
  36.  
  37. Version History.
  38.  
  39. Version 1.0 Released into the Public Domain by the Author
  40. Paul McMahon October 1993.
  41. (CIS 72050,426)
  42.  
  43.     Basic functionality, random patterns, and one algorithm only.
  44.  
  45.  
  46. Version 1.1 Released November 1993
  47.  
  48.     Added simple user defined pattern ability, and an alternate algorithm.
  49.  
  50.  
  51. Version 2.0 Released February 1994
  52.  
  53.     Calculations rewritten as DLL for much improved speed.
  54.     Improved user defined pattern setup.
  55.     Number of depth levels now configurable,
  56.         (practical limitations of 16 or 
  57.         256 will apply depending on drivers etc.)
  58.     Random colour palette now fully configurable.
  59.     Ability to save colour vs levels, and random palettes
  60.         for later recall.
  61.     Three new algorithms ( Thanks to RDSGEN )
  62.     Form width limitation expanded 
  63.         from approx < 600 to < 1500 pixels.
  64.  
  65.  
  66.  
  67. Installation.
  68.  
  69. Required files:
  70. ENC.EXE (The main windows program )
  71. ENC.TXT (This help file.)
  72. ENC.INI (The initialisation file for ENC)
  73. The above three files should be placed in the same directory,
  74. but it doesn't matter what or where it is.
  75.  
  76. ENCDLL.DLL    (The bit that does the hard work. Should be placed
  77.         in your windows directory.)
  78.  
  79. CMDIALOG.VBX  ( Should be placed in your windows/system directory)
  80. VBRUN300.DLL ( This is not normally supplied due to its size
  81.           and the fact that it is readily available on
  82.          most BBS's, if not already on your machine.)
  83.  
  84. Optional Files:
  85. *.CVL ( saved colour vs level files)
  86. *.PAL ( saved random colour palettes)
  87. There may also be a couple of example input files.
  88.  
  89. In addition you will need some sort of drawing package such as
  90. Windows Paintbrush, to create the base pictures to be translated.
  91.  
  92.  
  93.  
  94. Producing a RDS.
  95.  
  96. 1. Draw/Load the source.    
  97. Once the files are installed as above. A drawing is done, say in
  98. Paintbrush, with different colours representing the different
  99. levels or planes of depth. Which colour is which level etc.
  100. is configurable, but be careful of limitations of your screen
  101. drivers etc. What you might think is a different colour may 
  102. actually be a "dithered" one made up of some other colours. If
  103. this is the case ENC will probably not produce the output you
  104. expected. If in doubt stick with solid colours. Once a drawing
  105. is done it can be got into the ENC main screen via the File/Open
  106. dialogue (BMP,DIB,WMF,RLE,ICO formats), or via the standard windows
  107. cut and paste. The main ENC window can be resized to suit the 
  108. required final image size. Note. if a non bitmap image is used then
  109. it will resize to fit the form, a bitmap will stay the same size.
  110.  
  111. 2. Set the Colour vs Levels.
  112. The colours vs levels currently used can be seen via the options
  113. form. You can set these colours before you draw your source image,
  114. or it is sometimes more convenient to set them after.
  115.  
  116. Colours for each level can be configured in a number of ways:
  117. (If the number of levels is not right you can add or delete to the
  118.  bottom of the list.)
  119.  
  120. i.
  121.  Select Options/General.
  122.  Click on Set Colours Vs Levels.
  123.  Click on the colour/level you wish to set. 
  124.  Click the set button.
  125.  
  126. ii.
  127.  Select Options/General.
  128.  Click on Set Colours Vs Levels
  129.  Double click on the colour/level you wish to set.
  130.  
  131. iii. ( I find this the most useful)
  132.  Open the picture you wish to translate.
  133.  Select Options/General.
  134.  Click on the colour/level you wish to set.
  135.  Move/drag the options form out of the way.
  136.  Double click on the source picture over the colour you wish.
  137.  
  138. iv. 
  139.  Select Options/General.
  140.  Click on Set Colours Vs Levels
  141.  Select File/New.
  142.  Select auto greyscale.
  143.  Add the required number of levels.
  144.  
  145. v.
  146.  Select Options/General.
  147.  Click on Set Colours Vs Levels
  148.  Select File/Open.
  149.  Select a saved .CVL file.
  150.  
  151.  
  152. Once you have a set of colours/levels you like you can save them for
  153. latter retrieval.
  154.  
  155. 3. Select an Algorithm.
  156. Algorithms are selected from the Options/General screen. Currently
  157. five options are available.
  158. i. The original one see below for a description.
  159. ii. This algorithm is basically taken from a story in the 9th.
  160.      October issue of New Scientist Mag.
  161. iii,iv,v. These algorithms correspond to the three algorithms
  162.     available in RDSGEN by Fred Feucht.
  163. The last three algorithms have a depth of field parameter.
  164.  
  165. 4. Select Random or Pattern.
  166. All RDS's produced by ENC are based on a key strip which is placed
  167. down the left hand side of the image. This key strip can be made
  168. up of either random colour dots, or be a section of a pattern 
  169. produced by some other means. The default is random dots with the
  170. default colour palette of black and white. The colour palette, can 
  171. be set for any combination of colours. Colours can even be placed 
  172. in the palette more than once to vary the probability of there use.
  173. The pattern option if chosen must have a pattern selected, 
  174. ie. there is no default pattern. A pattern that I have used that
  175. seems to work well is a plasma field as produced by Fractint.
  176. The pattern selection form is fairly self explanatory. The section
  177. of the base pattern file to be used is selected via a mouse down and
  178. drag over the required area. Alternately the select all button may
  179. be used. If a section is made that is of less height than the RDS
  180. source then the selection will be repeated until it fills the key
  181. strip.
  182.  
  183. 5. Set the Strip Width.
  184. The Options/General screen also contains the strip width parameter.
  185. This value is in pixels and should be set such that it works out to
  186. be of the order of one to two inches, AT THE FINAL RESOLUTION. 
  187. ie. if you are going to look at it on a screen which has about 70
  188. pixels per inch across, then the strip width should be about this 
  189. value. If you were however to use this value, and printed the result
  190. on something which has say 300 DPI resolution, then it will be pretty
  191. hard to see unless you use an enlarging photocopier on the result,
  192. and blow it up by say a factor of four. Note. If you select a 
  193. pattern then ENC will set the strip width equal to the width of
  194. pattern chosen.
  195.  
  196.  
  197. All the above can be repeated as desired. Changes made will only
  198. put into effect after OK on the Options/General form is clicked.
  199.  
  200. 6. Translate the Source Picture.
  201. The act of translation can be started once the source picture has been
  202. opened, by selecting the calculate menu option (under the file menu).
  203. This is not a rapid process, (sorry), and it is directly related to
  204. the size of the window, so resize the window to the minimum useable size
  205. prior to beginning calculations. 
  206. Note. ENC will translate what ever is in the main window when
  207. calculate is selected, if it contains a previously calculated RDS
  208. then that is what will be translated leading to garbage on the screen. 
  209.  
  210. In version 2 of ENC calculations are much faster, however at present
  211. there is no gentle way of interrupting them once started. The cursor
  212. will go to an hour glass, the key strip will be calculated, and the
  213. main translation will begin, please be patient it will finish
  214. eventually.
  215.  
  216. Once the translation is finished the result can be saved or printed
  217. using the appropriate menu items under the file menu.
  218.  
  219. 7. View the result.
  220. For on screen viewing I find the technique of turning down the screen 
  221. brightness, until you can see your reflection, then slowly turning it
  222. backup works best.
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230. Have fun
  231. Paul McMahon.
  232. (Comments and suggestions to CIS 72050,426 please)
  233.  
  234.  
  235. Appendix. How does this all work.
  236.  
  237. The following is a simplistic description of how the simplest
  238. algorithm (number 1) works.
  239.  
  240. The basic algorithm used here is as follows:
  241. A picture to be translated is some number of pixel's wide,
  242. say 400, and of immaterial depth.
  243. A width of vertical strip is chosen, which will give a
  244. physical strip to strip separation of around about 1 to 4 cm.
  245. Say for this example it is 50 pixel's wide.
  246. On the first line the first 50 pixel's(from the left) are
  247. randomly chosen ( or via some pattern etc.) , ie the information
  248. in the first 50 pixel's of the picture to be translated is lost.
  249. The value of the 51st pixel is derived based on the level
  250. that it is to appear at. If it is at level 0 then it will
  251. simply be the same as the value now at pixel location 1, if
  252. it is level 1 then it will be the same as that at location
  253. 2, and so on.
  254. In general if the level of the pixel to be translated is 'L'
  255. and the value of the nth pixel is pixel(n), and the
  256. separation or strip width is 'W' then:
  257.  
  258. pixel(n) = pixel(n - (W - L))
  259. for (n-(W-L)) is > W
  260.  
  261. or
  262.  
  263. pixel(n) = random
  264. for n-(W-L) is < = W
  265.  
  266. This works for both positive and negative levels. ie level 0 is the
  267. reference plane, -1 is 1 plane behind this and +1 is 1 plane above it etc.
  268.  
  269.