Title: Generic Mesh Refinement on GPU
1Generic Mesh Refinement on GPU
- Tamy Boubekeur Christophe Schlick
- LaBRI INRIA CNRS
- University of Bordeaux
2Today GPU Features
- Combination of Vertex and Fragment Shaders
- Dedicated hardware primitives (VBO, FBO)
- C-like programming language (GLSL, CG, HLSL)
- gt Most of the rendering task is on GPU
3Today GPU Rendering
- Per-pixel illumination
- Hard and Soft Shadows
- HDR images ATI 2003
- Global Illumination Effects NVIDIA 2005
- gt Near-Realistic real-time rendering
4Realistic Image
- Means realistic lighting of course, but also
- Complex objects (many polygons)
- Details (at the pixel resolution)
- Usual solution
- Shape complexity smooth and/or detailled
surfaces - Appearance complexity high-resolution
multi-texturing fragments shaders
5Fair Surface Representation
- Multi-scale representation for real-time
graphics - Light representation for animation/physics.
- On-the-fly geometric refinement for silhouette
and contours. - Details at rasterization time.
- One acceptable solution
- CPU Low resolution clever mesh, carefully
designed. - CPU/GPU Medium resolution displacement map.
- GPU High resolution appearance map (normal,
color).
6Fair Surface Representation
- Multi-scale representation for real-time
graphics - Light representation for animation/physics.
- On-the-fly geometric refinement for silhouette
and contours. - Details at rasterization time.
- One acceptable solution
- CPU Low resolution clever mesh, carefully
designed. - CPU/GPU Medium resolution displacement map.
- GPU High resolution appearance map (normal,
color).
7Previous Work
- Subdivision Surfaces
- Many schemes Catmull 1978Loop 1987Zorin
2000Stam 2003 - Local control Biermann 2001
- Hardware evaluation Bishoff 2000Bolz 2002
- GPU implementation Bolz 2003Shiue 2005
- Local Refinement
- Curved PN Triangles Vlachos 2001Chung 2003
- Scalar Tagged Meshes Boubekeur 2005
8Dynamic Refinement
Frame Rendering
Graphics Bus
Refinement
Coarse Mesh
Tessellated Mesh
Refined Mesh
Tessellator
Displacement
RENDERING
CPU
GPU
Non-programmable Graphics Hardware
9Dynamic Refinement
Frame Rendering
Graphics Bus
Refinement
Coarse Mesh
Tessellated Mesh
Refined Mesh
Tessellator
Displacement
RENDERING
CPU
GPU
Programmable Graphics Hardware
10Our goal
Virtual GPU Tessellator Unit on todays GPU
Graphics Bus
Refinement
Coarse Mesh
Tessellated Mesh
Refined Mesh
Tessellator
Displacement
RENDERING
CPU
GPU
- Dynamic coarse meshes on CPU
- Per-polygon tessellation on GPU
- Local computation of refined vertices
- General enough solution for various kinds of
local displacement
11Our Approach
- Storing only ONE triangle fully tessellated the
Refinement - Pattern (RP), directly on the GPU memory
- Configuring the GPU with the coarse triangle
parameters - Rendering the RP instead of each coarse triangle
- Conforming the RP to the current GPU
configuration
12GPU Refinement Pattern
- The only one drawn primitive
- A collection of triangle strips, pre-generated
and stored on the GPU - Problem
- How to transform efficiently the RP toward the
current coarse triangle ? - How to resolve this problem in a GPU-friendly
fashion (ie. for each vertex of the RP
independently) ?
13GPU Refinement Pattern
- Solution
- Encoding the barycentric coordinates u, v, w as
position of the RP vertices. - Using this parameterization to interpolate
parameters (position, normal, color, textures
coordinates, etc) of the current triangle in the
vertex shader
14Displacement computation
- Performed by the Vertex Shader for each refined
vertex. - 3D-based displacement with interpolated position.
- 2D-based displacement with interpolated texture
coordinates gt texturing meshes with meshes.
15Level Of Detail
- Discrete LOD by simply storing a set of RP at
different resolution on the GPU memory - Switching on a per-object basis between the
different level of detail - Continuous LOD by interpolation between 2
consecutive level of details.
16Drawing algorithm
- Draw (CoarseMesh M, level L)
- GPURPbindLOD (L)
- for all Triangle T of M do
- GPUplaceAttributeOnGPU (T)
- GPURPdraw ()
17Drawing algorithm
- Draw (CoarseMesh M, level L)
- GPURPbindLOD (L)
- for all Triangle T of M do
- GPUplaceAttributeOnGPU (T)
- GPURPdraw ()
Refinement Shader
1 Attribute Interpolation
2Displacement Computation
3 Output refined vertex
18Implementation
- Requires only Vertex Shader 1 compatible GPUs
(all programmable GPUs) - No use of Fragment Shaders, no multi-pass, no
render-to-texture, etc. - Small vertex shader code
- RP stored as triangle strips in a VBO
19Workload balance
- Software side/CPU workload
- Initialization of the RP (set of RP for LOD).
- High level modification of the coarse mesh.
- Realtime graphics bus load
- Upload of the coarse per-triangle parameters
through uniforms variables (positions, normals,
colors, additional local parameters) - Drawing call of RP (VBO) at the chosen LOD
- Note Nb draw calls Nb coarse triangles
20Workload balance
- GPU additional workload
- At the beginning of the Vertex Program, for the
RP-based interpolation (i.e. the tessellation) - Essentially, the procedural displacement
computation or query (displacement map with
Vertex Shaders 3.0) - Note the RP-based interpolation masks the
- memory latency for texture access from the vertex
- shader NVIDIA 2004
21Procedural Displacement
12 coarse triangle frequency control 786 432
on GPU triangles
- Concept
- Object Simple Base Mesh Procedural
Function(s) - Deep refinement required for high frequencies
- ex a.sin(fP)
- Full use of GPU (GPU-limited for deep refinements)
22Curved PN Triangles
- Local triangle smoothing with cubic Bezier
patches - Point-Normal Construction
- Linear or quadratic normal field
ATI/Valchos et al. 2004
- Interpolatory refinement
- No dynamic topology to manage
- Still non ordered triangle stream
- Usually enough for real-time rendering
23Curved PN Triangles
- With our approach
- Each coarse triangle is provided to GPU with its
Bezier coefficients - b300, b030,b003, b210,b201,b021,
b120,b102,b012, b111 - After tessellation, the displacement is computed
with coefficients in the vertex program
Note coefficients can be computed on the GPU and
stored as textures.
24Scalar Tagged Mesh
EG 2005
- Enriched Meshes for real-time applications
- PN Triangles Scalar tag control on a per-vertex
basis - Surface refinement driven by scalar tags
25Scalar Tagged Mesh
EG 2005
- Shape factors sharpness, tension, bias,
- Sharp creases locally defined
- Bezier coefficient classification around each
vertex - Intuitive behavior
26Scalar Tagged Mesh
EG 2005
- Procedural Normal Map
- Procedural Displacement Map
- With our approach still coarse
triangle/coefficient transmission
Note branching needed in our implementation
27Performance
Simple tessellation of triangular meshes.
- no full resolution topology generation/storage
- For dynamic objects, between 1 and 3 orders of
magnitude faster than a CPU refinement
28Advantages
- Negligible graphics bus bandwidth
- Full use of GPU for deep refinement
- Easy to implement
- Easy to integrate as API extension (OpenGL driver
implementation) - Drawing of objects that would not fit in memory
29Drawbacks
- Attributes transfer not optimal (uniform
variables) - Need of a middleware support for full GPU
utilization at low tessellation rate - Today more interesting for deep refinement (gt6x6)
30Alternative
- Non triangular RP
- Non polygonal rendering (point-based surfaces)
- Non regular RP
- Alternative RP parameterization
- Alternative interpolation
31Conclusion
- A low cost Hardware Tessellator Unit
- Generic method for hardware surface tessellation
an displacement - An hardware implementation of Curved PN Triangles
for ALL programmable GPUs - Very deep tessellation rate for procedural
displacements - Easy to implement
- Work on todays GPU/no additional hardware
32Conclusion
- Refinement Shader
- RP-based interpolation Tessellation
- Function evaluation/query Displacement
- Output
33Current and Future Work
- Symmetry analysis for rough view-dependent LOD
- Refinement with high order continuity using
constrained meshes (vertex degree) Bolz2002 - Semi-automatic conversion of larges meshes to GPU
Fair Representation - New local smoothing algorithms (ST-Meshes)
34Thank you for your attention !
Demo
http//www.labri.fr/boubek