cse 872 dr. charles b. owen advanced computer graphics1 polygon meshes and other modeling tools...
TRANSCRIPT
![Page 1: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/1.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics1
Polygon Meshes and other modeling tools• Object representation• Polygon meshes• Normals• Scene graphs• Level of detail• Space partitioning
![Page 2: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/2.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics2
How can we represent objects/scenes• Polygon meshes• Scene graphs• Parametric representations• Equations• Bunch o points
![Page 3: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/3.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics3
Why?• Rendering• Manipulate
– User– System
![Page 4: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/4.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics4
Point Clouds
• Unstructured set of 3D point samples– Why– What for?
![Page 5: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/5.jpg)
CSE 872 Dr. Charles B. OwenAdvanced 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; };
![Page 6: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/6.jpg)
CSE 872 Dr. Charles B. OwenAdvanced 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
![Page 7: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/7.jpg)
CSE 872 Dr. Charles B. OwenAdvanced 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
![Page 8: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/8.jpg)
CSE 872 Dr. Charles B. OwenAdvanced 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<CGrPoint3F> &Vertices() const {return m_vertices;} const std::vector<CGrPoint3F> &Normals() const {return m_normals;} const std::vector<CGrPoint2F> &TVertices() const {return m_tvertices;}
const std::vector<Triangle> &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<CGrPoint3F> m_vertices; std::vector<CGrPoint3F> m_normals; std::vector<CGrPoint2F> m_tvertices;
std::vector<Triangle> m_triangles;};
![Page 9: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/9.jpg)
CSE 872 Dr. Charles B. OwenAdvanced 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
![Page 10: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/10.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics10
Computing a surface normal
• Assume the following polygon:
p1
p2
p3
p4
)()(
)()(
1412
1412
pppp
ppppN
N
![Page 11: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/11.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics11
The Method of Projected Areas
• Assume this 2D example line:
p1
p2
x
y
xy
xyN
,
,
Projection of lengthto one axis
![Page 12: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/12.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics12
Method of Projected Areas
• The projection of the area onto the x/y plane is the z part of the normal
zyx
zyx
nii
n
iniiz
nii
n
iniiy
nii
n
iniix
NNN
NNNN
yyxxN
xxzzN
zzyyN
,,
,,
))((
))((
))((
)1%(1
)1%(
)1%(1
)1%(
)1%(1
)1%(
![Page 13: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/13.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics13
Where does this come from?
zyx
zyx
nii
n
iniiz
nii
n
iniiy
nii
n
iniix
NNN
NNNN
yyxxN
xxzzN
zzyyN
,,
,,
))((
))((
))((
)1%(1
)1%(
)1%(1
)1%(
)1%(1
)1%(
x
y
Why would we want to use this?
![Page 14: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/14.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics14
Vertex normals
• Add normals for surfaces incident on vertex:
![Page 15: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/15.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics15
The Winged-Edge Data Structure
• Maintains– List of vertices– List of edges– List of faces
![Page 16: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/16.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics16
Winged-Edge Data Structure
Vertex Incident Edge
A a
B b
C e
D a
Face Incident Edge
1 a
2 c
3 e
4 b
Vertex table:
Face table:
![Page 17: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/17.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics17
Edge Table
a
c
e
b d
1 2
B
D
Edge Vertices Faces Left Traverse Right Traverse
Name Start End Left Right Pred Succ Prec Succ
c B D 1 2 b a e d
![Page 18: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/18.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics18
Voxels
• Grid of volumetric samples– CAT, MRI, etc.
![Page 19: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/19.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics19
Scene Graphs
PolygonPolygon PolygonPolygon…
CompositeComposite
TranslateTranslate
ColorColor
PolygonPolygon PolygonPolygon…
CompositeComposite
ColorColor
TranslateTranslateTranslateTranslate
CompositeComposite
BarbellEnds
BarbellBar
SeparatorSeparator SeparatorSeparator SeparatorSeparator
![Page 20: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/20.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics20
Scene Graphs
![Page 21: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/21.jpg)
CSE 872 Dr. Charles B. OwenAdvanced 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:
TranslationTranslation
RotationRotation
PolygonPolygon
PolygonPolygonCollapse to
![Page 22: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/22.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics22
Cloning
• If part of a scene graph has two edges to it, it will be necessary to clone before collapsing
TranslationTranslation
RotationRotation
PolygonPolygon
TranslationTranslation
RotationRotation
PolygonPolygon
TranslationTranslation
RotationRotation
Polygon’Polygon’
![Page 23: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/23.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics23
Integration of mesheswith scene graphs
PolygonPolygon PolygonPolygon…
CompositeComposite
TranslateTranslate
ColorColor
Polygon MeshPolygon Mesh
ColorColor
TranslateTranslateTranslateTranslate
CompositeComposite
BarbellEnds
BarbellBar
SeparatorSeparator SeparatorSeparator SeparatorSeparator
Other possibilities?
![Page 24: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/24.jpg)
CSE 872 Dr. Charles B. OwenAdvanced 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
![Page 25: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/25.jpg)
CSE 872 Dr. Charles B. OwenAdvanced 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;};
![Page 26: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/26.jpg)
CSE 872 Dr. Charles B. OwenAdvanced 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
![Page 27: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/27.jpg)
CSE 872 Dr. Charles B. OwenAdvanced 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
![Page 28: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/28.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics28
k-d Trees
• k is dimensions• Node
– Info– x, y– lt-link– ge-link
![Page 29: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/29.jpg)
CSE 872 Dr. Charles B. OwenAdvanced 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…
![Page 30: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/30.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics30
Example
• Banja Luca (19, 45)• Derventa (40, 50)• Teslic (38, 38)• Tuzla (54, 40)• Sinj (4, 4)
Banja Luca (19, 45)Banja Luca (19, 45)
Derventa (40, 50)Derventa (40, 50)
Teslic (38, 38)Teslic (38, 38)
Tuzla (54, 40)Tuzla (54, 40)
Sinj (4, 4)Sinj (4, 4)
X
Y
X
Y
Insert: East Broko (21, 57)Search for exact?Search for nearest?Range searches?
![Page 31: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/31.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics31
k-d Trees
• Search for exact– Okay, but may be o(k)
• Search for nearest– In a moment
• Range search?
![Page 32: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/32.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics32
Range Search
• Consider each tree level to be region• Recursively search all regions that overlap search
range
![Page 33: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/33.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics33
Example Regions
Banja Luca (19, 45)Banja Luca (19, 45)
Derventa (40, 50)Derventa (40, 50)
Teslic (38, 38)Teslic (38, 38)
Tuzla (54, 40)Tuzla (54, 40)
Sinj (4, 4)Sinj (4, 4)
(-,+) (-,+)
(-,19) (-,+) [19,+) (-,+)
[19,+) (-,50)
[38,+) (-,50)
East Broko (21, 57)East Broko (21, 57)
[19,+) [50,+)
Range: (10,20) (20, 45)
![Page 34: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/34.jpg)
CSE 872 Dr. Charles B. OwenAdvanced 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?
![Page 35: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/35.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics35
Quadtrees
• 2-d only• Split data 4 ways• Node:
– info– x,y– nw,sw,ne,se
![Page 36: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/36.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics36
Example
• Banja Luca (19, 45)
• Derventa (40, 50)
• Teslic (38, 38)
• Tuzla (54, 40)
• Sinj (4, 4)
Banja Luca (19, 45)Banja Luca (19, 45)
Derventa (40, 50)Derventa (40, 50)
Teslic (38, 38)Teslic (38, 38)
Tuzla (54, 40)Tuzla (54, 40)
Sinj (4, 4)Sinj (4, 4)
ne senw
se
Insert: East Broko (21, 57)Search for exact?Search for nearest?Range searches?
![Page 37: CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Polygon Meshes and other modeling tools Object representation Polygon meshes Normals Scene graphs](https://reader036.vdocuments.us/reader036/viewer/2022062309/56649e2b5503460f94b18eb1/html5/thumbnails/37.jpg)
CSE 872 Dr. Charles B. OwenAdvanced Computer Graphics37
Octtrees
• 3-d• Split data 8 ways• Node:
– info– x,y,z– up nw,sw,ne,se, down nw,sw,ne,se