Rendering 3D Worlds in C#
summary
A working raycaster written in C# converts a 2D string-array map (hashes = walls) into a 3D view by casting 1024 rays (one per horizontal pixel) and measuring distance to fill vertical columns; it runs from a .NET Core 3.1 console, uses ImageSharp to write bitmaps and a WinForms PictureBox to show a 60fps interactive demo, totals about 200 lines of code, supports simple lighting and floor/ceiling cheats, and successfully reproduces Wolfenstein-style rendering.
AI-written summary · about
chapters (15)
- 0:00Start
- 4:32A MAITER OF PERSPECTIVE
- 28:50RAY CASTING
- 29:45CASTING RAYS
- 30:46MEASURING DISTANCE
- 33:20Height Percentage
- 34:01CONVERTING RAYS TO AN IMAGE
- 35:47WE'RE GONNA NEED A MAP
- 37:22A DATA STRUCTURE FOR OUR RAYS
- 39:45WORKING OUT RAY DIRECTION
- 40:32CAST DIRECTION
- 41:15FOLLOWING OUR RAY
- 43:02WORKING OUT THE NEXT STEP
- 45:50THE CALLING CODE
- 55:54GET THE CODE!
related talks
30mA whirlwind tour of creating an F# version of the classic Wolfenstein 3D
01h 03mIntro to 3D Graphics
01h 01m3D Graphics for Dummies
59mYou can't do that with JavaScript!
34mBuilding a raytracing engine with JavaScript
28mPerspective in 3D
12mRay-tracing and special relativity: Rendering objects near the speed of light!
50mIt's So Shiny! A Pure JavaScript Ray-Tracer
