Film Camera Dreams
By Ahnaf Keenan Ardhito→This piece extends the basic ray tracing assignment (A3) with photography-inspired camera effects combined with a serene sakura garden scene. The goal was to create a render that captures the delicate beauty of cherry blossoms in full bloom with the aesthetic character of classic film photography through physically-based depth of field, film grain, warm color grading, and vignetting.
The scene features:
- Cherry Blossom Trees: 13 custom-modeled sakura trees with natural branching structures
- 4 detailed foreground trees with organic branch splits and tapering trunks
- 9 background trees at varying depths for atmospheric perspective
- Natural Branching: Trees built from spheres positioned at varying offsets to create realistic branch splits (not simple stacked circles)
- Vibrant Pink Blossoms: Cherry pink and soft pink materials with carefully tuned color values for authentic sakura appearance
- Fallen Petals: 10 scattered petal spheres on the grass for added detail
- Lush Grass: Ground plane with natural green grass material
- Atmospheric Sky: Soft blue sky backdrop
- Depth Composition: Strategic use of depth of field with foreground trees in gentle focus and background trees creating depth
What Makes This Special
Physically-Based DOF: Unlike simple blur filters, this implements the actual physical behavior of a camera lens with aperture and focus distance.
Photography-First Design: Every effect (grain, vignetting, color grading) is inspired by real film camera characteristics, not arbitrary post-processing.
Custom Procedural Modeling: Sakura trees are hand-crafted from sphere primitives with natural branching patterns, demonstrating that beautiful organic forms can be created without complex meshes.
Stratified Sampling: Uses Monte Carlo integration with multiple samples per pixel for smooth, noise-free DOF even with relatively few samples.
Modular Architecture: Post-processing effects are cleanly separated and can be toggled independently or chained together.
Production-Ready: Parameters are exposed for artistic control, making it easy to create different looks (shallow DOF portrait style, deep focus landscape style, etc.).
Features Added
1. Depth of Field (DOF) with Bokeh ⭐ Primary Feature
- Description: Implements the thin lens camera model to simulate realistic depth of field effects
- Aperture control (simulating f-stop on real cameras)
- Focal distance control (focus plane)
- Concentric disk sampling for uniform lens sampling (src/random_disk_sample.cpp)
- Multiple rays per pixel (32 samples/pixel for quality)
- Natural bokeh (out-of-focus blur) that varies with distance from focal plane
Technical Details:
- Instead of a single ray through the pixel center (pinhole camera), each pixel shoots multiple rays from random points on a circular lens aperture
- All rays converge at the focal plane (objects at focal distance are sharp)
- Objects closer or farther than the focal distance naturally blur based on the circle of confusion
- Uses the Shirley-Chiu concentric mapping algorithm for better lens sample distribution
2. Film Grain
- Description: Adds subtle randomized noise to each pixel to simulate the organic grain structure of analog film
- Per-channel noise for realistic color grain
- Deterministic pseudo-random function based on pixel coordinates (same seed = same grain pattern)
- Intensity: 0.025 (subtle but noticeable)
3. Warm Color Grading
- Description: Applies a vintage warm color tone reminiscent of classic film stocks
- Boosts red/yellow channels slightly
- Reduces blue channel for warmth
- Adds subtle contrast enhancement for that “film look”
- Intensity: 0.3 for gentle warmth
- Inspired by Kodak Portra and Fujifilm color profiles
4. Vignetting
- Description: Simulates natural lens vignetting where image corners darken
- Distance-based radial falloff from center
- Smooth gradient using smoothstep function
- Aspect-ratio aware (circular vignetting in rectangular frame)
- Strength: 0.6 for noticeable but natural effect
- Mimics optical vignetting in real camera lenses
5. Custom Procedural Tree Modeling
- Description: Hand-crafted sakura trees built entirely from sphere primitives with natural branching
- Each foreground tree has 4-7 trunk spheres tapering upward
- Branches split at varying angles and offsets for organic appearance
- 8-12 blossom clusters per tree positioned at branch ends
- Background trees scaled smaller for atmospheric perspective
- Mix of “cherry pink” and “soft pink” materials for color variation
Technical Details:
- Foreground trees positioned at z = -3 to -7
- Background trees positioned at z = -5 to -14 with emphasis on far right
- Trunk spheres: 0.2-0.3 radius, brown bark material
- Blossom spheres: 0.4-0.6 radius, vibrant pink materials
- Branch offsets: ±0.3 to ±1.0 units in x/z for natural spread
6. Carefully Tuned Materials
Cherry Pink Material: Vibrant pink with high reflectance
- ka: [1.0, 0.7, 0.8], kd: [1.0, 0.75, 0.85]
- ks: [0.7, 0.6, 0.6], phong_exponent: 130
- Creates soft, delicate petal appearance with subtle highlights
Lighting Balance: Directional light reduced to [0.7, 0.68, 0.65] to prevent overexposure while maintaining natural outdoor lighting
7. Enhanced Rendering Settings
- Implementation: main.cpp
- Description: High-quality rendering with optimal parameters
- Resolution: 1280x720 (HD)
- Samples per pixel: 32 (smooth depth of field)
- Progress reporting during render
- Monte Carlo sampling with fixed seed for reproducible results
Acknowledgements
Algorithms & Techniques
Concentric Disk Sampling: Shirley, P., & Chiu, K. (2011). “A Low Distortion Map Between Disk and Square” https://psgraphics.blogspot.com/2011/01/improved-code-for-concentric-map.html Used for uniform sampling of the camera aperture lens.
Thin Lens Camera Model: Pharr, M., Jakob, W., & Humphreys, G. (2016). “Physically Based Rendering: From Theory to Implementation” (3rd ed.) Chapter 6: Camera Models Used as reference for depth of field implementation.
Path Tracing Fundamentals: Course materials from CSC317 (Ray Tracing assignment) Base ray tracing infrastructure, Blinn-Phong shading, and reflection.
Libraries
Eigen: C++ template library for linear algebra http://eigen.tuxfamily.org/ Used for vector and matrix operations throughout the ray tracer.
nlohmann/json: JSON for Modern C++ https://github.com/nlohmann/json Used for parsing scene description files.
GLFW: Cross-platform OpenGL library https://www.glfw.org/ Used for the interactive viewer window and input handling.
GLAD: OpenGL loader https://glad.dav1d.de/ Used for loading OpenGL functions in the interactive viewer.
License & Usage
This project is submitted for academic evaluation in CSC317. The base ray tracing code structure is adapted from course materials. All photography-inspired extensions (DOF, film grain, color grading, vignetting) and custom scene modeling are original implementations for this showcase.
