4 ms·
There are two common ways to draw stuff in 3D computer graphics. The most common one in games is "rasterization" which means: "For each object, figure out what
by corysama 8y ago
There are two common ways to draw stuff in 3D computer graphics. The most common one in games is "rasterization" which means: "For each object, figure out what pixels it covers." Movies (and soon games) use a mixture of rasterization and ray tracing. Ray tracing means "For each pixel figure out what objects cover it."
You can do simple ray tracing by looping over each pixel, defining a ray that starts from the viewpoint and passes through the pixel on the screen, then looping over every object in the whole scene to see if and where that ray hits each object. That'll work, but it'll be very slow. Then the fun begins figuring out data structures and algorithms to make that process faster.
The advantage of rasterization is that it can be very fast because it works with small amounts of data at a time that has fairly predicable access patterns and good locality between pixels. But, that's also it's down side. It doesn't work well with information that is not local to a single point on an object (for example, how close are other nearby objects? That's hard for a rasterizer).
The advantage of ray tracing is that it is built from the ground up around querying the entire environment. So, features like shadows, reflections and ambient occlusion become much easier to get to work. That's also it's down side. Querying the environment is difficult to make fast. So, even though the features are easy to write, they are still a challenge to keep under the frame time budget.