difference between ray-casting and ray-tracing

Started by
7 comments, last by Woodchuck 17 years, 3 months ago
What is the difference between ray-casting and ray-tracing?
akira32 編程之家 Yahoohttp://tw.myblog.yahoo.com/akira32-akira32
Advertisement
Fundamentally,

Raycasting involves creating a ray and calculating what it hits (or if it hits a particular thing).

Raytracing involves creating a ray and tracing its path as it reflects/refracts through the scene so that you can determine what light might arrive at its source from the other direction.

Very simple, non-technical explanations... I know. You'll probably get better ones.
here you go:

http://www.permadi.com/tutorial/raycast/rayc2.html#RAY-CASTING%20AND%20RAY-TRACING
That link is good at explaining the difference between raytracing and 2D raycasting of the sort used in the original WOLF3D, but in general raycasting is a different thing from that. The page is right, however, when it says that raycasting is a special case of raytracing. The primary thing which makes raytracing slow is the fact that it is recursive: a particular ray shot out from the eye position through the viewing plane will lead to the recursive propagation of many other rays, in order to determine the illumination of the initially intersected point. In contrast, a raycasting engine stops the first time it hits an object, and uses a standard lighting model to empirically determine incoming llumination. Basically, raycasting is raytracing with no "child rays".
In ray-tracing, the child (or secondary) rays are used to calculate specular reflection, refraction, shadows, and possibly indirect illumination. The lack of secondary rays in a ray-caster means that these features are either not implemented, or are implemented using some other (possibly more inaccurate) algorithm.
I thought it is even simpler:

Ray casting is finding out what a single ray-segment hits. Ray tracing typically requires multiple ray casts per pixel; all the ray segments that are casts together form the path (or better: The tree) that determines the final pixel color.

- Jacco.
And, having written one of the best raytracer tuts on the web (IMHO), Jacco would know. [grin]

But, yeah... that's essentially my take as well.
Quote:Original post by Sneftel
The primary thing which makes raytracing slow is the fact that it is recursive: a particular ray shot out from the eye position through the viewing plane will lead to the recursive propagation of many other rays

It doesn't have to be slow or recursive.
Fact is that you may end up with a ray tree if, for example, you allow for reflection & refraction to happen at the same point, which will lead to bottom ray tree explosion. Then recursion is the simplest way to traverse a tree, but certainly not the only one.

For me, raycasting is the fact to incrementaly search the hit along the ray from eye, where raytracing calculate it directly using equation.

This topic is closed to new replies.

Advertisement