Dejitaru Karesansui: Digital Zen Garden
Cal Poly CSC 471 Spring 2007 Final Project
Jennifer Pawlik
Last updated: Mar 16, 2007

Questions? Comments? Email: kenning.raven AT gmail DOT com


Download the program:
ZenGarden.zip


Overview

A zen garden (also called zen niwa, karesansui, or Japanese rock garden) consists of a shallow box enclosed on all sides, containing rocks and (generally pale-colored) sand. Plants and water are sometimes included by gardeners, but for the most part are a deviation from tradition.

This program consists of two distinct parts: drawing and display. When the user starts the program, a screen with a white field (representing the sandbox) appears. Two rocks (textured spheres) are available and the user places them with a click of the mouse on a spot in the sandbox. Finally, a rake mode is available, allowing the user to rake patterns in the sand with a one-, three-, or five-tine rake by clicking and dragging the mouse.


Instructions

When the program starts, it creates a white "sandbox" window and a command line window. The use accesses the menu by right-clicking anywhere on the sandbox. The program recognizes the following keyboard and menu options.


Keyboard Actions:

q - quit
h - display help in command window
i - switch between draw and display mode
z - toggle textures and wireframe in display mode
a - rotate left when in display mode
d - rotate right when in display mode
w - pitch up when in display mode
s - pitch down when in display mode
e - move camera forward when in display mode
c - move camera back when in display mode
1 - cycle through textures for large rock
2 - cycle through textures for small rock
3 - cycle through backgrounds in display mode
Menu Actions:
  • Rakes
    • One-Tine - use one-tine rake (draw mode only)
    • Three-Tine - use three-tine rake (draw mode only)
    • Five-Tine - use five-tine rake (draw mode only)
  • Rocks
    • Place Small Rock - set position of large rock (draw mode only)
    • Place Large Rock - set position of small rock (draw mode only)
  • Sand Types
    • Use Light Sand - change sand texture to light (display mode only)
    • Use Dark Sand - change sand texture to dark (display mode only)
  • Reset Sandbox - erase everything from sandbox (draw mode only)
  • Quit - quit the program


Known Bugs

When the user right-clicks to select the menu in draw mode, he or she must choose an option before continuing drawing. If the user does not make a selection, the program draws a straight line from the last spot that experienced a left mouse-down to the spot where the user left-clicks to begin drawing again. If no spot has previously experienced a left mouse-down, then the line is drawn starting at the bottom left corner of the window.


Constraints
  • Camera angle with the sandbox is limited to a range of 50 degrees to 20 degrees.
  • Camera height above the sandbox is limited so that the camera does not pass through the sand or into a rock.
  • Camera distance from the center of the sandbox is limited.
  • If the user places a rock so that its radius overlaps the other rock's radius, an error message is printed and the rock is not placed (collision detection).
  • Window is not resizable in either mode.


Screenshots


In drawing mode.


In display mode with a background selected.


In display mode with no background and the sand and rocks modeled as wireframes.


Conclusions and Future Work

In my time working on this project, I was able to practice a lot of what I learned in this class and I was also able to learn a lot of new things. In the future, there are a few small things I think I'd like to implement. One might be different rake tine sizes. Also, as of now, the program window is not resizable for several reasons, and I think that, in the future, I might like to add this functionality. Finally, I think a good addition to this project would be an eraser tool, but I couldn't quite implement it this quarter.


References

Texture and Colour
OpenGL 2.1 Reference Pages
NeHe Productions
OpenGL Programming Guide - The Red Book
OpenGL: A Primer (Second Edition) by Edward Angel