3D Rendering of Cube and Pyramid with Z-Buffer, Shadows and Interactive Controls
Interactive 3D application for geometric object visualization, written in C using X11 library. The project demonstrates fundamental computer graphics principles:
- 3D Transformations (scaling, rotation, translation)
- Projections (perspective, orthographic, isometric)
- Z-Buffering for correct depth rendering
- Shadow Casting using projection method
- Double Buffering for optimization
- macOS (Intel x86_64 and Apple Silicon arm64)
- Linux (x86_64, arm64)
- X11 libraries
- GCC or Clang compiler
- Make utility
make install-deps# Clone repository
git clone https://github.com/su-mt/CG_Project
cd CG_Project
# Build
make
# Build and run
make run
# Get system information
make info
# Clean
make cleanW/S- move up/downA/D- move left/rightZ/X- zoom in/out
Q/E- turn left/right (around Y axis)R/F- tilt up/down (around X axis),/.- roll left/right (around Z axis)
+- increase scale-- decrease scale
P- switch projection type (perspective/orthographic/isometric)Q(Shift+Q) - exit program
- If controls don't work, check your keyboard layout and restart the app.
- Display connection failed: Restart the application
- Ensure XQuartz/X11 server is installed and running
export DISPLAY=:0- Check library installation:
pkg-config --exists x11
Main constants can be changed in file src/include/geometry.h:
#define WIDTH 800 // Window width
#define HEIGHT 600 // Window height
#define FOV 750.0 // Field of view
#define VIEWER_DISTANCE 1000.0 // Distance to viewer
#define DELTA_TRANSLATION 10.0 // Translation step
#define DELTA_ROTATION (M_PI/60.0) // Rotation step