Download presentation
Presentation is loading. Please wait.
Published byMargery Ross Modified over 9 years ago
1
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs Level of detail Space partitioning
2
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics2 How can we represent objects/scenes Polygon meshes Scene graphs Parametric representations Equations Bunch o points
3
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics3 Why? Rendering Manipulate – User – System
4
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics4 Point Clouds Unstructured set of 3D point samples – Why – What for?
5
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics5 Polygon/Triangle Soup Unstructured set up polygons/triangles – Just a list of vertices for each polygon/triangle – Why? – What for? class Triangle { public: Triangle() {m_material = NULL;} CGrPoint3F m_vertices[3]; CGrPoint3F m_normals[3]; CGrPoint2F m_tvertices[3]; const void *m_material; };
6
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics6 What is tessellation? Representing a surface with flat approximating polygons – A sampled representation Geometric Aliasing – Error in the representation due to the sampling with polygons
7
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics7 Polygon/Triangle mesh Common method for describing geometry Set of vertices – Coordinates – Normal – Texture coordinates – Etc. Set of surfaces – Pointers to vertices – Material properties Common: Triangle mesh
8
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics8 class CTriangleMesh { public: CTriangleMesh(void); ~CTriangleMesh(void); // This structure defines a triangle struct Triangle { int m[3]; const CMaterial *material; }; int VertexCnt() const {return (int)m_vertices.size();} int TriangleCnt() const {return (int)m_triangles.size();} const std::vector &Vertices() const {return m_vertices;} const std::vector &Normals() const {return m_normals;} const std::vector &TVertices() const {return m_tvertices;} const std::vector &Triangles() const {return m_triangles;} const CMaterials &Materials() const {return m_materials;} private: CMaterials m_materials; // The materials collection // The vertices, normals, and texture vertices. // These three all correspond with each other. std::vector m_vertices; std::vector m_normals; std::vector m_tvertices; std::vector m_triangles; };
9
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics9 Polygon Mesh Retains shared-vertex relationships Vertex a,b,c,d; Polygon P1(a, b, c); Polygon P2(c, b, d); b,c shared by two polygons a b c d
10
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics10 Computing a surface normal Assume the following polygon: p1p1 p2p2 p3p3 p4p4 N
11
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics11 The Method of Projected Areas Assume this 2D example line: p1p1 p2p2 xx yy Projection of length to one axis
12
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics12 Method of Projected Areas The projection of the area onto the x/y plane is the z part of the normal
13
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics13 Where does this come from? x y Why would we want to use this?
14
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics14 Vertex normals Add normals for surfaces incident on vertex:
15
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics15 The Winged-Edge Data Structure Maintains – List of vertices – List of edges – List of faces
16
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics16 Winged-Edge Data Structure VertexIncident Edge Aa Bb Ce Da FaceIncident Edge 1a 2c 3e 4b Vertex table: Face table:
17
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics17 Edge Table a c e bd 12 B D EdgeVerticesFacesLeft TraverseRight Traverse NameStartEndLeftRightPredSuccPrecSucc cBD12baed
18
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics18 Voxels Grid of volumetric samples – CAT, MRI, etc.
19
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics19 Scene Graphs Polygon … Composite Translate Color Polygon … Composite Color Translate Composite Barbell Ends Barbell Bar Separator
20
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics20 Scene Graphs
21
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics21 Collapsing a Scene Graph It’s often possible to apply transformations in a scene graph once to the underlying vertices, collapsing some nodes. Example: Translation Rotation Polygon Collapse to
22
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics22 Cloning If part of a scene graph has two edges to it, it will be necessary to clone before collapsing Translation Rotation Polygon Translation Rotation Polygon Translation Rotation Polygon’
23
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics23 Integration of meshes with scene graphs Polygon … Composite Translate Color Polygon Mesh Color Translate Composite Barbell Ends Barbell Bar Separator Other possibilities?
24
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics24 Bounding Boxes Bounding boxes describe the X,Y,Z extents (minimum and maximum values). – If we know everything below a certain point in the scene graph is in a box, we can avoid traversal if the box is not on-screen
25
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics25 class CBBoxF { public: class CBBoxF() {}; class CBBoxF(const CGrPoint3F &p) : m_min(p), m_max(p) {} void Set(const CGrPoint3F &p) {m_min = p; m_max = p;} void Set(const CBBoxF &b) {m_min = b.m_min; m_max=b.m_max;} void Include(const CGrPoint3F &p); void Include(const CBBoxF &b) {Include(b.m_min); Include(b.m_max);} const CGrPoint3F &Max() const {return m_max;} const CGrPoint3F &Min() const {return m_min;} const float MinForD(int d) const {return m_min[d];} double Extent(int d) const {return m_max[d] - m_min[d];} private: CGrPoint3F m_min; CGrPoint3F m_max; };
26
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics26 Levels of Detail (lod) Alternative scene graphs with different resolutions – Varying tessellation – Which we use depends on how far away the camera is. – Significant performance enhancement
27
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics27 BSP Trees Binary Space Partitioning – Divides space into half-spaces – We can then use this method to limit how much scene graph we examine examine the scene graph in certain orders
28
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics28 k-d Trees k is dimensions Node – Info – x, y – lt-link – ge-link
29
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics29 Levels Level 0 – Index X – Level 1 – Index Y Level 2 – Index X level = 0 if root, level(parent)+1 otherwise For each level, index: level mod k 3D: Index X, Index Y, Index Z, Index X, etc…
30
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics30 Example Banja Luca (19, 45) Derventa (40, 50) Teslic (38, 38) Tuzla (54, 40) Sinj (4, 4) Banja Luca (19, 45) Derventa (40, 50) Teslic (38, 38) Tuzla (54, 40) Sinj (4, 4) X Y X Y Insert: East Broko (21, 57) Search for exact? Search for nearest? Range searches?
31
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics31 k-d Trees Search for exact – Okay, but may be o(k) Search for nearest – In a moment Range search?
32
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics32 Range Search Consider each tree level to be region Recursively search all regions that overlap search range
33
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics33 Example Regions Banja Luca (19, 45) Derventa (40, 50) Teslic (38, 38) Tuzla (54, 40) Sinj (4, 4) (-,+) (-,19) (-,+) [19,+) (-,+) [19,+) (-,50) [38,+) (-,50) East Broko (21, 57) [19,+) [50,+) Range: (10,20) (20, 45)
34
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics34 k-d Trees Fast and easy Tend to be rather tall (unbalanced) How could we extend to disk structure? What if k=1?
35
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics35 Quadtrees 2-d only Split data 4 ways Node: – info – x,y – nw,sw,ne,se
36
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics36 Example Banja Luca (19, 45) Derventa (40, 50) Teslic (38, 38) Tuzla (54, 40) Sinj (4, 4) Banja Luca (19, 45) Derventa (40, 50) Teslic (38, 38) Tuzla (54, 40) Sinj (4, 4) nesenw se Insert: East Broko (21, 57) Search for exact? Search for nearest? Range searches?
37
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics37 Octtrees 3-d Split data 8 ways Node: – info – x,y,z – up nw,sw,ne,se, down nw,sw,ne,se
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.