The Augmented Reality Sandbox was developed by Oliver Kreylos at UC Davis.
In hopes of giving this awesome software wider exposure and making it easier to consume, System76 packaged this software for Ubuntu-based OSes and wrote this tutorial.
This tutorial focuses on installing and calibrating the software, but wont cover the details of the hardware setup.
For detailed information on the hardware setup, see the AR Sandbox hardware tutorial, but in brief you'll need:
A first generation Kinect
A short-throw digital projector like the BenQ MW632ST
A sandbox for your sand (our sandbox is 40 inches by 30 inches by 8 inches)
Roughly 200 pounds of white sand like Sandtastik White Sandbox Sand
A Linux-friendly computer with a fast NVIDIA GPU, running Pop!_OS or Ubuntu 14.04 or 16.04 (any flavor).
In terms of System76 computers we recommend the Oryx Pro laptop or Wild Dog Pro desktop with the fastest available GPU.
You'll need a computer running Pop!_OS or Ubuntu 14.04 or 16.04.
Add the needed PPA and install the software by opening a terminal and running these three commands:
sudo add-apt-repository -ys ppa:system76-dev/weekend-project
sudo apt-get update
sudo apt-get install arsandbox
whoami
vrui-grp group with this command, replacing USERNAME with the user-name returned by the whoami command above:sudo adduser USERNAME vrui-grp
KinectUtil getCalib 0
This will download the intrinsic calibration parameters directly from your Kinect's firmware and then write the result to a file in /etc/Vrui-3.1/Kinect-2.8/.
RawKinectViewer -compress 0

The image on the left is the depth view, the right is the standard camera view:

The Augmented Reality Sandbox only uses the depth view (left), but the camera view (right) is still helpful in aligning your Kinect.
The depth view needs to cover the entire interior of your sandbox. It's okay if it overlaps it slightly.
Hit Esc to close the RawKinectViewer.
On the other hand, if you've already filed your sandbox with sand, you can calculate the base plane by placing a piece of poster board (or a similar flat surface) on top of your sandbox, which is what we'll do in this example:

RawKinectViewer -compress 0



Start with your cursor near the top-left corner of your flat surface. Press and hold the 1 key, drag out a rectangle toward the bottom-right corner, then release the 1 key:

Hit Esc to close the RawKinectViewer.
In the terminal you'll see two lines printed. Select the portion of the 2nd line shown below, then right click and select Copy:

BoxLayout.txt file by running this command from the terminal:gedit /etc/SARndbox-1.6/BoxLayout.txt
BoxLayout.txt file.You also need edit this line, replacing the "=" (equal sign) with a "," (comma).
You should end up with a first line something like this:

gedit.If you placed a piece of poster board (or another flat surface) on top of your sandbox in the previous step, you'll need to remove it for this step.
RawKinectViewer -compress 0



You'll now measure the 3D extents of the interior of the sandbox
First, move your cursor to the lower-left interior corner, then press the 1 key:
Note there is no feedback from the UI when you press the 1 key.




Hit Esc to exit RawKinectViewer.
In the terminal you'll see four lines printed. You need to highlight these four lines as shown below, then right click and select Copy:

BoxLayout.txt file by running this command from the terminal:gedit /etc/SARndbox-1.6/BoxLayout.txt
BoxLayout.txt with the four lines you just
copied, so you end up with something like this:
gedit.If you haven't already, turn on your projector and plug it into your computer.
If you have a dedicated display in addition to the projector, you'll find it easier if you setup the two displays to be mirrored:


XBackgroud tool from a terminal like this:XBackground

XBackgroud application.As with step 5, this step requires you to have filed your sandbox with sand. You want the sand surface to be as level as possible, but it doesn't need to be perfectly level.
To calibrate your sandbox, you'll need an alignment target and several spacers to help you perform the alignment at multiple heights:

