Jump to content

  • Log In with Google      Sign In   
  • Create Account

Like
0Likes
Dislike

A Simple and Inexpensive Ray-casting Effect

By Karsten Schwenk | Published Jun 19 2008 05:38 AM in Graphics Programming and Theory

model transmittance include this intensity algorithm number accumulated volume
If you find this article contains errors or problems rendering it unreadable (missing images or files, mangled code, improper text formatting, etc) please contact the editor so corrections can be made. Thank you for helping us improve this resource

Posted Image Posted Image Posted Image


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[i]; T = T*t[i]; --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[i] is the source term of the i-th ray segment, t[i] its transmittance, and I0 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





Comments

Note: Please offer only positive, constructive comments - we are looking to promote a positive atmosphere where collaboration is valued above all else.




PARTNERS