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).
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.
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)
- Shapes: Spheres, Boxes, Tetrahedra with UV-based transparency
- Materials: Lambert, Blinn, Phong with controllable shininess
- Materials: Reflective or Refractive with controllable trace-depth
- Materials: Emissive quads can be used as rectangular area lights
- Meshes: Transformable and can have smooth shading using vertex normal interpolation
- Render Modes: Beauty, Depth, Normals, UVs and acceleration structures
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.
- XPU Modes: CPU vs. GPU (CUDA)
Compiling using CUDA allows for toggling between rendering on the CPU or the GPU.
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 the
All examples are interactive using SlimEngine's facilities having 2 interaction modes:
- FPS navigation (WASD + mouse look + zooming)
- 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):
mouse to freely look around (even if the cursor would leave the window border)
mouse wheel to zoom in and out (changes the field of view of the perspective)
W to move forward
S to move backward
A to move left
D to move right
R to move up
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.
right mouse button and dragging the mouse orbits the camera around a target.
middle mouse button and dragging the mouse pans the camera (left, right, up and down).
mouse wheel dollys the camera forward and backward.
left mouse button selects an object in the scene that is under the cursor.
left mouse button while hovering an object and then dragging the mouse,
moves the object parallel to the screen.
alt highlights the currently selecte object by drawing a bounding box around it.
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:
left mouse button and dragging the mouse moves the object.
right mouse button and dragging the mouse rotates the object.
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
mouse wheel as a virtual "slider":
shift and scrolling the
mouse wheel cycles the assigned material for the selected object.
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)