MkSIS

documentation
Login

Installation

Installing MkSIS is straightforward using the following procedure:

(Windows does not handle "tar.gz" archives automatically. A highly recommended solution is installing 7-zip. See below.)

Making Stereograms

There are two ways to create SIS images with MkSIS:

<!-- START program usage... --> <style> h2, h3, h4 { margin-bottom: 0.5em; } </style>

Command-line operation

When compiled as described below, the standalone console program, mksis.exe, is by default installed in c/msys64/usr/local/bin (which should be added to the system PATH). If the pre-compiled binaries are installed, copy sis-backend.exe to a location in the system PATH and rename to "mksis.exe".

Invoked with no arguments mksis prints a help message describing the options and values it accepts.

<!-- START command line ops... -->

Mksis.exe command-line:

Accepts tif(f), jpg and png formats for input/output images.

Required arguments:
  • -d path to depthmap file. (Can be absolute or relative, file must exist.)
  • -p path to pattern (texture) file.
  • -o path of output file, where the SIS image will be written

Optional arguments:

    <li><i>-e</i> "Optic (eye) separation" Default: 600. Generally a value of 1/3 to 1/2 of the width of image (in px) is a good starting point. The higher the number, the greater the apparent depth.</li>
    
    <li><i>-n</i> "scale factor" Higher numbers represent closer near point, hence greater depth. Default is 70, range 20-85 </li>
    
    <li><i>-f</i> "distance factor" Higher numbers make 3D effect "flatter", somewhat like telephoto effect in photography. Default is 750. Typically this factor is scaled with arg to -e </li>
    
    <li><i>-r</i> "origin" Refers to place in depthmap where image processing starts. By default this is 1/2 image width. SIS symmetry is adjusted by setting lower or higher number than midpoint. Since the width isn't known ahead of time, the default arg to -r is a negative number which will cause the actual origin to be set as noted.</li>
    
    <li><i>-off</i> "offset" In <i>pattern</i> file normally pixels are taken from the pattern starting at the middle of the pattern image. -off is a positive or negative number (of pixels) moving the center accordingly. Default is 0</li>
    
    <li><i>-ar</i> "artifact reduction" Range is 1 to 4, where 1 disables AR, 4 is maximum AR. Default is 4. Probably no need to us this option except for debugging purposes.</li>
    
    <li><i>-h</i> "Help" Prints usage message</li>
    
    <li><i>-LOG</i> Configures whether log of input parameters is kept. Values are I, noI. "I" directs mksis to keep an "info log" of command-line history. "noI" means info log entries will not be recorded.</li>
    

Note that the inputs to -e, -n, -f are interactive. No simple formula is universally applicable, results depend on image dimensions and to a significant degree on the characteristics of the images used. (Referring to depthmap and pattern.) Therefore the usual workflow involves trying varying combinations of these parameters.

Fortunately, mksis.exe writes the command-line used for each output image to a log file in the user's home directory. (Currently the file is called "test-sis-info.log", on Windows user's home directory is found at c:Users&lt;username>.) Entries are in the form of:

[timestamp] -d <path-to-depthmap> -p <path-to-patfile> -o <path-to-output-file> -e nnn -n nn -f nnn -r nnn* -off +/-n* -ar 4 -LOG I width=n* height=n*

Accordingly, copying the entry (except the timestamp and width/height) enables replicating previous SIS generation with or without modification of the arguments.

<!-- END command-line-ops... -->

Using the GUI

MkSIS GUI is a TclTk application designed to make generating SIS images easier and more productive.

The app accepts input via its various graphic controls, invokes the backend SIS generator (sis-backend.exe) and displays results, that is, the image produced or a message in case of error.

In addition to its basic role the GUI enhances/extends capabilities of the backend generator. These features are discussed in a later section.

How the GUI works...

The installation procedure alludes to a program called "runner.exe" within the MkSIS directory. Runner's job consists of two tasks. The first is setting an environment variable "TCL_LIBRARY=<current_directory>/tcl8.6". The second is calling the wish executable as follows: "wish86s.exe gui_main.tcl".

Ordinarily tclsh and wish load their init files from a directory set at compile time. Trying to call tclsh/wish from a location where the programs can't "see" the init directory prevents them from running. However if TCL_LIBRARY is present in the environment and points to an accessible init directory, tclsh/wish will use this directory and run normally.

When runner.exe (or its shortcut) is clicked the program determines which directory it's in and uses that info to construct the env variable. Within the MkSIS directory there's a complete copy of the Tcl init directory (/tcl8.6). In this way wish runs perfectly well without having TclTk installed on the system at all! (Directory /tk8.6 must also be present in MkSIS for wish to work and of course it is.) <!-- How the GUI works -->

