Download presentation
Presentation is loading. Please wait.
Published byIris May Modified over 6 years ago
1
Terrain Sampled height-field 2D or 3D Shading Segmentation Smoothing
Iso-contours Project 2: Color ground and lakes
2
2D or 3D visualization? Regular (x,y) grid, a scalar value (Z[x,y]) per sample View as an image: map Z to color View as height-field (map Z to height, and color) Discuss Pros & Cons of each
3
Shading Color (hue…) depends on scalar value (height)
Non-linear mapping that helps interpretation Intensity of reflected light depends on surface normal Typically computed from a triangulation of the quad
4
Shading quads Z[x,y] (x,y) (x+1,y)
5
Segmentation Split terrain into distinct regions.
How are regions defined? computed? visualized? Examples of regions Height spans Normalize to total height range Divide into spans (Number? Uniform?) Assign color to each (snowy tops, green valleys) Vary intensity or color ramp within each interval By slope Use different color for steep parts (grey cliffs) By curvature Concave, convex, saddle Expected benefits of segmentation? Possible drawbacks of segmentation?
6
Slope How to compute slope? C Map slope-to-color? B A Z[x,y] (x,y)
Split each quad into 2 or 4 triangles Compute slope for each triangle Map each slope to a color Map slope-to-color? C B A Z[x,y] (x,y)
7
Curvature Classify each sample How? How to shade the surface? Concave
Convex Neither How? How to shade the surface?
8
Smoothing Predict each height value C” from its neighbors.
Use average of cubic predictions in x and in y Compute vector L2 towards predicted value Move each height towards its predicted value Repeat How to identify outliers? Acquisition errors How to correct them?
9
Smoothing code vec cubic (pt A, pt B, pt C, pt D, pt E) {return(new vec( (-A.x+4*B.x-6*C.x+4*D.x-E.x)/6, (-A.y+4*B.y-6*C.y+4*D.y-E.y)/6, (-A.z+4*B.z-6*C.z+4*D.z-E.z)/6 ));} vec cubicFitX(int i, int j) { return(cubic(G[i-2][j], G[i-1][j],G[i][j],G[i+1][j],G[i+2][j] ));} vec cubicFitY(int i, int j) { return(cubic(G[i][j-2], G[i][j-1],G[i][j],G[i][j+1],G[i] [j+2] ));} void XYcubicFilter() { for(int k=0; k<20; k++) { for (int i=2; i<n-2; i++) for (int j=2; j<n-2; j++) L[i][j]=average(cubicFitX(i,j),cubicFitY(i,j)); for (int i=2; i<n-2; i++) for (int j=2; j<n-2; j++) G[i][j].addScaledVec(0.5,L[i][j]); }; }
10
Subdivision Double the resolution:
Subdivide in x (as discussed in earlier lecture) Subdivide in y Repeat if desired
11
Iso-contours Ch = All points of a given height h (green curves)
Closed loops (unless clipped by border of domain) Iso-contours may be nested
12
Vertices of an iso-contour Ch
A vertex is height if its height > h, and low otherwise An edge joining high & low vertices is a stick How to estimate the point where Ch crosses the stick? What assumption are we making? z=h A B d 1 z=h A B d 1
13
Loops of an iso-contour Ch
Loop over all edges If you find an unmarked stick trace its loop marking all sticks that the loop crosses How to trace a loop? What if the loop hits the border? pad domain with a very low border
14
How to order loops? How to test whether whether a point is inside a loop? How to test whether a loop is inside a loop?
15
Smoothing iso-contours loops
Deform iso-contour in 2D without crossing any grid sample Constrain vertex to stay on its stick
16
Spill-over points, lake boundaries
What is a lake? How to identify spill-over points? How to define, represent, compute the surfaces of the lakes?
17
A lake may have islands How to identify island borders?
How to render such a lake?
18
Project 2: Ground color and lakes
Start with the terrain viewer code provided Compute color-coding that distinguishes low (green), high (white), intermediate (brown), steep (grey). Assign suitable color ramps to each based on height and argue why they are good. Draw some 20 iso-contours using width 3 red curves Identify all lakes and render their surface (flat) in semi-transparent blue color Deliver: Viewer: applet, instructions, source code Report: 2 pages with images and references Explain, justify, evaluate your solution for the color ramps and for the lake boundaries
19
Different visualizations
20
Questions Pros & const of 3D vs 2D terrain visualization
Pros & cons of segmentation How to perform smoothing on a terrain data How to identify and correct outliers How to compute the vertices of an iso-contour How to trace the loops of an iso-contour How to identify saddle points and spill-over points
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.