A simple yet powerful ray tracer implemented in Java. RayDream creates realistic images by simulating the behavior of light rays as they interact with objects in a scene.
- Ray Tracing Basics: Implements fundamental ray tracing algorithms, including object intersection, reflection, refraction, and shading.
- Scene Description: Define scenes by programmatically constructing objects and lights.
- Support for Basic Shapes: Supports rendering of basic geometric shapes such as spheres and boxes.
- Model Support: Supports rendering of models in the wavefront obj format.
- Materials and Textures: Assign materials and textures to objects to add realism to a scene.
- Antialiasing: Reduces aliasing artifacts with built-in sampling techniques.
- Parallel Rendering: Utilizes multi-threading for faster rendering of complex scenes.
- Acceleration Structures: Makes use of bounding volume hierarchies and adaptive supersampling to reduce computation times.
RayDream is designed to be easy to use while still providing flexibility for advanced users. Here's a basic example of a scene in RayDream:
+ camera:
width: 1920
height: 1080
fov: 50
aperture: 20
from: -2 1 1
to: 0 0 -2
up: 0 1 0
;
+ ambient:
color: 1 1 1
brightness: 1
;
+ light: sphere
position: 10 10 10
color: 1 1 1
brightness: 10
radius: 2
;
+ object: sphere
transform:
| translation: 0 0 -2
| rotation: 0 0 0
| scale: 1 1 1
/
radius: 0.5
material: glass
| ambient: 0.1
| ior: 1.5
/
;
+ object: sphere
transform:
| translation: 0 0 -2
| rotation: 0 0 0
| scale: 1 1 1
/
radius: 0.45
material: glass
| ambient: 0.1
| ior: 0.6667
/
;
+ object: sphere
transform:
| translation: -0.5 0 -3
| rotation: 0 0 0
| scale: 1 1 1
/
radius: 0.5
material: reflective
| color: 1 0 0
| ambient: 0.1
| lambertian: 0.6
| specular: 0.6
| exponent: 50
| metalness: 0.2
| ior: 0.617
| k: 2.63
/
;
Contributions to RayDream are welcome! Whether you want to fix bugs, add new features, or improve documentation, your contributions are greatly appreciated. Just fork the repository, make your changes, and submit a pull request.
This project is licensed under the MIT License.
Resources used for this project.
- Raytracing CS148 Stanford
- Koto's Stack Overflow Comment
- Phong Illumination Model Cheat Sheet
- Overview of the Ray-Tracing Rendering Technique
- Ray Tracing in One Weekend
- The Nim Ray Tracer Project - Part 4: Calculating Box Normals
- Fresnel Term Approximation for Metals
- Ray Tracer Challenge: Texture Mapping
- Ray-plane Intersection Princeton Slide
- Scratchapixel: Ray-Tracing: Rendering a Triangle
- Graphics Compendium Raytracing Chapter 34: Transformations
- Jacco's Blog
- The University of Utah CS 6958 Lecture 8
- The University of Utah Advanced Ray Tracing lecture