Hacker News new | ask | show | jobs
by joeld42 4140 days ago
This loops over the triangles and converts them to screen pixels. A ray tracer loops over screen pixels and checks if there are any triangles that overlap it.
1 comments

More or less this. To expand a bit - rasterization converts lines or polygons to pixels via hidden line removal techniques (http://en.wikipedia.org/wiki/Hidden_line_removal) and/or hidden surface techniques (http://en.wikipedia.org/wiki/Hidden_surface_determination) while ray tracing can mean a lot of different things, where most common and basic form is Whitted's ray tracing where final image is a grid of pixels with from each one there is a 'ray' shot towards the scene and checking if there is a collision with the object (polygon) and then turned towards each light source. In normal world, model is that light travels from light source, bounces from objects and comes to the camera - Whitted's algorithm is opposite where rays are shot from camera towards objects (modified by surface properties there) and towards light sources (less computation that way). Modern ray tracers involve Kajiya's equations and other fancy stuff.
Thanks for the explanation. How are multiple hops in light path handled without having the computational complexity go insane?
They aren't.....

Some popular shortcuts include:

- Cut at n hops (with n=4 or n=8 popular choices), defaulting to "ambient" light after that

- Give each material an "ambient" color, so that you don't actually need to trace every pixel back into every light source (just into e.g. spotlights)

- Solve a radiosity equation for the surface colors, and trace rays for textures/reflections.

Complete ray tracing is, indeed, insane - in fact, to get high quality pictures and avoid aliasing, most ray tracers send multiple rays through every picture and average the result.

(too late to edit:) that was supposed to be "multiple rays through every pixel "