aryanbatras / JavaReflect-3D-Engine

3D Interactive Ray Tracing Engine Built In Java From Scratch

Repository from Github https://github.comaryanbatras/JavaReflect-3D-EngineRepository from Github https://github.comaryanbatras/JavaReflect-3D-Engine

🌟 JavaReflect β€” 3D Interactive Ray Tracing Engine

JavaReflect Banner

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.


πŸš€ Overview

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.


🎯 Features

πŸ”· Core Engine

  • βœ… 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

πŸ”· Object System

  • βœ… 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

πŸ”· Scene & World

  • βœ… 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

πŸ”· Interface & Interaction

  • βœ… 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

🌐 Screenshots

🎯 Highlight

Selected

πŸŒ€ Mirror Reflections

Mirror Scene

βš™οΈ Interactive Drag & Drop

Dragging Objects


πŸ’» Getting Started

πŸ› οΈ Requirements

  • Java 17+ (developed on OpenJDK 23)
  • No external libraries required
  • Optional: IDE (e.g. IntelliJ IDEA, Eclipse)

▢️ Run the Engine

# Compile
javac -d out src/**/*.java

# Run
java -cp out

πŸ›£οΈ Roadmap

Feature Status

  • βœ… 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

🀝 Contributing

We welcome contributions from developers, passionate about graphics, Java, or real-time engines.

🧾 How to Contribute

  • 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

Open a Pull Request πŸš€

  • πŸ“Œ 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

πŸ“œ License

MIT License β€” use freely, modify, contribute, and credit.

✍️ Author

Developed by Aryan Batra Contact: batraaryan03@gmail.com Feel free to reach out for collaboration, internships, or tech discussions!

⭐ Star & Share

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!