The easiest way to build an alignment target is to create a target cross-hair on a piece of paper and tape it to the top of an old CD or DVD. The cross-hairs should be at right angles to one-another and be centered on the CD or DVD.
A few rolls of tape make great spacers. Note the rolls of tape need to have a diameter smaller than the CD or DVD you're using for the alignment target.
At each height, you'll capture 12 tie-points. For a decent calibration, you'll need to capture tie-points at at least two heights (24 total tie-points). For an optimal calibration, we recommend capturing tie-points at three different heights (36 total tie-points).
CalibrateProjector from a terminal like this:CalibrateProjector -s WIDTH HEIGHT
Replacing WIDTH and HEIGHT with the settings for your projector. The Kinect itself has a 4:3 aspect ratio, so a resolution like 1024x768 or 1600x1200 is best.
To match the resolution of the laptop we used in this tutorial, we set our projector to 1920x1080, but our particular BenQ projector allows us to force a 4:3 aspect ratio even when the resolution is a 16:9 aspect ratio. So in our case, we launched CalibrateProjector like this:
CalibrateProjector -s 1920 1080




After this is completed, you can proceed with the calibration.

Then press the 1 key to capture this tie-point. After a brief moment, the software will automatically move the projected cross-hairs to the next tie-point.
Repeat this process for the remaining 11 tie-points at this depth. Once the white projected cross-hairs are back at their original position, you're ready to switch to a taller spacer.

Then press the 1 key to capture this tie-point. After a brief moment, the software will automatically move the projected cross-hairs to the next tie-point.
Repeat this process for the remaining 11 tie-points at this depth. Once the white projected cross-hairs are back at their original position, you're ready to switch to a larger spacer.

Then press the 1 key to capture this tie-point. After a brief moment, the software will automatically move the projected cross-hairs to the next tie-point.
Repeat this process for the remaining 11 tie-points at this depth. Once the white projected cross-hairs are back at their original position, you're done with the calibration!
CalibrateProjector application.Hitting Esc will automatically write the calibration file in /etc/SARndbox-1.6/ProjectorMatrix.dat.
SARndbox application by searching for "sandbox" in the Ubuntu dash:


On the other hand, if in step 4 you calculated the base plane when your sandbox was empty, the sea level will be too low. Either way, you'll want to adjust the sea level so it's just below the surface of your sand when it's more or less flattened out.
Hit Esc to close the AR Sandbox application.
To adjust the sea level, edit the /etc/SARndbox-1.6/BoxLayout.txt by running this command from the terminal:
gedit /etc/SARndbox-1.6/BoxLayout.txt
The value highlighted below in BoxLayout.txt controls the sea-level:

In our example -106.927 is the smallest value:

So we'll set the sea-level to -107, like this:

Save the file and close gedit.
Re-launch the AR Sandbox application from the Ubuntu dash, maximize the window, and you'll see something like this:

You can experiment with different values for the sea-level to suite your preferences, but our recommendations here will give you a good starting point.
Note that you can adjust the sea level at any time in the future without recalibrating your sandbox.
As long as you don't change the physical setup of your sandbox (in particular, the position of the Kinect, the projector, and the sandbox relative to each other), you never need to calibrate it again. Although now that you have the hang of it, you might want to go through the calibration again in order to achieve a more accurate setup.


This is a shortcut to launch SARndbox with the following arguments (which you can also do directly from a terminal):
SARndbox -uhm -fpv -evr -0.01
The -evr -0.01 bit of the above command sets the evaporation rate. Without any evaporation rate set, the sandbox will steadily fill with more and more water as you "make it rain", which eventually will cause the real-time fluid simulation to become slow.
So you typically want to set an evaporation rate, especially when deploying the Augmented Reality Sandbox in schools or museums.
SARndbox -uhm -fpv -evr -0.005
If our recommended evaporation rate seems too slow for your tastes, try:
SARndbox -uhm -fpv -evr -0.02
Thanks again to Oliver Kreylos for developing such an incredible, inspiring piece of software!
Be sure to check out the Augmented Reality Sandbox website for more details.