All Projects → darksv → ctrt

darksv / ctrt

Licence: other
Compile-Time Ray Tracer in Rust ported from C++

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to ctrt

Python Raytracer
A basic Ray Tracer that exploits numpy arrays and functions to work fast.
Stars: ✭ 204 (+148.78%)
Mutual labels:  raytracing, compile-time
GPU-Pathtracer
GPU Raytracer from scratch in C++/CUDA
Stars: ✭ 326 (+297.56%)
Mutual labels:  raytracer, raytracing
Raytracer.hpp
Simple compile-time raytracer using C++17
Stars: ✭ 529 (+545.12%)
Mutual labels:  raytracing, compile-time
ArtOfIllusion
Art of Illusion modeling and rendering suite - core application and tools
Stars: ✭ 58 (-29.27%)
Mutual labels:  raytracer, raytracing
Photon-v2
A program that takes photographs of a virtual world.
Stars: ✭ 75 (-8.54%)
Mutual labels:  raytracer, raytracing
rust-tracer
Simple Ray tracer written in Rust
Stars: ✭ 14 (-82.93%)
Mutual labels:  raytracer, raytracing
Tracey
A 3d ray tracer in C++ (High School Project)
Stars: ✭ 24 (-70.73%)
Mutual labels:  raytracer, raytracing
Tinyraytracer
A brief computer graphics / rendering course
Stars: ✭ 3,971 (+4742.68%)
Mutual labels:  raytracer, raytracing
Tinykaboom
A brief computer graphics / rendering course
Stars: ✭ 2,077 (+2432.93%)
Mutual labels:  raytracer, raytracing
monte-carlo-ray-tracer
Physically based renderer with Path Tracing and Photon Mapping.
Stars: ✭ 246 (+200%)
Mutual labels:  raytracer, raytracing
C-Raytracer
A CPU raytracer from scratch in C
Stars: ✭ 49 (-40.24%)
Mutual labels:  raytracer, raytracing
DuEngine
An efficient interactive C++ renderer for ShaderToy-alike demos with 2D/3D/CubeMap/Video/Camera/LightField/Volume textures. (Partially used in my I3D 2018 papers)
Stars: ✭ 62 (-24.39%)
Mutual labels:  raytracing
Galaxy
Galaxy is an asynchronous parallel visualization ray tracer for performant rendering in distributed computing environments. Galaxy builds upon Intel OSPRay and Intel Embree, including ray queueing and sending logic inspired by TACC GraviT.
Stars: ✭ 18 (-78.05%)
Mutual labels:  raytracing
pmj-cpp
"Progressive Multi-Jittered Sample Sequences" in C++
Stars: ✭ 34 (-58.54%)
Mutual labels:  raytracing
MinecraftC
A Raytraced Minecraft Classic 0.0.30a port to C
Stars: ✭ 250 (+204.88%)
Mutual labels:  raytracing
gpu-pathtracer
physically based path tracer on gpu
Stars: ✭ 44 (-46.34%)
Mutual labels:  raytracing
Monte-Carlo-Path-Tracer
A realistic Monte Carlo Path Tracer project for CS230 (Virtual Reality and Interactive 3D Graphics Display), ACM Class, SJTU
Stars: ✭ 19 (-76.83%)
Mutual labels:  raytracer
fluctus
An interactive OpenCL wavefront path tracer
Stars: ✭ 55 (-32.93%)
Mutual labels:  raytracing
raytracing in rust
Implementation of raytracing in rust from Peter Shirley's RTIW and RTTNW, Chapter-by-Chapter
Stars: ✭ 29 (-64.63%)
Mutual labels:  raytracing
BuildTimeLogger-for-Xcode
A console app for logging Xcode build times and presenting them in a notification
Stars: ✭ 43 (-47.56%)
Mutual labels:  compile-time

Compile-Time Ray Tracer in Rust

compile time render

Introduction

This in a Rust reimplementation of https://github.com/tcbrindle/raytracer.hpp. It tries to produce a ray traced image entirely at compile-time. This means the final render is stored directly in the binary without performing any computations at run-time.

This implementation extensively exploits const fn nightly features to see what is the current state of compile-time evaluation in Rust.

Current limitations of const fn

I tried to make this implementation close to the original, though, it was not always feasible. C++ version uses templates to make RayTracer class generic over a scene to allow for rendering two types of scenes: statically and dynamically created. The similar applies to a canvas. Unfortunately, it is not possible to use generic bounds to constraint type to have a const implementation of the trait, so I hardcoded type of scene with some code duplication for run-time and compile-time versions.

Another thing is that right now Rust doesn't support const function pointers and closures which are used in the original implementation within object surface property definitions. I have replaced them with trait.

Also, it isn't possible to use for loops to iterate over slices in const context as it requires const implementations of IntoIterator and Iterator traits for slices. A simple workaround is to use while loop with manual indexing.

Performance

It took almost 23 minutes to render above image at compile-time on my machine (Ryzen 7 1700). Peak compiler's memory usage reached 6.6GB. For comparison the run-time version executes in 1.4s on the same machine. It makes compile-time version 1000x slower. I was using rustc 1.45.0-nightly (7f65393b9 2020-05-01).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].