Volumetric lines
NOTE: A similar method to the one presented on this page to render volumetric lines have been published in ShaderX7 (Chapter 2.2).
I am pleased to announce that my volumetric line algorithm is used in an awesome iPhone game: PewPew!!!
Natively, OpenGL doesn't alllow us to render volumetric line and simple line are generally not hardware accelerated. Tristan Lorach (nvidia.com) already proposed an approach to render such volumetric lines. My solution is different : it's simpler but an artifact appear when viewing line in their axis direction.
I render volumetric line by using billboard constrain on an axis. On each line's extremity, I had a camera facing billboard again constrain by the line axis. 6 triangles are used for each lines (in TRIS_STRIP mode) and a fast GLSL shader : all tricks are performed in the vertex shader, the fragment shader contains only a texture access for the line appearance.
I let you discover these volumetric lines in the demo. You can easily understand the rendering algorithm and the use of the appearance texture by selecting the debug texture.
Download source and executable
Mac OS X port by Jeshua Lacock
![]() |
Volumetric
lines |
![]() |
Thin
volumetric lines |
![]() |
Large
volumetric lines |
![]() |
Another
appearance |
![]() |
Another
appearance (bis) |