Presentation is loading. Please wait.

Presentation is loading. Please wait.

Week 12 - Thursday CS361.

Similar presentations


Presentation on theme: "Week 12 - Thursday CS361."— Presentation transcript:

1 Week 12 - Thursday CS361

2 Last time What did we talk about last time? Exam 2
Before that…Kevin Schlipper came to speak Before that…review Before that…image based techniques

3 Questions?

4 Project 4

5 Polygonal Techniques

6 Sources of 3D data As you know, just getting 3D data into a program is tricky There are a few standard ways Type in the data (cube examples) Generate the data procedurally Visualization of scientific (or other) data as spheres, cubes, or other primitives Modeling programs Sampling or scanning the real world Reconstruction from photographs Combinations!

7 Video of Scanning Michelangelo's David
And ScanView tool to view the data

8 Motion capture is huge now
Models created by artists Moving based on motion capture

9 Tessellation Surfaces often need to be tessellated, broken down into polygons The surfaces can be Convex polygons More complicated polygons 3D surfaces made out of complicated polygons

10 Triangulation For most graphics hardware, polygons must be triangulated into component triangles "Bowties" have to be converted into triangles, perhaps making a guess about what the modeler meant The literature contains many triangulation algorithms including the O(n2) ear clipping algorithm

11 Shading problems Data often arrives as quadrilateral meshes
How we break those into triangles can make a big visual difference, depending on vertex colors and texture mapping Sometimes no triangulation works for texture mapping It may be necessary to distort the texture to make it work

12 Splines A spline is a curve in space that is defined as a piecewise function Each piece of the curve is often a cubic function Usually the first and second derivatives of the functions are the same at points where they meet to keep them smooth Splines are a common tool for defining shapes in 2D and 3D Artists add control points with handles to change the slope of the curves

13 NURBS Non-uniform rational basis splines (NURBS) are a very general form of splines Many 3D modeling program represent surfaces as patches between these splines Rendering NURBS usually means turning these mathematically precise surfaces into triangles

14 Edge cracking and T-vertices
Turning the splines into polygons can cause two surfaces to have cracks between them, called edge cracking Edge stitching makes sure all vertices on a shared edge between surfaces are shared as well Shading is also an issue for T-vertices Triangles that share edges should share all the same vertices too

15 Consolidation After generating a polygon mesh, we may want to consolidate it in a few ways Merging finds shared vertices among faces Orientation makes sure that all polygons face the same direction This way, neighboring polygons would not be facing opposite ways from the perspective of culling operations It may be necessary to generate normals for each vertex based on the surface normals All the same as the surface for flat surfaces Interpolated normals on vertices for curving surfaces

16 Triangle fans In order to reuse data, we can break groups of triangles into fans, strips, and meshes A triangle fan has a center vertex shared by all triangles The data sent to the GPU is the center vertex, the second vertex of the first triangle, the third vertex of the first triangle, and then just one additional vertex per triangle

17 Triangle strips A triangle strip is similar to a triangle fan except that the triangles do not all share a common vertex As before, only a single new vertex is needed for each triangle after the first one Note that the clockwiseness of vertex order reverses for each triangle DirectX (and MonoGame) and OpenGL automatically render the vertices of every other triangle in opposite order to perform backface culling properly

18 Optimizing triangle strips
The previous example showed a sequential triangle strip Generalized triangle strips are more flexible, but we may need to send a vertex more than once or use some other special command, as in the following example There are algorithms designed to generate the smallest number of strips possible (though reaching the true optimal is NP-hard)

19 Triangle meshes For a closed surface, a mesh can be more efficient than either fans or strips For large closed meshes, on average, each vertex is connected to six triangles Consequently, we may only need to store as little as 0.5 vertices per triangle More importantly, we only have to do lighting calculations once for each vertex To get these advantages, our system has to have a good caching algorithm (and cache size) so that a lit, transformed vertex is still in cache the next time we need it

20 Vertex buffers By now, you're used to vertex buffers
They are a generic way to store model data in a contiguous chunk of memory The memory could be: A list of points A list of line segments A polyline A triangle list A triangle fan A triangle strip The size of a vertex is called the stride If you do not want to repeat information in the vertex buffer, you can use an index buffer to specify which vertices from the vertex buffer to use

21 Simplification Mesh simplification is a way of reducing polygon count while preserving appearance Three common kinds: Static – make several models of different complexity and choose the right one Dynamic – generate models on the fly, allowing for a continuous spectrum of level of detail (LOD) View-dependent – change based on the particular view

22 Dynamic simplification
Use edge collapses Merge two vertices into one There are different strategies for determining which edge to collapse, but we usually look for a "low cost" edge There are different strategies for determining cost… Some edges should not be collapsed If it causes a surface's normal to flip If it causes edges to cross

23 View dependent simplification
Terrain is highly view dependent Close things need a lot of detail Distant mountains may not Some techniques are just dynamic simplification applied based on distance from the viewer Others break the terrain into tiles or other divisions Some features of a terrain heightfield require more detail to look realistic Special edges may be added in after the fact to connect low detail tiles to high detail tiles

24 Subdivision We're mostly skipping Chapter 13
It's about curves and curved surfaces One of its focuses is subdividing simple meshes into more complex ones There are many techniques to do so Shapes get smoother and blobbier There are ways to specify that some edges should remain

25 Quiz

26 Upcoming

27 Next time… Bounding volumes and intersection tests

28 Reminders Read Chapter 16 No class on Monday!


Download ppt "Week 12 - Thursday CS361."

Similar presentations


Ads by Google