Screen-projected error The error measures we have used earlier are all object-space errors. In 3D rendering the object space is transformed to screen space using a perspective transform. results in a Projecting the object space error, . screen space error, This error is different from object space error since objects far away seem smaller than objects close to the camera. This implies that objects far away are less significant. 1/9 Simple screen projection Pinhole camera model P w ρ δ λ e φ d p 2/9 Simple screen space error Perspective projection involves problems with singularities and can be computationally inefficient. Use simple euclidian distance, object instead. between the eye point and the The most simple error metric for projected screen space error can be written as is a screen resolution parameter defined by where is the number of pixels along the field of view, . Here, 3/9 Derivation of projection formula From our figure we see that Since we use euclidian distance,and not distance along the view direction, our projection formula is actually a projection onto a sphere, so 4/9 Hierarchical Triangulations We will now take a look at some hierarchical triangulation structures which are well suited for adaptive LOD rendering. Binary tree triangulation Progressive Meshes Hierarchical TIN’s 5/9 Binary Tree Triangulations Recursive splitting of one triangle into two new triangles. Level 0 Level 1 T1 T2 T3 1 1 2 Child triangles have same shape as parent. Level 3 Level 2 T5 T7 T8 T10 T13 T9 T14 T15 1 2 1 3 2 4 6 3 4 7 8 5 9 10 6 11 12 7 13 14 15 5 Linear storage (note indexing) T11 T12 T6 T4 Binary tree data structure 3 6/9 Binary Tree Triangulations A BTT can be refined locally without maintaining entire mesh in same resolution. 1 2 3 4 11 20 18 8 21 38 39 5 12 9 8 13 7 11 20 38 7 10 19 18 6 12 13 21 39 can do adaptive triangulations with variable level of detail. 7/9 Basic principles triangle are called (left), (right) and (apex). BTT based on longest edge bisection. The neighbor across the hypotenuse of is called the base neighbor, . Isosceles right triangle refined by bisecting hypotenuse. For the inserted vertex , we call the bisected edge the split edge, of . Split va The three vertices of a t The two triangles sharing are called the Diamond, of . vl e v vr tB Merge 8/9 Illegal Splitting Some rules must be observed when splitting triangles. If not, invalid triangulations and cracks in the mesh may occur (T-junctions). t3 t4 t1 t2 t3 t4 t2 t1 9/9 Legal Splitting When splitting a triangle we have three different cases: (2) t tB tB2 is one level finer than : Force split before splitting . t (3) tB level level 3. has no base neighbor (on a border): Trivial, split . 2. t and on same level (diamond): Split both triangles. 1. (1) 10/9 Recursive splitting In case (3) on previous slide we saw that the base was also illegal, so that we have to do neighbor of , two forced splits before we can split . Forced splits should be done recursively. 11/9 Another approach Peter Lindstrom has recently described a very elegant approach to mesh refinement. triangulation vertices. This approach does not use the binary tree structure directly, but instead emphasizes a Directed Asyclic Graph (DAG) of the 12/9 Vertex dependencies The mesh can be represented as a DAG of its vertices. A from to in the DAG corresponds to directed edge, a triangle bisection where is inserted on the hypotenuse. The arrows show parent−child relationships in the DAG of mesh vertices All non-leaf vertices have four children in the DAG and two parents. Boundary vertices have two children and one parent. 13/9 Valid triangulations For a given refinement if included in . of a mesh a vertex is active is valid if it is a continuous surface without T-junctions. to be valid it must satisfy the following property For where is the set of children of in the DAG. I.e for a vertex to be active, all its ancestors must be active. 14/9 Valid triangulations (2) One solution to enforcing the validity of a mesh is to use the DAG directly. Each time a vertex is activated, the chain of dependencies is followed and all ancestor vertices are activated. Inefficient in terms of computation and storage. Another approach: Nested errors 15/9 Error measures this becomes: For a split vertex, Remember the simple error measure of vertical distance from the reference mesh. 16/9 Nested errors otherwise leaf node We now define the nested vertex error as where is the actual geometric error for vertex . This clearly gives us the following important property 17/9 Simple refinement Calculate error measures, Using property (4) we can do a simple mesh refinement. for all nodes in the DAG. Define an error tolerance, . Traverse the graph and activate all vertices where , splitting triangles along the way. which is equivalent with a binary tree The mesh, triangulation is a valid mesh with max error less than . 18/9 Proof First note that enabling a vertex is equivalent with splitting a gives a triangle . Need to show that enabling all vertices where valid mesh. ) and we also have that Since (from eq. By definition so 19/9 View-dependent refinement The simple refinement method gives us a simplified mesh. However, this mesh is not well suited for real-time visualization because it has constant tolerance over the entire surface. For a given camera position, the tolerance of areas far away should be larger than the tolerance for vertices up close (or, conversely, errors should be smaller far away). We need to include the relationship between camera position and the vertices of the mesh. This is called View-dependent refinement 20/9 Nested screen-space errors As we have seen earlier the projected decreases error with distance to the projected object. Nested object space error does not imply nested screen space error! δ=0.6 δ=0.5 camera 21/9 Nested screen-space errors (2) Naive solution: Calculate projection of not only from but from all its descendants and let be the largest projected error. Impractical, since we need to visit all descendants of . Instead we use a bounding sphere of all the vertex positions of . We want 22/9 centered on : if is a leaf node for Then is then of The radius we define a sphere, For each vertex Nested bounding spheres otherwise , i.e the sphere hierarchy is nested. 23/9 Nested bounding spheres (2) p1 r3 p3 r1 p5 p2 r4 p4 r2 24/9 Nested screen error measure We now define the maximum projected error as , and is monotonic we must have for . Consequently, if is active, then so is its parent which is what we want. So we need to optimize our error function over the sphere for each vertex. This might seem heavy, but in fact it is very simple. Since 25/9 Maximum screen space error Remember our error projection function: For this equation the maximum occurs where is minimized. We assume that our viewpoint, is outside the and our maximum sphere. Then the minimum is screen space error becomes 26/9 View-dependent refinement We can now do view-dependent refinement of the mesh. Define a tolerance . and . For each node in the DAG, calculate Traverse the DAG and activate all vertices where or where is inside . 27/9 Grid mapping We can see that the vertices of our triangulation map directly to grid points in a regular, rectilinear grid. Well suited for height fields. We restrict the grid size to in each direction where is the (even) number of refinement levels. If we index the grid points linearly along the rows or columns we can always find the split vertex at index: 28/9 Grid index example , grid size = (4 refinement levels). 20 21 22 b a: 19 c 15 b: 14 a 10 c: 24 23 5 9 0 1 2 3 4 29/9 Algorithm: MeshRefine inw ) ) ) ) ine ic MeshRefine SubmeshRefine( SubmeshRefine( SubmeshRefine( SubmeshRefine( isw ise 30/9 Algorithm: SubmeshRefine ) SubmeshRefine( if [ and IsActive( ) ] then ) SubmeshRefine( ) SubmeshRefine( else ) DrawTriangle( endif 31/9 Algorithm: IsActive IsActive( ) getPoint( ) getError( ) getRadius( ) if [ ] then return true else return false endif 32/9 Improvements active For details, see Lindstrom’s article. The active check can be simplified to . where The mesh can be traversed and made into one continuous triangle strip in one step. 33/9 Summary The Lindstrom model is very simple, can be implemented in only a few code lines. Very fast due to its simplicity. Uses more triangles than necessary due to the regular structure of the mesh. No simple way to introduce irregular features, such as roads and rivers in a terrain model. 34/9