AtSIRDS -- Creating stereograms with the Atari ST/TT/Falcon =========================================================== )C( Copyleft 8/1994 Christian Perle (Original SIRDS routine by W.A. Steer) INTRO ----- The first time I ever heard of SIRDS (Single Image Random Dot Stereograms), I thought "This is bulls**t, no-one can see them". A friend of mine gave me a black/white print and what I saw was random pixels all over the paper. "You have to look _behind_ the picture to see the image", he said, but I still couldn't see it. A few months later I was clicking around in Mosaic and found some SIRDS pages. "Oh no, not again", I thought, and just for fun I looked at a very chaotic picture. Then I saw it. The 3-D object literally jumped me in the eye. "These things are getting interesting", I thought and immediately searched a few ftp archives for SIRDS maker programs. There were many of them for DOS, a few for Amiga and Unix, and not a single one for Atari. Fortunately, I found a SIRDS FAQ list, with an excellent C source for making high quality SIRDS. I have rewritten the program in GFA basic -- not the best choice, I know -- but added file handling which was not present in the original code. WHAT IS SIRDS/SIS? ------------------ SIRDS are a method to encode depth information in a single image. A random pattern is repeated over each line of the image. When the image is watched "cross-eyed", so that the left eye focuses on a different point than the right eye, shifts in the pattern can create different depths. The distance between the left/right focus point should be exactly the pattern width. In order to see the depth more easily, I have added two "help marks" showing this width at the top of the image. Shift them until you see three marks. On more information how to see SIRDS, read the SIRDS FAQ list. SIS is basically the same as SIRDS, but the pattern is not random. There must be a picture file which is tiled across the image to create the pattern. SIS stereograms are sometimes easier to see. A SIS program is included in this package. IMPORTANT --------- You need to have the GFA basic interpreter 3.x to run the programs listed below. FILES ----- CAR.IMG ready-to-watch SIRDS image (for those who can't wait) ATSIRDS.LST main SIRDS program, writes TGA output file ATSIRDSM.LST SIRDS program, monochrome only version ATSIRDSS.LST SIRDS program, monochrome only, single depth version ATSIS.LST main SIS program, writes TGA output file SIRDS.PI3 single depth data for ATSIRDSS AGATTILE.POV POV-Ray scene for tile picture BOZOTILE.POV POV-Ray scene for tile picture CARTILE.POV POV-Ray scene for tile picture DEPTH1.POV POV-Ray scene for depth data DEPTH2.POV POV-Ray scene for depth data DEPTH3.POV POV-Ray scene for depth data DEPTH4.POV POV-Ray scene for depth data DEPTH5.POV POV-Ray scene for depth data DEPTH1.RED POV-created depth data for SIRDS/SIS DEPTH2.RED POV-created depth data for SIRDS/SIS DEPTH3.RED POV-created depth data for SIRDS/SIS DEPTH4.RED POV-created depth data for SIRDS/SIS BOZOTILE.TGA POV-created tile picture for SIS CARTILE.TGA POV-created tile picture for SIS ATSIRDS.TXT this file GENERATING SIRDS ---------------- You might want to do your first SIRDS now. Depending on the display hardware of your Atari, you should either use ATSIRDS (for color TGA file output) or ATSIRDSM (for monochrome display). Both ATSIRDS and ATSIRDSM read depth data from headerless RED files. More on this file type later. The input and ouput files are selected with the standard Atari file selector. ATSIRDSM just creates two color SIRDS (black and white) and displays the result on the screen. When finished, the SIRDS image can be saved as 32000 byte screen format. ATSIRDS just produces an output file and displays nothing but processing info. The output file is an uncompressed true color TGA, so it's quite big. The number of colors in the TGA is controlled by setting the numcolors% variable in the program. The program will create a grey palette of the specified size. Values for numcolors% range from 2 to 256. Regardless of the actual number of colors, the TGA will always be 24 bit true color, so post processing is needed to reduce the file size. I recommend GEM-View, an excellent shareware program for this task. A very powerful feature of ATSIRDS is the so-called oversampling. Most of the objects in two colors SIRDS appear as parallel planes, so they look sliced in the Z (depth) direction. The only way to get around this is to use more colors and calculate each pixel as two, four or six sub-pixels, giving the pixel the average color of all sub-pixels. The oversampling ratio and the number of colors are related. A rule of thumb is numcolors% >= 2^oversam% so you would use at least 16 colors for an oversampling ratio of 4. Values for oversam% are 1, 2, 4 and 6. The oversampling ratio 1 implies no oversampling. There is another variable dohiddenrem! which enables hidden point removal, if set TRUE. However, the effect is minimal, so save processor time and leave it set to FALSE. The variables xres% and yres% are the resolution of the depth data file. The resulting output file has ten more lines, which contain the "help marks". GENERATING SIS -------------- The program ATSIS is used for this type of stereograms. Depth data is read from a RED file and the tile picture is read from a TGA file. There is no numcolors% because the tile picture is always true color. The variables txr% and tyr% are the resolution of the tile picture. The txr% should always be 96, because this is the pattern width. Using the right tile pictures can create the most beautiful looking stereograms, far better that random dots. The TGA output of ATSIS looks best in true color or dithered to 256 colors. GENERATING SIRDS WITH SINGLE DEPTH ---------------------------------- I have added the program ATSIRDSS for making flat objects from monochrome Degas PI3 files. Black pixels in the Degas file will be floating above the background. The result is displayed on the screen and can be saved as 32000 byte screen format. USING POV-RAY TO CREATE DEPTH DATA ---------------------------------- Most of the input data for SIRDS is created by 3-D rendering programs. ATSIRDS/SIS is suited for using the output of POV-Ray, a superb free raytracer. Both depth data and tile pictures can be created with POV-Ray. To render depth data with POV-Ray, use the parameters: povray +iDEPTH5.POV +oDEPTH5 +w640 +h470 +fr ^^^ raw format, important! This will create three files: DEPTH5.RED, DEPTH5.GRN and DEPTH5.BLU. Because the scene is greyscale, files DEPTH5.GRN and DEPTH5.BLU can be removed (red, green and blue parts contain the same information). Use DEPTH5.RED with ATSIRDS/SIS. For those who are familiar with POV-Ray: All objects in the scene are ambient lighted. There is no light source. The camera looks straight into Z direction. The objects must me placed in a white/black gradient texture in front of the camera. If an object is placed closer to the camera, it gets brighter. If it is placed far, it gets darker. The problem is to fit all objects into one white/black range (remember the gradient repeats). In scene DEPTH5.POV, there are two camera declarations: One for normal view and depth data output, and one from the side for checking if the objects are placed right. USING POV-RAY TO CREATE TILE PICTURES ------------------------------------- To render a tile picture with POV-Ray, use the parameters: povray +iAGATTILE.POV +oAGATTILE.TGA +w96 +h470 +ft That's it. Have fun with ATSIRDS!