subdivision meshes in gpusglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11....

30
Subdivision Meshes in GPU Young-Jun Kim KAIST (Korea Advanced Institute of Science and Technology)

Upload: others

Post on 17-Mar-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

Subdivision Meshes in GPU

Young-Jun KimKAIST (Korea Advanced Institute of Science

and Technology)

Page 2: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

2

● Introduction● Background

● Subdivision meshes● GPU

●Related Works● Problem and Idea● Conclusion

Contents

Page 3: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

3

● The subdivision meshes are developed for representing the characters and objects having smooth shape for the animations and games

● Subdivision meshes in the movies● Geri’s Game (Pixar 1997)● A Bug’s Life (Pixar 1998)● Meet The Robinsons (Disney 2007)

Introduction

© PIXAR © PIXAR & Disney © Disney

Page 4: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

4

●Recursively refine a polygonal mesh

●Number of iteration determines Level-Of-Detail (LOD)

● Provide infinite LOD

Subdivision Meshes (1)

Original control meshSmoother surface

by recursive processing

Page 5: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

5

Subdivision Meshes (2)● Two phase process

● Refinement phase: creates new vertices and reconnects to create new triangles

● Smoothing phase: computes new positions for the vertices

Page 6: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

6

● Efficiency● Modeling is easy

● Arbitrary topology● Classic spline approaches have great difficulty with

control meshes of arbitrary topology.

Advantage of Subdivision (1)

Standard valence : 4(regular point )Extraordinary valence : ≠4(irregular point )

Page 7: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

7

Piecewise smooth subdivision [Hoppe ’94]Support more detail surfaces

● Complex geometry● Internal refinement of a mesh reduces

consumption of bandwidth (bus, memory, and etc.)

Advantage of Subdivision (2)

Corner Crease

Dart

Smooth

smooth (s=0), dart (s=1), crease (s=2), and corner (s>2)

Page 8: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

8

Face Split Vertex Split

Triangular meshes Quad. meshes Doo-Sabin (C1)

Approximating Loop (C2) Catmull-Clark (C2) Midedge (C1)

Interpolating Modified Butterfly (C1) Kobbelt (C1) Biquartic(C4)

Subdivision Scheme Classification

Face Split Vertex Split

Page 9: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

9

● Approximating● The limit curve does not lie on the vertices of the initial

polygon because the vertices are discarded (or updated).

● Interpolating● Keep all the points from the previous subdivision step

Subdivision Schemes

Page 10: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

10

● Good results for most kinds of control mesh

[Bolz ‘02]

● Most of modeling tools use Catmull-Clark subdivision● Autodesk 3ds Max● Autodesk Maya● PIXAR RenderMan

Catmull-Clark Subdivision (1)

Page 11: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

11

● Subdivision rules (regular point)

Catmull-Clark Subdivision (2)

44321 vvvvf +++

=

42121 ffvve +++

=

4..2. ' favgeavgvprevv +×+

=

face

edge

vertex

Page 12: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

12

●No generation of unnecessary vertices● Improve performance with almost same

quality

Adaptive Subdivision

Adaptive subdivision (Max. level = 4)

Uniform subdivision (Level = 4)

Page 13: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

13

LOD Selection● Curvature

● Flatness test● LOD is calculated from Max(D1, D2)

● Projected length (edge) or area (face)

D1 D2 D1

D2

screen

L A

Page 14: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

14

Crack● Adaptive subdivision has possibility to

create cracks● Cracks are created if each patch has

different LOD

crack

T vertexT vertex

Page 15: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

15

Crack Elimination●Remove vertex

●Generate a face point & edge points

Page 16: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

16

Why GPU?●GPU has programmability enough for

general computation● A programmable shader replaces a traditional

fixed function unit as core processor●GPU is faster than CPU for parallel

processing of independent workloads● Integrated more arithmetic units (an arithmetic

unit is simpler than that of CPU)● Enhanced matrix calculation (support dot

product and multiply-and-add instructions)● Control path is optimized for non-data hazard

workloads (efficient and simple)

Page 17: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

17

Programmable Shader of GPU

● Traditional fixed-function unit Programmable shader

Pixel Shader

VertexShader

GPUFront end

PrimitiveAssembly

Frame BufferCPU Rasterization Raster

Operations

Transform& Lighting

GPUFront end

PrimitiveAssembly

Frame BufferCPU Rasterization Raster

Operations

TextureUnit

