A random dot stereogram is a two-dimensional pattern which hides a three-dimensional image if you know how to look at it the right way.
Most of a RDS is periodic horizontally, with a period approximately equal to an average person's interocular distance (the distance between one's eyes). When one looks at infinity through the RDS (i.e., both eyes point in the same direction), then the image of one vertical stripe as seen by the left eye coincides with the image of the stripe to the right, as seen by the right eye. Thus, the stripe appears to be at infinity. Shapes are formed in 3D by introducing specific flaws in the periodicity of the pattern.
To generate a RDS: First, create a stripe of random dots the same height as you want the picture to be, and the same width as your interocular distance. Copy the stripe, and put it to the right of the first. To create a flat shape, parallel to the picture, copy an area of the same shape on the right strip and move it left a little bit. That way, when the left eye is looking at infinity on the left strip, the right eye is looking slightly to the left of infinity to make out the shape, so the lines of sight converge somewhere between the poster and infinity. The shape appears to be raised from the background where the eyes converge. To create slopes, or rounded shapes, one can approximate the shape by many 'slices' at different depths, all parallel to the picture. To create larger pictures, copy the rightmost stripe and put it to the right again, and repeat (or, for symmetry, one could alternate between copying the rightmost strip to the right and copying the leftmost strip to the left).
The same effect can be achieved using ASCII art, with ASCII characters instead of dots. Another method uses coloured swirls. In any case, the shapes cannot be made to look very different from the background, neither lighter nor darker, and definitely not a different colour - the only sense one can get of the shapes is their depth.
The above is a description of a far-field RDS, the depth of the image goes from somewhere behind the plane of the picture to infinity. It is also possible to create a near-field RDS, where the image appears to float between the picture and the viewer. Indeed, a far-field RDS can be viewed as a near-field RDS and vice versa, except the depth perception gets reversed (a little like an M.C. Escher print).