Making a stereogram, step by step:

  • Open MkSIS GUI (click desktop icon)
  • Fill in or browse for location of depthmap file
  • Fill in or browse for location of pattern/texture file
  • Fill in or browse for location of directory to put generated stereograms
  • A file name for the SIS image is automatically constructed from characters at start/end of depthmap, a 2-3 digit random number, characters at start/end of pattern file and a series number. Any part or all of the name can be edited. Use the reset button to reset the series number to "001".

  • Set value for "Separation". The mouse wheel or spinbuttons scroll the value up/down. A good starting point is around 1/4 of the image width in pixels.
  • Set "Depth". If too low 3D effect will look "flat", too high will make it difficult to view. "60" works in many cases.
  • Set "Distance". Try a value equal to Separation, increasing makes 3D look flatter, decreasing increases depth.
  • "Origin" is by default a negative number which means SIS generation starts in the center, at 1/2 image width. Entering a number (>=0) puts the origin at that exact position. For example, the default origin for an image 2000px wide is 1000px. Setting Origin to 900 moves the vertical panels 100px to the left. This effect can be useful when to reduce left-right symmetry.
  • "Offset" refers to the horizontal starting point in pattern file. The default "0" means pixels are taken from pattern image starting at its center. It's frequently desirable to move the start to the left (negative number) or right (positive). The pattern image is "tiled" (repeated) as necessary to fill horizontal/vertical space in the output stereogram.
  • "Artifact reduction" is normally set to 4 and only rarely useful to change this setting (primarily for debugging purposes).

  • "Reopen image" reads entries from the backend log file (see above). The values of a record are put into the GUI fields so the SIS can be generated again. The log file path is the user's home directory, file name is "test-sis-info.log". "Line number" to reopen can be found by opening the log file in an editor that provides line numbering or using a utility like "less". (This interface isn't ideal and will probably be changed in a future version of MkSIS GUI.)

  • The "Exit" button closes the program. Note that on closing the GUI app saves the current settings which will be restored next time app is used.
  • "Restore defaults" resets the spinbutton fields to built-in defaults
  • Clicking "Make stereogram" button invokes the backend SIS generator.

On success the SIS image will be shown in a new window. The window can be dismissed with a button press, or the escape or enter keys. The image size can be increased/decreased with the +/- keys.

Error messages are displayed in the message window area. TclTk errors are shown in their own windows. (Bugs should be reported.) <!-- Making a stereogram -->

<!-- END program usage... -->

Compiling from source

Compile-time dependencies include several msys2 packages:

(Upx is used for compression of generated exe files. If upx isn't available or it's decided not to use it comment out the applicable lines in Makefiles in the backend and runner directories.)

Makefiles are written to work in an msys2 64bit environment under Windows 10. However, programs should be modifiable for other environments without too much difficulty. Unix-like systems won't need a runner utility, simple shell scripts should suffice.

Running "make" in the top-level directory compiles "backend" and "runner" programs, copies executable and other files to MkSIS, and then archives MkSIS as m2.tar.gz. If changes are made to files in the distribution run "make clean-all" before recompiling. Prior to distribution run "make clean-deploy" which removes intermediate files while leaving m2.tar.gz in the top-level directory.

The included wish program (wish86s.exe) is a 64bit statically compiled msys2 Windows application. If a different wish is preferred, required dll files, if any, need to be added to the MkSIS directory and the first line in runner.cfg needs to be edited accordingly. Note that wish86s was compiled with custom icons (provided in the runner directory). The win/rc directory in the tk sources has directions for replacing stock wish/tk icons with the custom icons supplied.

Install 7-zip:

7-zip is a great archive tool for Windows. Free, open-source, it handles many formats including tar.gz and zip. In most cases it's best to get the 64bit (x64) version for Windows. All versions are available here: https://www.7-zip.org/download.html

####Notes on Windows security:####

Tested under real-world conditions the instructions given above successfully installed MkSIS.

However Windows security is complex. A feature called "SmartScreen" (enabled by default) can produce warnings that MkSIS is an "urecognized app", particularly software obtained from the internet. Users are given a choice of clicking a "Don't Run" button or a link labeled "More info". The latter provides a "Run anyway" button. Selecting the "Run anyway" option runs the program and warnings won't come up again.

In Windows settings/Apps & features, selecting "Anywhere" for "Choose where to get apps" should reduce difficulties. Otherwise a number of security settings could influence how apps are handled, users may wish to review and consider changes to the configuration.