Download presentation
Presentation is loading. Please wait.
Published byOliver Norman Modified over 9 years ago
1
Week 11 - Thursday
2
What did we talk about last time? Image processing Blurring Edge detection Color correction Tone mapping Lens flare Bloom Depth of field Motion blur Fog
6
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
And ScanView tool to view the data
8
Models created by artists Moving based on motion capture http://science.discovery.com/video-topics/sci-fi- supernatural/james-cameron.htm http://science.discovery.com/video-topics/sci-fi- supernatural/james-cameron.htm
9
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
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(n 2 ) ear clipping algorithm
11
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
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
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
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
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
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
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 SharpDX) and OpenGL automatically render the vertices of every other triangle in opposite order to perform backface culling properly
18
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
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
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
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
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
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
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
26
Review for Exam 2
27
"Normal" office hours canceled today Finish Project 3 Due tonight by midnight! Review Chapters 5-10
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.