Difference between revisions of "VTK/Depth Peeling"
|Line 47:||Line 47:|
== Modified files ==
== Modified files ==
|Line 56:||Line 56:|
== VTK changes ==
== VTK changes ==
Revision as of 21:33, 1 December 2006
Depth peeling is a multipass technique to render translucent polygonal geometry without sorting polygons. It was added to VTK on November 27th 2006.
- Translucent geometry does not have to be sorted.
- The algorithm is inherently slow due to rendering the geometry multiple times.
- The implementation based on OpenGL API requires a couple of extensions, restricting its usage to recent GPU.
Required OpenGL extensions
- GL_SGIS_texture_edge_clamp or GL_EXT_texture_edge_clamp or OpenGL 1.2
OpenGL context requirement
- at least 8 alpha bits (by default vtkRenderWindow does not ask fro alpha bit planes, make sure to call vtkRenderWindow::SetAlphaBitPlanes(1))
The interface is in vtkRenderer.
- 1. Use a render window with alpha bits: renderWindow->SetAlphaBitPlanes(1) (initial value is 0 (false) )
- 2. Use renderer->SetUseDepthPeeling(1) to use depth peeling (if supported) (initial value is 0 (false) )
- 3. Set depth peeling parameters:
- renderer->SetMaximumNumberOfPeels(100) (initial value is 4) to set the maximum number of rendering passes
- renderer->SetOcclusionRatio(0.1) (initial value is 0.0, exact image)
- 4. Render
- 5. Check if depth peeling was actually used by calling renderer->GetLastRenderingUsedDepthPeeling()
vtkOpenGLActor.cxx vtkOpenGLRenderer.cxx vtkOpenGLRenderer.h vtkRenderer.cxx vtkRenderer.h Testing/Cxx/CMakeLists.txt Testing/Cxx/TestOpacity.cxx
Before the changes, Render of vtkRenderer used to iterate over all props and call RenderTranslucentGeometry on each of them. Now, it calls a virtual method DeviceRenderTranslucentGeometry(). By default this method call UpdateTranslucentGeometry(). And UpdateTranslucentGeometry() do exactly what Render() used to do.
In vtkOpenGLRenderer, DeviceRenderTranslucentGeometry() is overridden to use depth peeling flags and implement depth peeling technique. For each peel it will call UpdateTranslucentGeometry().
It uses a lot of GPU RAM because each rgba buffer of each peel have to be saved. The last step is to do compositing with each layer, back-to-front order ( if it was possible to do front-to-back compositing, we could perform compositing on the fly and we would not need to store each peel.) Compositing is done by rendering each layer as a texture on a quad.
As we first render opaque geometry, we use it to cull transparent geometry, limiting the number of required layers.
-  Interactive Order-Independent Transparency Cass Everitt NVIDIA (technical paper 05/15/2001 developer.nvidia.com/attach/6545 and slides developer.nvidia.com/attach/6402)
-  GPU-Accelerated High-Quality Hidden Surface Removal Daniel Wexler, Larry Gritz, Eric Enderton, Jonathan Rice, Graphics Hardware 2005, 30-31 July 2005, Los Angeles CA, ACM
-  GPU-based Tiled Ray Casting using Depth Peeling Fábio F. Bernardon Christian A. Pagot João L. Comba Cládio T. Silva www.inf.ufrgs.br/~comba/papers/2006/gpu_volume_ray_casting.pdf
-  GPU-based Transparent Polygonal Geometry in Volume Rendering home.dataparty.no/kristian/school/ntnu/masterthesis/embedded-geometry-paper.pdf (extension 297 GL_EXT_depth_bounds_test www.opengl.org/registry/specs/EXT/depth_bounds_test.txt)
-  Occlusion slides from Nvidia at Game Developer Conference 2002: developer.nvidia.com/attach/6715
-  Thomas Porter and Tom Duff, "Compositing Digital Images", Computer Graphics, Volume 18, Number 3, July 1984 (ACM Siggraph). Pretty good reference about compositing/alpha arithmetic.
-  Multi-Layer Depth Peeling via Fragment Sort research.microsoft.com/research/pubs/view.aspx?tr_id=1125
-  Release Notes for NVIDIA OpenGL Shading Language Support download.nvidia.com/developer/GLSL/GLSL%20Release%20Notes%20for%20Release%2060.pdf (from developer.nvidia.com/object/nvemulate.html )
OIT: Order Independent Transparency