View Full Version : Ray casting

06-08-2004, 05:13 AM
I need a source program of ray casting for volume
rendering.Please help me!

06-08-2004, 05:58 AM
I don't understand. You said you need source code, why don't you write the code?

06-10-2004, 01:04 PM
I think you are looking for a raytracer, so that you
can see how it works and use some of the ideas in
your direct rendering programs....

Look for "retardotracer" (or something like that).
It is a full raytracer. Somebody's free-time project.
Source code is available.

I would have given you my raytracer, but it is much
too crapy for anyone to try and use.

The basic algorith is simple:

1. setup the projection screen. A set of points in
3D space representing each pixel.

2. Loop over all points, for a vector originating
from the eye to the screen. For each of these
"rays" check for intersections with objects. If
an object is hit, get the colour of the object
and store it in the final picture array. If not,
use a default background colour.

Now, things can get complicated if you want more
realism. For example, correct diffuse/specular
light. Transparencies, shadows, multiple light
sources, etc. But once you get the basic algorithm
working, you should be able to build on it.

There are known and well documented methods for
"testing" intersections of the rays with any object
(a line in space and a primitive, say a sphere).
Search for them.

Send a private message if you need more info.

06-10-2004, 05:17 PM
No, he's looking for source code for volume ray casting on GPUs similar to the Krueger/Westermann paper from Visualization 2003. AFAIK Krueger/Westermann never published source code, however i remember some discussion on shadertech.org with source code:

Also, Roettger et al. had some pixel shader source code attached to their Vissymp '03 paper:

However, programming the technique yourself is certainly more fun ;)

- Klaus