http://www.cs.unc.edu/~isenburg/trianglestripcompression/ Triangle Strip Compression Martin Isenburg University of North Carolina at Chapel Hill.
Download ReportTranscript http://www.cs.unc.edu/~isenburg/trianglestripcompression/ Triangle Strip Compression Martin Isenburg University of North Carolina at Chapel Hill.
http://www.cs.unc.edu/~isenburg/trianglestripcompression/ Triangle Strip Compression Martin Isenburg University of North Carolina at Chapel Hill Introduction A new edge-based encoding scheme for mesh connectivity. Introduction A new edge-based encoding scheme for mesh connectivity. compact mesh representations Introduction A new edge-based encoding scheme for mesh connectivity. compact mesh representations simple implementation Introduction A new edge-based encoding scheme for mesh connectivity. compact mesh representations simple implementation fast decoding Introduction A new edge-based encoding scheme for mesh connectivity. compact mesh representations simple implementation fast decoding Introduction A new edge-based encoding scheme for mesh connectivity. compact mesh representations simple implementation fast decoding include triangle strip information at little additional costs A Triangle Mesh A Stripified Triangle Mesh Triangle Strips Triangle Strips • Technique for efficient rendering of triangle meshes. • Reduce data transfer between main memory and render engine. • Requires built-in buffer for two (previous) vertices. • Supported in today’s graphic boards. Rendering with Triangles Rendering with Triangles Rendering with Triangle Strips Rendering with Triangle Strips Rendering with Triangle Strips Sequential Triangle Strip v0 v0 v1 v2 v 3 v4 v5 v6 v 7 v8 v2 7 triangles v1 v4 v3 v6 v5 v7 9 vertices v8 Sequential Generalized Generalized Triangle Strip v0 7 triangles v2 v1 10 vertices v4 v3 v6 v5 v0 v 1 v2 v3 v2 v 5 v4 v7 v6 v8 v7 v8 Generalized Triangle Strip v0 7 triangles v2 v1 10 vertices v4 v3 v6 v5 v0 v 1 v2 v3 v2 v 5 v4 v7 v6 v8 v7 v8 Generalized Triangle Strip v0 v2 7 triangles swap v2 v1 10 vertices v4 v3 v6 v5 v0 v 1 v2 v3 v2 v 5 v4 v7 v6 v8 v7 v8 Stripification Algorithms • finding good set of triangle strips (e.g. few swaps, restarts) isn’t easy • computing optimal solution is NP hard • proposed tools with good heuristics: – STRIPE (96, Evans et al.) – SWAPS (97, Speckmann & Snoeyink) – FGTS (99, Xiang et al.) Storing a Mesh Storing a Mesh • Where are the vertices located ? mesh geometry • Which vertices form a triangle? mesh connectivity Standard Representation list of vertices x0 y0 z0 x1 y1 z1 x2 y2 z2 x3 y3 z3 4 x4 y4 z4 6 4 ..... xn yn zn Standard Representation list of vertices x0 y0 z0 x1 y1 z1 x2 y2 z2 x3 y3 z3 4 x4 y4 z4 6 4 ..... xn yn zn list of triangles 1 4 20 Standard Representation list of vertices x0 y0 z0 x1 y1 z1 x2 y2 z2 x3 y3 z3 4 x4 y4 z4 6 4 ..... xn yn zn list of triangles 1 4 20 Standard Representation list of vertices x0 y0 z0 x1 y1 z1 x2 y2 z2 x3 y3 z3 4 x4 y4 z4 6 4 ..... xn yn zn list of triangles 1 4 20 Standard Representation list of vertices x0 y0 z0 x1 y1 z1 x2 y2 z2 x3 y3 z3 4 x4 y4 z4 6 4 ..... xn yn zn list of triangles 1 4 20 Standard Representation list of vertices list of triangles x0 y0 z0 x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4 ..... xn yn zn 1 4 2 2 3 0 4 0 5 3 4 5 5 0 2 ..... ..... ..... 4 u2 v 2 w 2 u3 v 3 w 3 u4 v 4 w 4 3 4 3 4 3 6 Connectivity list of vertices x0 y0 z0 x y z 1 1 1 Storage costs: x2 y2 z2 u2 v2 w2 6xlog(n) 3 y3 z3bpvu3 v3 w3 4 x4 y4 z4 u4 v4 w4 ..... xn yn zn list of triangles 1 4 2 2 3 0 4 0 5 3 4 5 5 0 2 ..... ..... ..... 3 4 3 4 3 6 Storing a Stripified Mesh Storing a Stripified Mesh • Where are the vertices located ? mesh geometry • Which vertices form a triangle? mesh connectivity Storing a Stripified Mesh • Where are the vertices located ? mesh geometry • Which vertices form a triangle? mesh connectivity • Which triangles form a strip? mesh stripification Storing a Stripified Mesh • Where are the vertices located ? mesh geometry • Which vertices form a triangle strip? mesh connectivity mesh stripification Standard Representation list of vertices x0 y0 z0 x1 y1 z1 x2 y2 z2 x3 y3 z3 4 x4 y4 z4 6 4 ..... xn yn zn Standard Representation list of vertices x0 y0 z0 x1 y1 z1 x2 y2 z2 x3 y3 z3 4 x4 y4 z4 6 4 ..... xn yn zn list of triangle strips 1 4 20 30 0 . . . 1 0 40 20 4 . . . 7 4 50 80 4 . . . ......... ......... ......... Connectivity and Stripification list of vertices x0 y0 z0 x y z 1 1 1 Storage costs: x2 y2 z2 x3 log(n) y3 z3 bpv 2~3 4 x4 y4 z4 6 4 ..... xn yn zn list of triangle strips 1 4 20 30 0 . . . 1 0 40 20 4 . . . 7 4 50 80 4 . . . ......... ......... ......... Connectivity Compression for Triangle Meshes Compression Techniques • Keeler Westbrook [95] • Taubin Rossignac [96] • Tauma Gotsman [98] • Rossignac [98] • DeFloriani et al [99] • Isenburg Snoeyink [99] Compression Techniques • Keeler Westbrook [95] • Taubin Rossignac [96] • Tauma Gotsman [98] • Rossignac [98] • DeFloriani et al [99] • Isenburg Snoeyink [99] Short Encodings of Planar Graphs and Maps 4.6 bpv (4.6) Compression Techniques • Keeler Westbrook [95] • Taubin Rossignac [96] • Tauma Gotsman [98] • Rossignac [98] • DeFloriani et al [99] • Isenburg Snoeyink [99] Topological Surgery 2.4 ~ 7.0 bpv (--) Compression Techniques • Keeler Westbrook [95] • Taubin Rossignac [96] • Tauma Gotsman [98] • Rossignac [98] • DeFloriani et al [99] • Isenburg Snoeyink [99] Triangle Mesh Compression 0.2 ~ 2.9 bpv (--) Compression Techniques • Keeler Westbrook [95] • Taubin Rossignac [96] • Tauma Gotsman [98] • Rossignac [98] • DeFloriani et al [99] • Isenburg Snoeyink [99] Edgebreaker 3.2 ~ 4.0 bpv (4.0) Compression Techniques A Simple and Efficient • Keeler Westbrook [95] Encoding for Triangle Meshes 4.2 ~ 5.4 bpv (6.0) • Taubin Rossignac [96] • Tauma Gotsman [98] • Rossignac [98] • DeFloriani et al [99] • Isenburg Snoeyink [99] Compression Techniques • Keeler Westbrook [95] • Taubin Rossignac [96] • Tauma Gotsman [98] • Rossignac [98] • DeFloriani et al [99] • Isenburg Snoeyink [99] Mesh Collapse Compression 1.1 ~ 3.4 bpv (--) strip-internal edges strip-internal edges 1 1 1 1 1 1 1 1 1 1 1 1 strip-internal edges 3 bpv 0 0 0 1 1 1 0 1 0 0 1 0 1 1 0 1 1 1 0 0 1 0 0 1 0 0 Triangle Fixer Encoding scheme Define initial active boundary around arbitrary edge of mesh. Encoding scheme Define initial active gate as one of the two boundary edges. Encoding scheme Label active gate with T, R, L, S, or E. Encoding scheme Label active gate with T, R, L, S, or E. Which label ? Depends on its adacency relation with the boundary. Encoding scheme Label active gate with T, R, L, S, or E. Which label ? Depends on its adacency relation with the boundary. Update active boundary and active gate. Encoding scheme Label active gate with T, R, L, S, or E. Which label ? Depends on its adacency relation with the boundary. Update active boundary and active gate. Boundary is expanded (T), is shrunk (R and L), is split (S), or is terminated (E). Label T Active gate not adjacent to other boundary edge. before Label T before after Label R Active gate adjacent to next edge along active boundary. before Label R before after Label L Active gate adjacent to previous edge along active boundary. before Label L before after Label S Active gate adjacent to some other edge of active boundary. before Label S Active gate adjacent to some other edge of active boundary. Label S Active gate adjacent to some other edge of active boundary. before Label S before after Label E Active gate adjacent to previous and next edge along active boundary. before Label E before after Example Run: Encoding T T T T T R T T T T R T T T T R T H10 R R R R R R R R E Example Run: Decoding E R R R R R R R R H10 T R T T T T R T T T T R T T T T T Holes and Handles Simple Mesh Mesh with Holes Mesh with Handle Mesh with Handle and Holes Encoding a hole • use new label H • associate integer called size with label H that specifies number of edges/vertices around hole • one label Hsize per hole • total number of labels remains equal to number of mesh edges Label Hsize Active gate adjacent to hole of size edges/vertices. before hole Label Hsize before hole after Encoding a handle • use new label M • associate three integers called index, offset1, and offset2 with label M that specify current configuration • one label Midx,off1,off2 per handle • total number of labels remains equal to number of mesh edges Label Midx,off1,off2 Active gate adjacent to some edge of boundary in stack. before offset2 index in stack offset1 Label Midx,off1,off2 before after offset2 index in stack offset1 Triangle Strip Compression Triangle Strip Compression • let triangle strips guide the mesh traversal • replace label T with labels TR, TL, TB, and TE • traversing along strip means progress for both: – encoding connectivity – encoding stripification Label TR Triangle strip leaves triangle on the right. before Label TR before after Label TL Triangle strip leaves triangle on the left. before Label TL before after Label TB Triangle strip leaves triangle on the left and on the right. before Label TB before after Label TE (case 1) Triangle strip ends in triangle. before AND It’s the last triangle of current strip. It doesn’t follow a label of type TB. Label TE (case 1) before after Label TE (case 2) Triangle strip ends in triangle. before AND Not the last triangle of current strip. It follows a label of type TB. Label TE (case 2) before after Example Run: Encoding TL TR TR TR TE TB TL TR TR TL TR TR TE TE H10 R R R R R S L L E R R E Example Run: Decoding calculate offset TL TR TL TL TE TB TL TR TR TL TR TR TE* TE H10 R R R R R S L L E R R E Offset = 6 E R R E L L S R R R R R H10 TE TE * TE * TE * TE * TR TR TL TR TR TL TB TE TR TR TR TL Compressing the label sequence Fixed-Bit Encoding • map label types to unique bit-codes example: T 0 R 01 S 0001 L 001 E 0011 • frequent labels are mapped to short bit-codes • make mapping dependent on last label (e.g. one label memory) • very simple implementation Arithmetic Encoding • approaches the entropy of the label sequence • adaptive version • three label memory • due to small number of different symbols, probability tables require less than 4 KB • implemented with fast bit operations Results Fandisk Eight Bunny Triceratops Skull Results mesh vertices fixed aac-3 250 3.99 2.98 2.36 1.78 shape 2562 4.00 3.09 0.77 0.62 fandisk 6475 4.01 3.61 1.67 2.25 triceratops 2832 4.00 4.12 2.52 3.49 eight 766 4.09 3.46 1.43 1.78 femur 3897 4.16 4.48 3.05 4.02 skull 10952 4.22 4.78 2.96 4.18 bunny 34834 4.00 3.69 1.73 2.40 bishop Video Mesh Properties Many polygon meshes include additional information • Surface Normals • Texture coordinates • Colours Mesh Properties Mesh properties can be attached to Mesh Properties Mesh properties can be attached to • vertices Mesh Properties Mesh properties can be attached to • vertices • faces Mesh Properties Mesh properties can be attached to • vertices • faces • corners Corner Attributes • Make stripification process difficult. • Corner attributes must be consistent for vertices in strip. • But . . . mapping attributes to strip corners is cheaper than mapping to triangle corners. • Usually requires 1 bit per corner. • Immediate savings of 50 % and more! Number of Corners mesh vertices triangles strip 250 1488 498 shape 2562 15360 5124 fandisk 6475 38838 13394 triceratops 2832 16980 5948 eight 766 4608 1584 femur 3897 23394 8272 skull 10952 66312 23304 bunny 34834 208353 71909 bishop Summary and Current Work • Compact encodings for stripified triangle meshes. • Exploit existing correlation between connectivity and stripification. • Edge-based encoding has other useful applications (non-triangular meshes). Acknowledgements • Bettina Speckmann for fruitful discussions on triangle strips • Xinyu Xiang for triangulating some of my test models • my supervisor Jack Snoeyink for reviewing the paper