Jump to content
  • Advertisement
  • 06/19/08 11:38 AM
    Sign in to follow this  

    A Simple and Inexpensive Ray-casting Effect

    Graphics and GPU Programming

    Myopic Rhino
    p1_thumbnail.png p2_thumbnail.png p3_thumbnail.png

    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
    Sign in to follow this  

    User Feedback

    There are no comments to display.

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!