Skip to content

NullandKale/YetAnotherConsoleGameEngine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ray Tracing with Console.Write()

screenshot

A real-time CPU ray tracer that renders to a text console.

I have written this code a few times, and this is probably the most complete it has ever gotten.

On Behest of the reddit comments I implemented a renderer that uses PInvoke to directly write into the terminal memory buffer, and a renderer that uses ANSI color codes.

Example video of the ANSITerminalRenderer providing a MASSIVE speedup, the PInvoke is about the same speed but plays less nicely with the debug text printing.

Higher Quality version here: [Assets/RTConsole.mp4]

Raytracer_720p_small.mp4

You need to change a line in Program.cs to activate it but there is a video reader mode which allows reading cameras and arbitrary video files

2025-08-20.01-50-31.mp4

High Res

Screenshot 2025-08-22 024508

Low Res

Screenshot 2025-08-22 024524

TL;DR

  • Arrow keys: look
  • WASD / Q / E: move (hold Shift to go faster)
  • I / U: next / previous scene
  • Esc: quit

Scenes

Press I/U to cycle. The table is built in RaytraceEntity.BuildSceneTable() and includes:

  • Test/Demo scenes
  • Cornell Box
  • Mirror spheres on a checker plane
  • Cylinders, disks, triangles, and boxes showcase
  • Volume grid test and “minecraft-like” voxel scene
  • Mesh scenes: Bunny, Teapot, Cow, Dragon Each scene provides default camera pose and FOV; switching resets TAA history and rebuilds the BVH.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages