JavaReflect is a 3D interactive ray tracing engine built entirely from scratch in Java. It features realistic rendering, user interaction, procedural scenes, object dragging, and multithreaded performance β all in a single powerful, extensible codebase.
JavaReflect simulates the physics of light using pure ray tracing principles in a self-built 3D environment. From photon-like rays bouncing off complex surfaces to drag-and-drop interaction and full camera control, this engine showcases the power of modern Java in graphical computing.
With over 5,000 lines of handwritten code, no third-party engines, and real-time interaction, this is more than a ray tracer β itβs a learning tool, a sandbox, and a platform for 3D innovation.
- β Ray tracing from scratch (primary, reflection, shadows planned)
- β Multithreaded rendering loop (fast, scalable)
- β Antialiasing with random sampling
- β Camera with free movement, 360Β° mouse control, zoom, and orientation
- β Ground plane, multiple visible objects, materials, and scene realism
- β Spheres, Planes, Triangles, Boxes, Cones, Cylinders
- β Unified object interface for movement, hit detection, scaling, center & radius manipulation
- β Collision detection support between any shape combinations
- β Mouse selection + dragging (intuitive user interaction)
- β Fully OO design for extensibility
- β
Procedural scene generation with tunable randomness:
- Sphere count, radius, position, fuzziness, materials, etc.
- β Reflective ground support
- β Reusable scene loaders
- β Clean camera injection into render pipeline
- β AWT-based Java window
- β Keyboard + Mouse control
- β Realtime interaction and live rendering updates
- β Scene redraw on interaction or camera shift
- β Camera & object debug information printing
- Java 17+ (developed on OpenJDK 23)
- No external libraries required
- Optional: IDE (e.g. IntelliJ IDEA, Eclipse)
# Compile
javac -d out src/**/*.java
# Run
java -cp out
- β Basic ray tracing (spheres, planes) Done
- β Camera control with mouse + keyboard Done
- β Interactive object dragging Done
- β Material-based shading Done
- β Scene procedural randomization Done
- β Multithreaded rendering Done
- β³ BVH acceleration Upcoming
- β³ glTF 3D model support Upcoming
- β³ Soft shadows & GI Planned
- β³ Texture mapping Planned
- β³ GUI-based scene editor Planned
- β³ Real-time animation support Planned
We welcome contributions from developers, passionate about graphics, Java, or real-time engines.
- Fork the repository
- Create a new branch: git checkout -b feature/my-feature
- Make your changes
- Commit and push: git commit -m "Added my feature" then git push origin
- π Areas You Can Help
- π Refactor for cleaner OOP
- πΌ Add new shape types or lighting models
- π Improve rendering performance (BVH, KD-Tree, SIMD)
- π¨ Build a JavaFX UI wrapper
- π¦ Export/import scenes
- π Write tutorials or docs
- π New? Start from Window.java
MIT License β use freely, modify, contribute, and credit.
Developed by Aryan Batra Contact: batraaryan03@gmail.com Feel free to reach out for collaboration, internships, or tech discussions!
If you found JavaReflect useful or inspiring, consider starring β the project and sharing it! Letβs grow this into the best open-source ray tracer written in Java!