• # A Simple and Inexpensive Ray-casting Effect

Graphics and GPU Programming

1 Introduction
This article describes two simple implementations of the emission/absorption model for participating media. The model is evaluated per-pixel with ray-casting on the GPU. In addition to the obvious (and quite inflexible and ineffective) basic approach an optimized version is described.

The emission/absorption model for participating media basically states that at each point in a volume a certain amount of light is emitted (this can also include in-scattering) and and absorbed (this can include out-scattering). This article is focused on a practical implementation of the model, so I won't go into the theory. The model is derived and described in more detail in [1].

If the problem is discretized we get the familiar front-to-back compositing algorithm for each viewing ray:

I = 0.0; T = 1.0; i = n; while( T > epsilon && i >= 1 ) { I = I + T*g; T = T*t; --i; } I = I + T*I0; Here, n is the number of samples to be taken, I is the accumulated intensity (color), T is the accumulated transmittance, g is the source term of the i-th ray segment, t its transmittance, and I[sub]0[/sub] is the intensity that enters the volume (the background color). If no early-ray termination (T ? e) is required (e.g. because it is extremely unlikely for the transmittance to drop below e), the algorithm above can more conveniently be written as a for-loop that accumulates a fixed number of samples:

I = 0.0; T = 1.0; for( int i=0; i

Report Article

## User Feedback

There are no comments to display.

## Create an account

Register a new account

• 0
• 25
• 0
• 1
• 0

• 13
• 26
• 10
• 11
• 9
×