Upload
marlin
View
38
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Generic Mesh Refinement on GPU. Tamy Boubekeur & Christophe Schlick LaBRI – INRIA – CNRS University of Bordeaux. Today GPU Features. Combination of Vertex and Fragment Shaders Dedicated hardware primitives (VBO, FBO) C-like programming language (GLSL, CG, HLSL) - PowerPoint PPT Presentation
Citation preview
Generic Mesh Generic Mesh Refinement on Refinement on
GPUGPUTamy Boubekeur & Christophe Tamy Boubekeur & Christophe
SchlickSchlick
LaBRI – INRIA – CNRSLaBRI – INRIA – CNRSUniversityUniversity ofof Bordeaux Bordeaux
Today GPU Features Today GPU Features
Combination of Vertex and Fragment ShadersCombination of Vertex and Fragment Shaders Dedicated hardware primitives (VBO, FBO) Dedicated hardware primitives (VBO, FBO) C-like programming language (GLSL, CG, HLSL)C-like programming language (GLSL, CG, HLSL)
> Most of the rendering task is on GPU> Most of the rendering task is on GPU
Today GPU Rendering Today GPU Rendering
Per-pixel illuminationPer-pixel illumination Hard and Soft ShadowsHard and Soft Shadows HDR images [ATI 2003]HDR images [ATI 2003] Global Illumination Effects Global Illumination Effects
[NVIDIA 2005] [NVIDIA 2005]
> Near-Realistic real-time > Near-Realistic real-time renderingrendering
Realistic ImageRealistic Image
Means realistic lighting of course, but also:Means realistic lighting of course, but also:
1.1. Complex objects (many polygons)Complex objects (many polygons)
2.2. Details (at the pixel resolution)Details (at the pixel resolution)
Usual solution:Usual solution:
1.1. Shape complexity: smooth and/or Shape complexity: smooth and/or detailled surfaces detailled surfaces
2.2. Appearance complexity: high-resolution Appearance complexity: high-resolution multi-texturing + fragments shaders multi-texturing + fragments shaders
Fair Surface Fair Surface RepresentationRepresentation
Multi-scale representation for real-time graphics:Multi-scale representation for real-time graphics:1.1. Light representation for animation/physics.Light representation for animation/physics.2.2. On-the-fly geometric refinement for silhouette On-the-fly geometric refinement for silhouette
and contours.and contours.3.3. Details at rasterization time.Details at rasterization time.
One acceptable solution:One acceptable solution:1.1. CPU: Low resolution “clever” mesh, carefully CPU: Low resolution “clever” mesh, carefully
designed.designed.2.2. CPU/GPU: Medium resolution displacement map.CPU/GPU: Medium resolution displacement map.3.3. GPU: High resolution appearance map (normal, GPU: High resolution appearance map (normal,
color).color).
Fair Surface Fair Surface RepresentationRepresentation
Multi-scale representation for real-time graphics:Multi-scale representation for real-time graphics:1.1. Light representation for animation/physics.Light representation for animation/physics.2.2. On-the-fly geometric refinement for silhouette On-the-fly geometric refinement for silhouette
and contours.and contours.3.3. Details at rasterization time.Details at rasterization time.
One acceptable solution:One acceptable solution:1.1. CPU: Low resolution “clever” mesh, carefully CPU: Low resolution “clever” mesh, carefully
designed.designed.2.2. CPU/GPU: Medium resolution displacement CPU/GPU: Medium resolution displacement
map.map.3.3. GPU: High resolution appearance map (normal, GPU: High resolution appearance map (normal,
color).color).
Previous WorkPrevious Work Subdivision SurfacesSubdivision Surfaces
Many schemes [Catmull 1978]Many schemes [Catmull 1978][Loop 1987][Zorin 2000][Stam [Loop 1987][Zorin 2000][Stam 2003]2003]
Local control [Biermann 2001]Local control [Biermann 2001] Hardware evaluation [Bishoff Hardware evaluation [Bishoff
2000][Bolz 2002]2000][Bolz 2002] GPU implementation [Bolz 2003]GPU implementation [Bolz 2003]
[Shiue 2005][Shiue 2005] Local RefinementLocal Refinement
Curved PN Triangles [Vlachos Curved PN Triangles [Vlachos 2001][Chung 2003]2001][Chung 2003]
Scalar Tagged Meshes Scalar Tagged Meshes [Boubekeur 2005][Boubekeur 2005]
Dynamic RefinementDynamic Refinement
Coarse Mesh
Tessellated Mesh
Refined MeshTessellator Displacement RENDERING
Frame Rendering:
CPU GPU
Non-programmable Graphics Hardware
Graphics Bus
AdvantagesAdvantages DrawbacksDrawbacksFlexibilityFlexibility Slow - Graphics Bus
bottleneckStatic Refinement limited by CPU memory
Refinement
Dynamic RefinementDynamic Refinement
Coarse Mesh
Tessellated Mesh
Refined MeshTessellator Displacement RENDERING
Frame Rendering:
CPU GPU
Programmable Graphics Hardware
AdvantagesAdvantages DrawbacksDrawbacks Reduce per-frame CPU Reduce per-frame CPU workloadworkload
Tessellation still CPU limitedGraphics Bus bottleneck increased (tessellated mesh + displacement control data)
Graphics BusRefinement
Our goalOur goal
Coarse Mesh
Tessellated Mesh
Refined MeshTessellator Displacement RENDERING
CPU GPU
Virtual GPU Tessellator Unit on today’s GPU
Dynamic coarse meshes on CPUDynamic coarse meshes on CPU Per-polygon tessellation on GPUPer-polygon tessellation on GPU Local computation of refined verticesLocal computation of refined vertices General enough solution for various kinds of General enough solution for various kinds of
local displacementlocal displacement
Graphics Bus Refinement
Our ApproachOur Approach
Storing only ONE triangle fully tessellated : the Storing only ONE triangle fully tessellated : the RefinementRefinementPatternPattern (RP), directly on the GPU memory (RP), directly on the GPU memory1.1. ““Configuring” the GPU with the coarse triangle parametersConfiguring” the GPU with the coarse triangle parameters2.2. Rendering the RP instead of each coarse triangleRendering the RP instead of each coarse triangle3.3. ““Conforming” the RP to the current GPU « configuration »Conforming” the RP to the current GPU « configuration »
GPU Refinement PatternGPU Refinement Pattern
The The only oneonly one drawn primitive drawn primitive A collection of triangle strips, pre-generated and stored on the A collection of triangle strips, pre-generated and stored on the
GPUGPU Problem : Problem :
1.1. How to transform efficiently the RP toward the current coarse How to transform efficiently the RP toward the current coarse triangle ?triangle ?
2.2. How to resolve this problem in a GPU-friendly fashion (ie. for each How to resolve this problem in a GPU-friendly fashion (ie. for each vertex of the RP vertex of the RP independently) ?independently) ?
GPU Refinement PatternGPU Refinement Pattern
Solution:Solution:1.1. Encoding the barycentric coordinates {u, v, w} as Encoding the barycentric coordinates {u, v, w} as
position of the RP vertices.position of the RP vertices.
2.2. Using this parameterization to interpolate parameters Using this parameterization to interpolate parameters (position, normal, color, textures coordinates, etc) of (position, normal, color, textures coordinates, etc) of the current triangle in the vertex shader the current triangle in the vertex shader
Displacement Displacement computationcomputation
Performed by the Vertex Shader for each refined Performed by the Vertex Shader for each refined vertex.vertex.
3D-based displacement with interpolated 3D-based displacement with interpolated position.position.
2D-based displacement with interpolated texture 2D-based displacement with interpolated texture coordinates > “texturing meshes with meshes”.coordinates > “texturing meshes with meshes”.
Level Of DetailLevel Of Detail
Discrete LOD by simply storing a set of RP at Discrete LOD by simply storing a set of RP at different resolution on the GPU memorydifferent resolution on the GPU memory
Switching on a per-object basis between the Switching on a per-object basis between the different level of detaildifferent level of detail
Continuous LOD by interpolation between 2 Continuous LOD by interpolation between 2 consecutive level of details.consecutive level of details.
Drawing algorithmDrawing algorithm
Draw (Draw (CoarseMeshCoarseMesh M, M, levellevel L) L)
GPU::RP::bindLOD (L);GPU::RP::bindLOD (L);
for allfor all TriangleTriangle T of M T of M dodo
GPU::placeAttributeOnGPU (T);GPU::placeAttributeOnGPU (T);
GPU::RP::draw ();GPU::RP::draw ();
Drawing algorithmDrawing algorithm
Refinement Shader
1: Attribute Interpolation
2:Displacement Computation
3: Output refined vertex
Draw (Draw (CoarseMeshCoarseMesh M, M, levellevel L) L)
GPU::RP::bindLOD (L);GPU::RP::bindLOD (L);
for allfor all TriangleTriangle T of M T of M dodo
GPU::placeAttributeOnGPU (T);GPU::placeAttributeOnGPU (T);
GPU::RP::draw ();GPU::RP::draw ();
ImplementationImplementation
Requires only Vertex Shader 1 compatible Requires only Vertex Shader 1 compatible GPUs (GPUs (allall programmable GPUs) programmable GPUs)
No use of Fragment Shaders, no multi-No use of Fragment Shaders, no multi-pass, no render-to-texture, etc.pass, no render-to-texture, etc.
Small vertex shader codeSmall vertex shader code
RP stored as triangle strips in a VBORP stored as triangle strips in a VBO
Workload balanceWorkload balance Software side/CPU workload:Software side/CPU workload:
Initialization of the RP (set of RP for LOD).Initialization of the RP (set of RP for LOD). High level modification of the coarse mesh.High level modification of the coarse mesh.
Realtime graphics bus load:Realtime graphics bus load: Upload of the coarse per-triangle parameters Upload of the coarse per-triangle parameters
through uniforms variables (positions, through uniforms variables (positions, normals, colors, additional local parameters…)normals, colors, additional local parameters…)
Drawing call of RP (VBO) at the chosen LODDrawing call of RP (VBO) at the chosen LOD
Note: Nb draw calls = Nb coarse trianglesNote: Nb draw calls = Nb coarse triangles
Workload balanceWorkload balance GPU additional workload:GPU additional workload:
At the beginning of the Vertex Program, for At the beginning of the Vertex Program, for the the RP-based interpolation RP-based interpolation (i.e. the (i.e. the “tessellation”)“tessellation”)
Essentially, the procedural displacement Essentially, the procedural displacement computation or query (displacement map with computation or query (displacement map with Vertex Shaders 3.0)Vertex Shaders 3.0)
Note:Note: the RP-based interpolation masks the the RP-based interpolation masks thememory latency for texture access from the memory latency for texture access from the
vertexvertexshader [NVIDIA 2004]shader [NVIDIA 2004]
Procedural DisplacementProcedural Displacement
Concept: Concept: Object = Simple Base Mesh + Procedural Function(s)Object = Simple Base Mesh + Procedural Function(s)
Deep refinement required for Deep refinement required for high frequencieshigh frequencies: :
ex: a.sin(f|P|)ex: a.sin(f|P|) Full use of GPU (GPU-limited for deep Full use of GPU (GPU-limited for deep
refinements)refinements)
12 coarse triangle + frequency control; 786 432 12 coarse triangle + frequency control; 786 432 on GPU triangleson GPU triangles
Curved PN TrianglesCurved PN Triangles Local triangle Local triangle
smoothing with cubic smoothing with cubic Bezier patchesBezier patches
Point-Normal Point-Normal ConstructionConstruction
Linear or quadratic Linear or quadratic normal fieldnormal field
[ATI/Valchos et al. 2004]
Interpolatory refinementInterpolatory refinement No dynamic topology to manageNo dynamic topology to manage Still non ordered triangle streamStill non ordered triangle stream Usually enough for real-time Usually enough for real-time
renderingrendering
Curved PN TrianglesCurved PN Triangles
With our approach:With our approach: Each coarse triangle is provided to GPU with its Bezier Each coarse triangle is provided to GPU with its Bezier
coefficients:coefficients:{b300, b030,b003, b210,b201,b021, b120,b102,b012, b111}{b300, b030,b003, b210,b201,b021, b120,b102,b012, b111} After tessellation, the displacement is computed with After tessellation, the displacement is computed with
coefficients in the vertex programcoefficients in the vertex program
Note: coefficients can be computed on the GPU and Note: coefficients can be computed on the GPU and stored as textures.stored as textures.
Scalar Tagged MeshScalar Tagged Mesh
Enriched Meshes for real-time applicationsEnriched Meshes for real-time applications PN Triangles + Scalar tag control on a per-PN Triangles + Scalar tag control on a per-
vertex basisvertex basis Surface refinement driven by scalar tagsSurface refinement driven by scalar tags
[EG 2005]
Scalar Tagged MeshScalar Tagged Mesh
Shape Shape factors: sharpness, tension, biasfactors: sharpness, tension, bias, …, … Sharp Sharp creases locallycreases locally defineddefined Bezier coefficient: classification around each Bezier coefficient: classification around each
vertexvertex Intuitive behaviorIntuitive behavior
[EG 2005]
Scalar Tagged MeshScalar Tagged Mesh
Procedural Normal MapProcedural Normal Map Procedural Displacement MapProcedural Displacement Map With our approach: still coarse With our approach: still coarse
triangle/coefficient transmissiontriangle/coefficient transmissionNote: branching needed in our implementation
[EG 2005]
PerformancePerformance
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
AdvantagesAdvantages
Negligible graphics bus bandwidthNegligible graphics bus bandwidth Full use of GPU for deep refinementFull use of GPU for deep refinement Easy to implementEasy to implement Easy to integrate as API extension Easy to integrate as API extension
(OpenGL driver implementation)(OpenGL driver implementation) Drawing of objects that would not fit Drawing of objects that would not fit
in memoryin memory
DrawbacksDrawbacks
Attributes transfer not optimal Attributes transfer not optimal (uniform variables)(uniform variables) Need of a middleware support for full Need of a middleware support for full
GPU utilization at low tessellation rateGPU utilization at low tessellation rate Today more interesting for deep Today more interesting for deep
refinement (>6x6)refinement (>6x6)
AlternativeAlternative
Non triangular RPNon triangular RP Non polygonal rendering (point-Non polygonal rendering (point-
based surfaces)based surfaces) Non regular RPNon regular RP Alternative RP parameterizationAlternative RP parameterization Alternative interpolationAlternative interpolation
ConclusionConclusion A low cost Hardware Tessellator Unit A low cost Hardware Tessellator Unit Generic method for hardware surface Generic method for hardware surface
tessellation an displacementtessellation an displacement An hardware implementation of Curved An hardware implementation of Curved
PN Triangles for ALL programmable GPUsPN Triangles for ALL programmable GPUs Very deep tessellation rate for procedural Very deep tessellation rate for procedural
displacementsdisplacements Easy to implementEasy to implement Work on today’s GPU/no additional Work on today’s GPU/no additional
hardwarehardware
ConclusionConclusion
Refinement ShaderRefinement Shader::1.1. RP-based interpolation = TessellationRP-based interpolation = Tessellation
2.2. Function evaluation/query = Function evaluation/query = DisplacementDisplacement
3.3. OutputOutput
Current and Future WorkCurrent and Future Work Symmetry analysis for rough view-Symmetry analysis for rough view-
dependent LODdependent LOD Refinement with high order continuity Refinement with high order continuity
using constrained meshes (vertex using constrained meshes (vertex degree) [Bolz2002]degree) [Bolz2002]
Semi-automatic conversion of larges Semi-automatic conversion of larges meshes to GPU Fair Representationmeshes to GPU Fair Representation
New local smoothing algorithms (ST-New local smoothing algorithms (ST-Meshes)Meshes)
Thank you for your Thank you for your attention ! attention !
http://www.labri.fr/~boubek
Demo