Page 18: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

18

Parallel Processing●Handle independent workloads

Pixel Shader 1

VertexShader 1

GPUFront end

PrimitiveAssembly

Frame BufferCPU Rasterization Raster

Operations

VertexShader 2

VertexShader N

Pixel Shader 2

Pixel Shader N

Page 19: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

19

GPU Limitations● Program length limitation

● Maximum code length is limited.● Shader program switching overhead is very

heavy.● But this problem can be solved at the next

version of shader model.●Weak data feedback

● Optimized for unidirectional data flow (input-to-framebuffer)

● Some extensions support data feed back features but limited.

Page 20: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

20

● Bolz, J. and Schröder, P. 2002. Rapid Evaluation of Catmull-Clark Subdivision Surfaces● CPU implementation using SIMD instruction● Pre-computation of tables for all depth and

valences●Poor flexibility and large tables

● Adaptive subdivision● Final subdivided vertices send to GPU

●No gain of CPU-to-GPU data transfer bandwidth

Previous Works (1)

Page 21: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

21

Previous Works (2)● Bolz, J. and Schröder, P. 2002. Evaluation

of subdivision surfaces on programmable graphics hardware ● GPU implementation version of their previous

work● Final subdivided vertices send to CPU and re-

send to GPU for rendering●The data shoud be sent to vertex shader input for rendering, but there was no path from frame buffer or texture memory to vertex shader in that time

Page 22: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

22

● Bunnel. 2005. Adaptive Tessellation of Subdivision Surfaces with Displacement Mapping (GPU Gem2)● Pixel shader program on GPU for subdivision● Adaptive subdivision using flatness test at each level● CPU read the flatness test results from the video memory

and decides which patches need further tessellation for adaptive subdivision

Previous Works (3)

Pixel Shader

VertexShader

GPUFront end

PrimitiveAssembly

Frame BufferCPU Rasterization Raster

Operations

Page 23: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

23

● All patches are subdivided by only one level at every subdivision iteration●Good locality between a patch and its neighbors●Poor locality between a current patch and the same patch of the next iteration

● Use copy-to-texture for feedback of the intermediate data

Previous Works (3) – cont’d

Pixel Shader

VertexShader

GPUFront end

PrimitiveAssembly

Frame BufferCPU Rasterization Raster

Operations

TextureMemory

Page 24: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

24

Previous Works (4)● Le-Jeng Shiue 2005. A Real-time GPU

subdivision Kernel● Regular processing using fragment mesh

●Irregular point is placed at center●1-ring regular point meshes are overlapped

Page 25: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

25

Previous Works (4) – cont’d● Processing of irregular points causes inefficient

memory access and shader context switching (regular point shader program and irregular point shader program)

● All fragment meshes have regular pattern●1-irregular point & regular points●Can be used of united shader program

● Few information about adaptive subdivision

Page 26: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

26

Previous Works (5)●Minho Kim. 2005. Real-time Loop

Subdivision on the GPU● Exploration for many new memory access

features in OpenGL API extension●Using frame buffer object (FBO)

Pixel Shader

VertexShader

GPUFront end

PrimitiveAssemblyCPU Rasterization Raster

Operations

FBO

Page 27: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

27

Previous Works (5) – cont’d●Using vertex buffer object (VBO)

●or vertex texture

Pixel Shader

VertexShader

GPUFront end

PrimitiveAssemblyCPU Rasterization Raster

Operations

TextureMemoryVBO/PBO

Pixel Shader

VertexShader

GPUFront end

PrimitiveAssemblyCPU Rasterization Raster

Operations

TextureMemory

Page 28: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

28

Problems● Context switching is large overhead

● FBO destination switching (frame buffer or texture memory)

● Multiple shader program switching● CPU (host) should handle both context

switching●Neighbor mesh information is overlapped

● Redundant information

Page 29: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

29

Problems – cont’d●Missing temporal locality at each

subdivision step● Flatness test at every subdivision steps

●Crack should be eliminated at final subdivision step

● Breath first operation (Subdivision step 1 of patch 1 subdivision step 1 of patch 2 … subdivision step n of patch 1)

step 1

can be reused at next step

step 2

but flushed in the cache

Page 30: Subdivision Meshes in GPUsglab.kaist.ac.kr/~sungeui/sga07/students/youngjunkim... · 2007. 11. 22. · 3 The subdivision meshes are developed for representing the characters and objects

30

Question?

Thank You!