What is Ray tracing?

475 views

I hear about it in video games a lot, but I don’t understand it.

In: Technology

3 Answers

Anonymous 0 Comments

Former game developer here,

The traditional means of drawing frames for your display is by projecting the world onto a 2D grid of pixels. It’s quite analogous to the idea of light coming into a camera onto a flat piece of film. Indeed, we often talk about the “camera” as your point of view in the game.

With ray tracing, instead of light coming into the camera and landing on a pixel, it’s light coming out of the pixel, out of the camera, and shining and reflecting all the way back onto the light source. That’s quite literally the computational algorithm – cast a ray, which is just a line through 3D space, until it hits an object in that 3D space, then split and bounce rays from that point of contact outward, again, and again, and again, until all the rays intersect a light source inevitably. Once you do that, you can then sum the light from the source to the effect of every surface it’s touched, all the way back to that one pixel. Each surface is going to change the light, make it a little more of one color or another, include light from another source that’s also shining on that surface and contributing to that pixel…

Now do that for every pixel on your screen. And do that 60-120x per second. If ray tracing sounds computationally expensive, that’s because it is. We try to fake it as much as possible to save our performance budget for other things, but for some effects, there is no substitute.

You are viewing 1 out of 3 answers, click here to view all answers.