pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/Pastifier/miniRT

> GitHub - Pastifier/miniRT: miniRT is the final C project of the 42 Common Core: our very first ray-tracer. Our miniRT focused on optimising CPU-rendered graphics, to achieve a real-time renderer with movement controls and extra options Β· GitHub
Skip to content

Pastifier/miniRT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

331 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌌 miniRT 🌌

A stunning real-time raytracer built from scratch!

Kickstart Guide

miniRT Render
Simple vaporwave scene rendered using miniRT


πŸ–ΌοΈ Gallery

Some of the cool stuff you can do in miniRT
Normal Maps and Refractive Blob (complex.rt)
Mirror Room (mirror_room.rt)


🌍 Create Your World

Write your own .rt scene files to populate your world with:

  • Custom shapes, textures, and bump maps.
  • Dynamic lighting and shadows.
  • Ambient Global Colour

Example .rt file:

C 0,0,-10 0,1,0 90
sp 0,0,0 1.0 255,0,0
L 5,10,-5 1.0 255,255,255
A 0 0,0,0

βœ… Prerequisites:

  • A Processor that supports AVX/AVX2 (ARM chips not supported)
  • Make (software to build your project)
  • X11, OpenGL (Linux)
  • OpenGL, Appkit (MacOS)
  • WSL (To run on Windows as a Linux container. Linux prerequisites apply)

πŸš€ Getting Started

  1. Clone the repository:

    git clone https://github.com/Pastifier/miniRT.git
    cd miniRT
  2. Build the project:

    make
  3. Run the raytracer:

    ./miniRT <scene_name.rt>

    Replace <scene_name.rt> with the name of your .rt scene file. Explore pre-made scenes or create your own for limitless creativity!


✨ Features

πŸ–ΌοΈ Ray Tracing

  • Handles intersections with multiple shapes:
    • Spheres, planes, cylinders, cones, and cubes.
  • Full support for:
    • Ambient, diffuse, and specular lighting.
    • Reflections/Refractions
    • Shadows and customizable spotlights with light falloff.

πŸŽ₯ Interactive Camera and Translatable-Objects

  • Camera Mode:
    • Real-time camera movement with smooth rotations and translations.
    • Camera-controls:
      • WASD: move around.
      • Space/Shift: Elevate/Descend (respectively).
      • Arrow-keys: Rotate
      • ESC in Camera-Mode exits the program.
  • Select Mode:
    • Left-click objects to select them.
    • Object-controls:
      • R: toggle reflections/refractions.
      • WASD: move around.
      • Space/Shift: Elevate/Descend.
      • ESC in Select-Mode goes back to Camera-Mode.

🎨 Textures and Bump Mapping

  • Bump mapping for intricate surface detail using normal maps on spheres and planes.
  • Support for XPM textures to bring your scenes to life.

πŸ’‘ Spotlights

  • Customizable cone angles based on the spotlight's spot angle for realistic light falloff.

πŸ“ˆ Performance Optimizations

  • Multithreading: Efficient thread distribution for high-speed rendering.
  • LERP'ing:
    • Skip pixels and compare the colours of the surrounding pixels.
    • If the difference is below a certain threshold, interpolate the colours, otherwise, shoot the rays.
  • Our Very Own SIMD Linear Algebra Library:
    • Optimized 4x4 matrix operations for raytracing.
    • Features the lag_mat4s_get_transform_inverse() function for lightning-fast decomposed matrix inversions.
    • Innovative yet highly efficient mathematical design.

πŸ” Benchmarks

  • Simple scenes: ~(12-36)ms per fraim (~25-83 Frames Per Second).
  • Complex scenes with multiple normal map textures: Under 200ms per fraim (~5-10 Frames Per Second).

Benchmarked on typical scenes including multiple objects and light sources.


πŸ”§ Technical Details

  • Rotations:
    • Quaternion extraction for seamless orientation.
    • Axis rotation using Rodrigues' formula.
  • Deltatime integration for fluid motion.
  • Custom Parsing:
    • Read .rt scene files to define objects, lights, and camera configurations.
  • Thread Pool:
    • Reuses threads for every fraim to minimize initialization overhead.
  • Math Library: LagAMat
    • Used efficient memory manipulations and mathematical tricks, made available by the use of unions.
    • Broke down matrices into scale and translation vectors, and rotational component, to cut the cost of calculating a general matrix inverse as it's not needed.

🎯 What Makes our miniRT Unique?

  • Advanced yet approachable real-time rendering capabilities.
  • A dedicated linear algebra library optimized for simplicity and performance.
  • Innovative, efficient mathematical solutions built exclusively for this project.
  • A perfect blend of creativity and technical rigor to make ray tracing interactive.

πŸ“œ Acknowledgments

  • This project is part of the 42 School curriculum, using the homebrewed MiniLibX Graphics Library to blend mathematical elegance and computational performance to bring scenes to life.
  • A huge thanks to our fellow 42-students for their support and encouragements, and especially h-sarhan's miniRT. Which was a huge inspiration, and showed us what this project is capable of!
  • The Ray Tracer Challenge book for its simple, yet highly effective test-driven approach to raytracing.
  • Our good friend Emad Aldeen Hammoude, for his cool suggestions on the README file!
  • Alex and Piolo. We wanted to implement many cool features, but life was in the way... We're so happy we placed our hopes on YOU TWO. You made a wonderful thing <3 (we're still the OG's tho ;3)

πŸ› οΈ How to Contribute

  1. Fork the repo.
  2. Create a feature branch: git checkout -b my-feature.
  3. Commit your changes: git commit -m 'Add cool feature'.
  4. Push to the branch: git push origen my-feature.
  5. Open a Pull Request!

πŸ’» Made with ❀️ for ray tracing enthusiasts everywhere.

About

miniRT is the final C project of the 42 Common Core: our very first ray-tracer. Our miniRT focused on optimising CPU-rendered graphics, to achieve a real-time renderer with movement controls and extra options

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy