Software ray tracer written from scratch in C that can run on CPU or GPU with emphasis on ease of use and trivial setup

Overview

SlimTracin_logo

A minimalist and platform-agnostic interactive/real-time raytracer.
Strong emphasis on simplicity, ease of use and almost no setup to get started with.

Written in plain C and can be complied in either C or C++.

This project extends SlimEngine.

Optional GPU support using CUDA: The same code is cross-compiled (no CUDA libraries used).

Architecture:

The platform layer only uses operating-system headers (no standard library used).
The application layer itself (non-CUDA) has no dependencies, apart from the standard math header.
It is just a library that the platform layer uses - it has no knowledge of the platform.

More details on this architecture here.

Features:

All features of SlimEngine are available here as well.
Additional features include raytracing facilities:

  • Point lights: Can be moved around and scaled (changing their light intensity)
    1_lights

    1_lights_scene_setup_code 1_lights_update_and_render_code

  • Shapes: Spheres, Boxes, Tetrahedra with UV-based transparency
    2_shapes

    2_shapes_scene_setup_code 2_shapes_update_and_render_code

    2_shapes_uve_transparency 2_shapes_transparency_code

  • Materials: Lambert, Blinn, Phong with controllable shininess
    3_materials_classic_shaders

    3_materials_classic_setup_code 3_materials_classic_update_selection_code

  • Materials: Reflective or Refractive with controllable trace-depth

    4_materials_reflective
    4_materials_refractive

    4_materials_ref_setup_code 4_materials_ref_update_selection_code

  • Materials: Emissive quads can be used as rectangular area lights
    5_materials_emissive

    4_materials_ref_setup_code 4_materials_ref_update_selection_code

  • Meshes: Transformable and can have smooth shading using vertex normal interpolation
    6_meshes

    6_meshes_scene_setup_code 6_meshes_update_and_render_code

  • Render Modes: Beauty, Depth, Normals, UVs and acceleration structures
    7_modes
    Acceleration structures can be overlayed showing how they update dynamically.
    The scene's BVH is re-built any time a primitive is moved or transformed.
    The screen space bounds (SSB) also update when the camera changes.
    7_modes_as

    7_modes_setup_code 7_modes_update_code

  • XPU Modes: CPU vs. GPU (CUDA)
    8_XPU
    8_GPU
    Compiling using CUDA allows for toggling between rendering on the CPU or the GPU.
    8_XPU_code

SlimTracin does not come with any GUI functionality at this point.
Some example apps have an optional HUD (heads up display) that shows additional information.
It can be toggled on or off using thetab key.

All examples are interactive using SlimEngine's facilities having 2 interaction modes:

  1. FPS navigation (WASD + mouse look + zooming)
  2. DCC application (default)

Double clicking the left mouse button anywhere within the window toggles between these 2 modes.

Entering FPS mode captures the mouse movement for the window and hides the cursor.
Navigation is then as in a typical first-person game (plus lateral movement and zooming):

Move the mouse to freely look around (even if the cursor would leave the window border)
Scroll the mouse wheel to zoom in and out (changes the field of view of the perspective)
Hold W to move forward
Hold S to move backward
Hold A to move left
Hold D to move right
Hold R to move up
Hold F to move down

Exit this mode by double clicking the left mouse button.

The default interaction mode is similar to a typical DCC application (i.e: Maya):
The mouse is not captured to the window and the cursor is visible.
Holding the right mouse button and dragging the mouse orbits the camera around a target.
Holding the middle mouse button and dragging the mouse pans the camera (left, right, up and down).
Scrolling the mouse wheel dollys the camera forward and backward.

Clicking the left mouse button selects an object in the scene that is under the cursor.
Holding the left mouse button while hovering an object and then dragging the mouse,
moves the object parallel to the screen.

Holding alt highlights the currently selecte object by drawing a bounding box around it.
While alt is still held, if the cursor hovers the selected object's bounding box,
mouse interaction transforms the object along the plane of the bounding box that the cursor hovers on:
Holding the left mouse button and dragging the mouse moves the object.
Holding the right mouse button and dragging the mouse rotates the object.
Holding the middle mouse button and dragging the mouse scales the object.
(mouse wheel interaction is disabled while alt is held)

In some examples, further interaction is enabled while holding ctrl or shift
using the mouse wheel as a virtual "slider":
Holding shift and scrolling the mouse wheel cycles the assigned material for the selected object.
Holding ctrl and scrolling the mouse wheel increases or decreases the trace-depth*
(how many times rays are allowed to bounce around between reflective or refractive objects)

Owner
Arnon Marcus
A long time enthusiast of computer graphics and programming. Veteran developer in the VFX industry, working at top studios (most recently at Weta Digital)
Arnon Marcus
A path tracer based on hardware ray tracing

GoldenSun GoldenSun is a GPU path tracer. It uses hardware ray tracing APIs to do the tracing. As an experimental project, there is no release plan, n

Minmin Gong 20 Feb 27, 2022
ReferencePT - Supplemental code accompanying Ray Tracing Gems II, Chapter 14: The Reference Path Tracer

The Reference Path Tracer Code sample This is a supplemental code accompanying Ray Tracing Gems II, Chapter 14: The Reference Path Tracer. Code is bas

Jakub Boksansky 136 May 9, 2022
A Hydra-enabled GPU path tracer that supports MaterialX.

A Hydra-enabled GPU path tracer that supports MaterialX.

Pablo Delgado 132 May 8, 2022
🌞 A physically based monte carlo path tracer written in C++

Physically Based Path Tracer The below 3D model for the Head of Michelangelo's David bust was taken from this link. Other .obj files taken from The St

Aman Shenoy 34 May 4, 2022
Brute force volumetric path tracer written in C++

volpt Brute force volumetric path tracer written in C++. WIP. Features Homogeneous medium Hero wavelength sampling for chromatic absorption/scattering

yumcyawiz 21 Apr 28, 2022
Legion Low Level Rendering Interface provides a graphics API agnostic rendering interface with minimal CPU overhead and low level access to verbose GPU operations.

Legion-LLRI Legion-LLRI, or “Legion Low Level Rendering Interface” is a rendering API that aims to provide a graphics API agnostic approach to graphic

Rythe Interactive 25 Mar 8, 2022
A toy renderer written in C using Vulkan to perform real-time ray tracing research.

This is a toy renderer written in C using Vulkan. It is intentionally minimalist. It has been developed and used for the papers "BRDF Importance Sampl

Christoph Peters 225 May 15, 2022
My implementations of Ray Tracing in One Weekend written in many different languages.

Ray Tracing in Many Languages This repository contains my implementation of the Ray Tracing in One Weekend book written in several different programmi

Joshua Vega 1 Oct 19, 2021
SVG animation from multiple SVGs or single GIF using tracer

svgasm svgasm is a proof-of-concept SVG assembler to generate a self-contained animated SVG file from multiple still SVG files with CSS keyframes anim

Tom Kwok 153 Apr 28, 2022
A realtime Vulkan voxel path tracer.

brickmap-vulkan A realtime Vulkan voxel path tracer. This is a work in progress! This system is a Vulkan/SPIRV implementation of the BrickMap by stijn

brandon reinhart 5 Jan 1, 2022
Source Code for "Ray Tracing Gems: High-Quality and Real-Time Rendering with DXR and Other APIs" by Eric Haines and Tomas Akenine-Möller

Apress Source Code This repository accompanies Ray Tracing Gems: High-Quality and Real-Time Rendering with DXR and Other APIs by Eric Haines and Tomas

Apress 781 May 13, 2022
This repository accompanies Ray Tracing Gems II: Next Generation Rendering with DXR, Vulkan, and OptiX

Apress Source Code This repository accompanies Ray Tracing Gems II: Next Generation Rendering with DXR, Vulkan, and OptiX by Adam Marrs, Peter Shirley

Apress 625 May 10, 2022
Implementation of Peter Shirley's Ray Tracing In One Weekend book using Vulkan and NVIDIA's RTX extension.

Ray Tracing In Vulkan My implementation of Peter Shirley's Ray Tracing in One Weekend books using Vulkan and NVIDIA's RTX extension (formerly VK_NV_ra

Tanguy Fautre 742 May 15, 2022
nsfminer is an Ethash GPU mining application: with nsfminer you can mine every coin which relies on an Ethash Proof of Work.

nsfminer (no stinkin' fees) Ethereum (ethash) miner with OpenCL, CUDA and stratum support nsfminer is an Ethash GPU mining application: with nsfminer

Jean M. Cyr 508 May 11, 2022
Implementation of light baking system for ray tracing based on Activision's UberBake

Vulkan Light Bakery MSU Graphics Group Student's Diploma Project Treefonov Andrey [GitHub] [LinkedIn] EARLY STAGES OF DEVELOPMENT Project Goal The goa

Andrei Treefonov 4 Apr 25, 2022
Getting Started with RTX Ray Tracing

Getting Started with RTX Ray Tracing This directory contains Chris Wyman's shader tutorials from the GDC 2019 and SIGGRAPH 2018 courses "Introduction

NVIDIA GameWorks 563 May 11, 2022
OpenGL Object Loading can load virtually every 3d.obj file you can find on the internet, without using another object loading library

OpenGL Object Loading can load virtually every 3d.obj file you can find on the internet, without using another object loading library (assimp for example). The program can load Object with 12M+ triangles and more

Phan Sang 1 Jan 25, 2022
PainterEngine is a application/game engine with software renderer,PainterEngine can be transplanted to any platform that supports C

PainterEngine is a application/game engine with software renderer,PainterEngine can be transplanted to any platform that supports C

DBinary 1.3k May 11, 2022
3D engine from scratch (without OpenGL or any other 3D graphics library)

Simple 3d engine based on SFML library. I tried to make this engine powerful and easy to understand.

Vectozavr 20 Apr 6, 2022