Hacker News new | ask | show | jobs
by wk_end 1622 days ago
3D games have basically never used ray tracing. They're starting to, a little bit. Some old 3D games (think Doom-era) used an algorithm called "ray casting", which is similar to ray tracing but much more primitive and much faster - among other simplifications, instead of one ray per pixel, you only have one ray per column.
1 comments

I might be mistaken but I don't think Doom uses ray casting.
Doom’s predecessor Wolfenstein 3D was famous for using ray casting, and the Doom engine inherited ray casting and extended it to handle different floor heights. https://lodev.org/cgtutor/raycasting.html
That's Wolfenstein 3d though. It's been a few years since I last checked Doom's source code but I don't remember seeing anything about raycasting in it. And a quick search leads me to things like [1] which seem to confirm it. But then all the replies to my comment seem sure that it used raycasting, so maybe I'm missing something.

1. https://www.doomworld.com/forum/topic/71128-so-is-doom-a-ray...

Maybe you’re right! I could be wrong, I was only repeating what I’ve heard second hand and read in blog posts. Looking at the code right now, there is a ray casting function called P_CheckSight() that is used for collision and enemy tests, but isn’t part of the core rendering algorithm. Carmack did say “I used the BSP tree for rendering things” but also that the basic rendering concept is “horizontal and vertical lines of constant Z”. It seems entirely possible that this engine is a sort of hybrid of the category we think of “ray casting”, that it’s not exactly what someone assumes when hearing that phrase, but also not entirely different either.
I think it did but only in one dimension to determine wall distance and then faked everything else.
The early Doom 1 and 2 being software renderers, used ray casting (386 protected mode FTW to boot!) The later versions though, were part of the first wave of games to leverage GPU cards. I don't know if those newer releases still kept any ability to render purely in software though.