home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
In'side Shareware 1994/1995 January
/
ish194-95.iso
/
stereo
/
enc
/
enc.txt
< prev
next >
Wrap
Text File
|
1994-02-10
|
10KB
|
269 lines
Disclaimer.
This software was written in MicroSoft Visual Basic version 3.0.
The Author takes no responsibility for its use, or any
resultant damage to data, or computers on which it is used,
or for that matter on the eyes and minds of those people who
chose to stare at such things.
Introduction.
The Emperor's New Clothes.
One Upon A Time while walking in a shopping mall a man saw a
crowd of people. He rushed over to see what was happening
and found everybody staring at these funny pictures made up
of dots. The salesman said "Just keep looking and you will
see a wonderful picture appear". Suffice to say the man
couldn't see the picture but played along so as not to look
dumb.
This was my introduction to the art of 'SIRDS', after some
time and staring I found I could see the pictures, and yes
they were interesting, but how were they made? This program
is the result of my attempts to find out.
Overview.
This program runs under Windows 3.1 and will accept picture
files in several formats (BMP,DIB,WMF,RLE,ICO) and translate
them into random ( or otherwise) dot stereogram images. These
images can then be looked at on the screen, printed out, or saved
as bitmap (BMP) files. The normal windows copy and paste is also
supported.
Version History.
Version 1.0 Released into the Public Domain by the Author
Paul McMahon October 1993.
(CIS 72050,426)
Basic functionality, random patterns, and one algorithm only.
Version 1.1 Released November 1993
Added simple user defined pattern ability, and an alternate algorithm.
Version 2.0 Released February 1994
Calculations rewritten as DLL for much improved speed.
Improved user defined pattern setup.
Number of depth levels now configurable,
(practical limitations of 16 or
256 will apply depending on drivers etc.)
Random colour palette now fully configurable.
Ability to save colour vs levels, and random palettes
for later recall.
Three new algorithms ( Thanks to RDSGEN )
Form width limitation expanded
from approx < 600 to < 1500 pixels.
Installation.
Required files:
ENC.EXE (The main windows program )
ENC.TXT (This help file.)
ENC.INI (The initialisation file for ENC)
The above three files should be placed in the same directory,
but it doesn't matter what or where it is.
ENCDLL.DLL (The bit that does the hard work. Should be placed
in your windows directory.)
CMDIALOG.VBX ( Should be placed in your windows/system directory)
VBRUN300.DLL ( This is not normally supplied due to its size
and the fact that it is readily available on
most BBS's, if not already on your machine.)
Optional Files:
*.CVL ( saved colour vs level files)
*.PAL ( saved random colour palettes)
There may also be a couple of example input files.
In addition you will need some sort of drawing package such as
Windows Paintbrush, to create the base pictures to be translated.
Producing a RDS.
1. Draw/Load the source.
Once the files are installed as above. A drawing is done, say in
Paintbrush, with different colours representing the different
levels or planes of depth. Which colour is which level etc.
is configurable, but be careful of limitations of your screen
drivers etc. What you might think is a different colour may
actually be a "dithered" one made up of some other colours. If
this is the case ENC will probably not produce the output you
expected. If in doubt stick with solid colours. Once a drawing
is done it can be got into the ENC main screen via the File/Open
dialogue (BMP,DIB,WMF,RLE,ICO formats), or via the standard windows
cut and paste. The main ENC window can be resized to suit the
required final image size. Note. if a non bitmap image is used then
it will resize to fit the form, a bitmap will stay the same size.
2. Set the Colour vs Levels.
The colours vs levels currently used can be seen via the options
form. You can set these colours before you draw your source image,
or it is sometimes more convenient to set them after.
Colours for each level can be configured in a number of ways:
(If the number of levels is not right you can add or delete to the
bottom of the list.)
i.
Select Options/General.
Click on Set Colours Vs Levels.
Click on the colour/level you wish to set.
Click the set button.
ii.
Select Options/General.
Click on Set Colours Vs Levels
Double click on the colour/level you wish to set.
iii. ( I find this the most useful)
Open the picture you wish to translate.
Select Options/General.
Click on the colour/level you wish to set.
Move/drag the options form out of the way.
Double click on the source picture over the colour you wish.
iv.
Select Options/General.
Click on Set Colours Vs Levels
Select File/New.
Select auto greyscale.
Add the required number of levels.
v.
Select Options/General.
Click on Set Colours Vs Levels
Select File/Open.
Select a saved .CVL file.
Once you have a set of colours/levels you like you can save them for
latter retrieval.
3. Select an Algorithm.
Algorithms are selected from the Options/General screen. Currently
five options are available.
i. The original one see below for a description.
ii. This algorithm is basically taken from a story in the 9th.
October issue of New Scientist Mag.
iii,iv,v. These algorithms correspond to the three algorithms
available in RDSGEN by Fred Feucht.
The last three algorithms have a depth of field parameter.
4. Select Random or Pattern.
All RDS's produced by ENC are based on a key strip which is placed
down the left hand side of the image. This key strip can be made
up of either random colour dots, or be a section of a pattern
produced by some other means. The default is random dots with the
default colour palette of black and white. The colour palette, can
be set for any combination of colours. Colours can even be placed
in the palette more than once to vary the probability of there use.
The pattern option if chosen must have a pattern selected,
ie. there is no default pattern. A pattern that I have used that
seems to work well is a plasma field as produced by Fractint.
The pattern selection form is fairly self explanatory. The section
of the base pattern file to be used is selected via a mouse down and
drag over the required area. Alternately the select all button may
be used. If a section is made that is of less height than the RDS
source then the selection will be repeated until it fills the key
strip.
5. Set the Strip Width.
The Options/General screen also contains the strip width parameter.
This value is in pixels and should be set such that it works out to
be of the order of one to two inches, AT THE FINAL RESOLUTION.
ie. if you are going to look at it on a screen which has about 70
pixels per inch across, then the strip width should be about this
value. If you were however to use this value, and printed the result
on something which has say 300 DPI resolution, then it will be pretty
hard to see unless you use an enlarging photocopier on the result,
and blow it up by say a factor of four. Note. If you select a
pattern then ENC will set the strip width equal to the width of
pattern chosen.
All the above can be repeated as desired. Changes made will only
put into effect after OK on the Options/General form is clicked.
6. Translate the Source Picture.
The act of translation can be started once the source picture has been
opened, by selecting the calculate menu option (under the file menu).
This is not a rapid process, (sorry), and it is directly related to
the size of the window, so resize the window to the minimum useable size
prior to beginning calculations.
Note. ENC will translate what ever is in the main window when
calculate is selected, if it contains a previously calculated RDS
then that is what will be translated leading to garbage on the screen.
In version 2 of ENC calculations are much faster, however at present
there is no gentle way of interrupting them once started. The cursor
will go to an hour glass, the key strip will be calculated, and the
main translation will begin, please be patient it will finish
eventually.
Once the translation is finished the result can be saved or printed
using the appropriate menu items under the file menu.
7. View the result.
For on screen viewing I find the technique of turning down the screen
brightness, until you can see your reflection, then slowly turning it
backup works best.
Have fun
Paul McMahon.
(Comments and suggestions to CIS 72050,426 please)
Appendix. How does this all work.
The following is a simplistic description of how the simplest
algorithm (number 1) works.
The basic algorithm used here is as follows:
A picture to be translated is some number of pixel's wide,
say 400, and of immaterial depth.
A width of vertical strip is chosen, which will give a
physical strip to strip separation of around about 1 to 4 cm.
Say for this example it is 50 pixel's wide.
On the first line the first 50 pixel's(from the left) are
randomly chosen ( or via some pattern etc.) , ie the information
in the first 50 pixel's of the picture to be translated is lost.
The value of the 51st pixel is derived based on the level
that it is to appear at. If it is at level 0 then it will
simply be the same as the value now at pixel location 1, if
it is level 1 then it will be the same as that at location
2, and so on.
In general if the level of the pixel to be translated is 'L'
and the value of the nth pixel is pixel(n), and the
separation or strip width is 'W' then:
pixel(n) = pixel(n - (W - L))
for (n-(W-L)) is > W
or
pixel(n) = random
for n-(W-L) is < = W
This works for both positive and negative levels. ie level 0 is the
reference plane, -1 is 1 plane behind this and +1 is 1 plane above it etc.