home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine 1996 / ARCHIVE_96.iso / discs / mag_discs / volume_8 / issue_06 / stereoprof / ReadIt
Text File  |  1994-10-30  |  15KB  |  114 lines

  1. Stereogram Professional
  2. =======================
  3.  
  4. ⌐ John Surcombe 1994
  5. --------------------
  6.  
  7. This program creates autostereogram images on any Acorn RISC OS machine with at least 1MB of memory, although 2MB or more is recommended for really quality images.  It is better than its first incarnation because it was specifically written for other people to use.
  8.  
  9. How to do it
  10. ============
  11.  
  12. The program, like its predecessor, takes two sprites.  The first, called the 'slice sprite' also called the background sprite, dictates what the stereogram will looked like when viewed normally.  In the final image it will appear replicated across the image.  It can be of any size and can have 2, 4, 16 or 256 colours.  Palettes will be used but a mask will be ignored and is just a waste of memory.  It must be fairly grainy in appearance all over to work well.  The second, the '3-D sprite' or foreground sprite, dictates the depth of different parts of the image.  It also can be of 2, 4, 16 or 256 colours and of any size, but masks and palettes will be ignored.  The higher the colour number of any point in the sprite, the closer that point will appear in the stereogram.  The logical colour (what the colour's colour is) doesn't actually make any difference to the final sprite at all.
  13.  
  14. To load the sprites in, click select on load from the main menu.  This will catalogue the contents of adfs drive 0 by default.  In the catalogue, directories are shown in blue and files in pink.  Selecting a directory catalogues it, and selecting a file will attempt to load that file as a sprite.
  15. N.B.  The file's type is not checked to see if it is a sprite.  The file is simply passed to the sprite handler and if it is not a sprite it will probably report the error 'Bad sprite file'.  Very occasionally, however, the sprite handler will crash the machine.  Try not to miss the sprite accidentally.
  16. In order to go back up the directory tree, simply click on the 'Parent' thingy in the top left hand corner.
  17. To change filing system or drive, click on the current pathname (in yellow), and input the new one.  The pathname of the directory you want is shown on the title bar of the directory viewer on the desktop.
  18. Loading a sprite will put it on screen, scaled to a suitable size.  Press select or the escape key to get back to the load menu.  If you get the error 'Not enough memory to change to this screen mode', then return to the desktop and increase the free slot of the task manager to around 160k (if you have a low resolution monitor) or 300k (if you have a high resolution monitor).  Then try again.  To exit from the load screen, press the escape key.
  19. Once you have loaded a sprite, you can view it.  The sprites are not stored in memory, just their pathname, so you will need to have the disc containing the sprites in all the time.  Select the view option on the main menu and click on the icon for the sprite you want to view.  The sprite will be loaded off the disc and put on the screen in the centre, at a scale factor 1:1.  You can zoom in or out using select or adjust, and move the sprite around with the mouse.  Pressing a number from 1 to 5 will scale the sprite up to that factor.  When you have finished browsing over the sprite, clicking menu or pressing escape will let you return to the main menu.
  20.  
  21.  
  22. Creating a stereogram
  23. =====================
  24.  
  25. Now you have loaded the sprites, you can create a stereogram.  Click on 'GO' from the main menu to get to the rather comprehensive options screen.
  26.  
  27. A little bit about how it works
  28. -------------------------------
  29.  
  30. This program was written so that it would be enough for those seriously interested in producing stereograms as well as those who aren't so serious but would like to have a go.  Those who are serious need to read this carefully, everyone else can just skim over it.
  31.  
  32. 3D is perceived by the brain in three ways.  The first is simple.  Close objects look bigger so if two objects which are probably the same size in reality look different sizes, we assume the closer one is the one that is bigger.  The second is a more conscious thought process.  When you look at an object, more distant ones and closer ones look blurred, so if one object is clear and one blurred, we assume they are at different distances.  This is used a lot in TV and film.  The third is the one stimulated by stereograms.  When you are focused on something, both eyes are looking straight at it.  Because your eyes are not in the same place, they are not looking exactly in the same direction, but are directed slightly towards each other.  The closer the object, the more crossed they become, and the more exciting your life becomes in general terms.  The brain knows simply from experience how far away to expect something to be for a certain degree of cross-eyedness.  So when you reach out to wipe some biscuit crumbs from the mouth of a small furry character from the land of Bongabonga, you don't miss completely or punch him in the face by accident.
  33. When two identical pictures are placed next to each other, you can cross your eyes so that the two images fuse into one in the centre.  It will appear:
  34.   Closer, because your eyes are crossed more and
  35.   Smaller, because your brain thinks if it's closer, but still looks the same size, it must have become smaller
  36. If you diverge your eyes it will appear:
  37.   Further away, because you eyes are crossed less and
  38.   Bigger, because your brain thinks if it's further away, but still looks the same size, it must have become bigger
  39. If you have your eyes crossed and you move the pictures further apart from each other, they will look closer and smaller still.  There is a limit to how much you can cross your eyes,  and to cross them too much is supposedly bad for you.
  40. So if corresponding points in two consecutive copies of the slice sprite replicated across the stereogram are further apart, they will appear closer when you cross your eyes, and further away whan you diverge them. Moving corresponding points further apart, however, creates distortions in the slice sprite, which I call 'mush'.  The more distortions there are, the more mush there is.  You can reduce the amount of distortion, but this reduces the apparent depth of the stereogram.  This is the first problem with stereograms.
  41. The second problem is what to put into the gaps.  If the stereogram is just a raised square, then your left eye can see something round the square on the left hand side that your right eye can't see.  The big question is, what should the left eye see there?  Technically it doesn't matter but aesthetically there should be something there which looks consistent with the rest of the picture.  This gap has to be filled with something and there are several options, documented later
  42. The third problem is recurrence and mush be avoided at all costs.  The left or right hand edge of a raised section, depending on the viewing technique, will be copied across the picture to the right at regular intervals.  At these places the picture can actually appear to be at two heights and still be in focus.  Provided there are no other parts of the same height at these points it will be unnoticeable.  But if there must be other stuff there e.g. on a line of text, some technique must be used to reduce the recurrence.  All non-random stereograms suffer from this to a certain extent, but it will not show up if the artist producing it is very careful.  Recurrence can be reduced in many ways:
  43.  
  44.     Using a low-recurrence gap fill method
  45.     Using a low maximum pixel difference value relative to the slice width
  46.     Reducing the complexity of the 3D sprite
  47.  
  48. The background colour is a colour number and should be set to the backgound colour number of the 3-D sprite.  Places in the 3-D sprite of that colour will expierience no distortion, and places outside the 3-D sprite will be this colour.
  49.  
  50.  
  51. The options
  52. -----------
  53.  
  54. Width:  The width in pixels of the output sprite
  55. Height:  The height in pixels of the output sprite
  56. Pixel shape:  The shape of the pixels in the output sprite.  Small squares are 2 x 2 OS units (modes 18,19,20,21), Large squares are 4 x 4 OS units (modes 1,9,13 - 2 colour mode 4 output is not supported for compatibility reasons), Rectangles are 2 x 4 OS units (modes 0,8,12,15)
  57. Slice width:  The width in pixels of the slice sprite.  This is limited to about 5000 because of the limited size of a lookup table used in the algorithm.  Anything more than about 1000 pixels would be silly anyway
  58. 3D sprite width:  The width in pixels of the 3D sprite
  59. 3D sprite height:  The height in pixels of the 3D sprite
  60. Background colour:  The background colour number of the 3D sprite
  61. Maximum offset:  The difference in distortion (in pixels) between the closest and the furthest possible points
  62. Viewing technique:  The technique (cross-eyed or parallel i.e. diverging) required to view the stereogram
  63. Gap fill method:  What to put in the gaps (mentioned above):-
  64.     Forwards - gap is filled with a section of the slice which looks consistent with the picture; lowest mush factor, high recurrence
  65.     Forwards offset - gap is filled with an unaltered section of the slice but from a different part of the slice; low mush factor, medium recurrence
  66.     Reversed - gap is filled with a section of the slice which is flipped about the y-axis and looks consistent with the picture; medium mush factor, medium recurrence
  67.     Reversed offset - gap is filled with a section of the slice which is flipped about the y-axis and from a different part of the slice; high mush factor, low recurrence
  68.     Random - gap is filled from random points from the same row of the slice; v high mush factor, v low recurrence
  69.  
  70. Clicking on the best option next to each one will set it to what the computer thinks is the best setting.  The computer and the program are both stupid and will assume:
  71.  
  72.     You want the slice file to be at the same size and shape you created it in paint
  73.     You want the 3D sprite to be at the same proportions it was created in
  74.     You want the 3D sprite to fill the available space
  75.     The background colour is half the number of colours minus one (i.e. 0, 1, 7 and 127 for 2, 4, 16, and 256 colour modes)
  76.  
  77. The viewing technique and gap fill method are a matter of personal preference
  78.  
  79. Clicking the 'Set all to my idea of the best settings' thingy will set all to the computer's idea of the best settings, following the criteria above.
  80.  
  81. The size of the output must be at least as big as the slice sprite width + the 3D sprite width because of wastage at the left and right.  If the 3D sprite does not fill all the available space it will be centred and the surrounding area fill be set to the background colour
  82.  
  83. Clicking on the 'GO!' thingy will start the procedure.  It is slow and can be stopped at any time by pressing escape, but the operation cannot be resumed again.
  84.  
  85. Once all this is done you must save the output.  This is your only chance to do so because the sprite must be erased from memory due to some rather 'volatile' programming.  It works in a similar way to the load wotsit except clicking on the 'save' thingy lets you type in the name to save it under in the currently catalogued directory.  Note that files do not show up here for no very good reason.  You cannot exit from this until you have saved the stereogram.
  86.  
  87. When you return to the main menu you can now view the stereogram in the same way as the 3D and slice sprites.  Clicking on the quit icon returns you straight to the desktop, as will pressing escape.
  88.  
  89. There are problems with smooth gradients in 256 colour modes.  These can be overcome by creating the slice sprite in a large pixel mode, and then producing the output in a rectangle pixel mode, but the gap fill method must be on forwards or reversed, and the levels on the gradients must be 1 colour apart.  I appreciate that it is very difficult to create gradients with Paint or any other graphics package, but I hope that someone brings out a 3D package that can save a sprite which will work with this program.  Apart from what I have read in the one book on the subject I own called 'Stereograms', I am completely ignorant about the algorithms, terminology or anything else connected with stereograms.  Almost all of this is my own work, and is what I assume to be standard.
  90.  
  91. Do not call either of the sprites 'dsstereog'94'.
  92.  
  93. Thanks to:
  94. ----------
  95.  
  96. Mike Harrison for his BASIC crunch program, which almost lost me two week's work (through my misuse)
  97. Edward Broughton for the reason to write it, which seemed to disappear highly mysteriously after I'd finished it
  98. The small furry creature from the land of Bongabonga, for being my friend
  99. My family, for not trying to help me
  100. Douglas Adams, for writing Dirk Gently's Holistic Detective Agency, which I don't own
  101. Channel 4 Teletext's Digitiser mag, for being slightly interesting (ocassionally), especially the two people who have written in saying they own RISC PC's, trying to get some attention and valiantly failing
  102.  
  103. That's the problem with the RISC PC.  It provokes no attention because the only attention Acorn ever gets is through criticism by Mac, PC, Atari and even Amiga owners.  Since the RISC PC is so good it doesn't get any criticism or attention, no one buys it to see what all the fuss is about because there isn't any fuss about and the Acorn World is not a good and happy place. C'est la vie.
  104. At least with the Archimedes everyone said they were rubbish and people bought them because of the attention.  Realising they were in fact good all the Acorn users club together and slag off other formats etc. blah blah...
  105.  
  106. Forseeable problems
  107. ===================
  108.  
  109. Be careful in the save area not to upset the program too much or it will return you to the desktop with your work unsaved.  I cannot put in wotsits to handle errors such as 'Access violation' or 'Solid state memory device No. 48288 has a jaffa cake crumb lodged in between diode NR222 and the capacitor with the red thingummy next to it.  Contact your nearest Obscuracom dealer for a squeejy mop to clear it up with' unless I know their error numbers and I don't.
  110.  
  111. It is slow.  It is cumbersomely slow.  Even on a RISC PC a really good stereogram takes half an hour.  SO a machine code implementation (even if it's just a compiled one with ABC or RISC BASIC) would be really great.  I wouldn't mind if you used my algorithm to create a machine code program and then go off and sell it and become a zillionaire, as long as I got a copy.
  112.  
  113. Printing stereograms requires a really good printer.  A dot-matrix will definitely not do, an inkjet or bubblejet is OK but a laser printer is recommended.  I have used a (rather old) Panasonic KX-P1124 and it is pretty terrible even for monochrome images.  I have access to a Calligraph crystal jet laser thingy which comes out fine in monochrome, but colour stereograms do not come out at all well on a black and white printer.  Use !ChangeFSI with dithering disabled to put it into black and white and you'll be OK.  Brightening or darkening the picture helps if it comes out all black or all white.
  114.