Project 4 Relief Map Fri, Oct 24, 2003 Due Fri, Oct 31, 2003.

Slides:



Advertisements
Similar presentations
1Computer Graphics Building Models John Shearer Culture Lab – space 2
Advertisements

COMP 175 | COMPUTER GRAPHICS Remco Chang1/6103b – Shapes Lecture 03b: Shapes COMP 175: Computer Graphics February 3, 2015.
CS 450: COMPUTER GRAPHICS FILLING POLYGONS SPRING 2015 DR. MICHAEL J. REALE.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Building Models modified by Ray Wisman Ed Angel Professor of Computer Science,
1 Building Models. 2 Objectives Introduce simple data structures for building polygonal models ­Vertex lists ­Edge lists OpenGL vertex arrays.
Efficient access to TIN Regular square grid TIN Efficient access to TIN Let q := (x, y) be a point. We want to estimate an elevation at a point q: 1. should.
Two measurements are used to describe locations around the world. Two measurements are used to describe locations around the world. Latitude: distance.
Ch- 7 Using Maps 1 K (What I know) W (Want to know) L (What I learned) Warm up- take out a piece of paper and do the “K” and the “W” for the above topic.
Latitude longitude review
Different types of maps and how to read them.
Geography Skills Vocab
Topographic Maps. Contour lines A line which connects points of equal elevation. Index Contours: Thick contour lines which have the elevation written.
Chapter 3 Models of Earth.
Chapter 2 - Maps. Latitude ► The earth is divided by east-west running lines of latitude. The zero degree line of latitude is the _________. There are.
Triangulation Introduction to Computer Graphics and Animation (Principle of Computer Graphics) Rattapoom Waranusast.
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 1 Shading (Shading) & Smooth Shading Graphics.
Geography Terms Review Slideshow Click once to see the definition. Click again to see the vocabulary term.
Object Representation Rama C Hoetzlein, 2010 Univ. of California Santa Barbara Lecture Notes.
Latitude and Longitude Lab # 1
September 8, 2011 Without using any resources( books or others) write as many states as you can on the map of the USA.
VOCABULARY AND DEFINITIONS Geography - Maps. Compass Rose Looks a bit like an arrow and shows the directions north, south, east, and west.
Mapping Our World Chapter 2. Latitude and Longitude Section 2.1.
Representation. Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames for.
Mapping/Minerals/metamorphic Review. Scale relates to actual distance. Topographic maps and satellite imagery are two- dimensional models that provide.
Mapping Finding your way with Latitude and Longitude Coordinate Sets.
Topographic Maps  Two-dimensional representation of a Three-dimensional surface.  Coordinate systems  Latitude/Longitude (spherical)  Universal Transverse.
Geography Skills Vocab. 1. Grid System Pattern formed as the lines of latitude and longitude cross one another. Used to determine location on the earth.
Project 5 Lamp Shader Fri, Nov 7, 2003 Due Mon, Nov 17, 2003.
Map Skills. Classwork Complete “Latitude and Longitude” worksheet. Continue working on your “Types of Communities” graphic organizer.
Latitude and Longitude. Relative Location Relative location is the proximity of a location in relation to another point of interest. It is about where.
Finding your way in the world. Latitude lines are imaginary lines that run EAST/WEST (horizontally) around the earth's surface. Think of latitude like.
Vertices, Edges and Faces By Jordan Diamond. Vertices In geometry, a vertices is a special kind of point which describes the corners or intersections.
Book Definition In your own words… Picture Latitude Distance in degrees north or south of the equator.
World Geography Skills Mr. Campione 6 th Grade Social Studies.
PARALLELS (LATITUDE) AND MERIDIANS (LONGITUDE)
Introduction to Meshes Lecture 22 Mon, Oct 20, 2003.
Computer Graphics I, Fall 2010 Building Models.
Textures – Basic Principles Lecture 29 Fri, Nov 14, 2003.
Creating a Topographic Map. Draw your topographic map using 20m contour intervals metersline through 20m. 1. Starting on the inside edge of the blank.
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
Maps Topographic Maps Latitude & Longitude Latitude & Longitude.
Tuesday, September 12 T: A: Warm Up: Introduce Texas Geography
Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009
NORTHINGS AND EASTINGS
Topographic Maps Two-dimensional representation of a Three-dimensional surface. Coordinate systems Latitude/Longitude (spherical) Universal Transverse.
Longitude & Latitude Grid Maps.
Topographic Maps Two-dimensional representation of a Three-dimensional surface. Coordinate systems Latitude/Longitude (spherical) Universal Transverse.
Latitude and Longitude
Section 1: Latitude and Longitude
Latitude and Longitude
Latitude and Longitude
Topographic Maps.
Latitude and Longitude
Building Models Ed Angel
Geography.
Section 1: Latitude and Longitude
Latitude and Longitude
Latitude and Longitude
Isaac Gang University of Mary Hardin-Baylor
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Introduction to Meshes
Map Components Title Grid Compass Rose Key or Legend Scale.
Elements of a Map.
Latitude and Longitude
NORTHINGS AND EASTINGS
Introduction to Meshes
Presentation transcript:

Project 4 Relief Map Fri, Oct 24, 2003 Due Fri, Oct 31, 2003

Relief Map Read the handout.handout Download the files. ReliefMap.cpp. ReliefMap.cpp point3.h. point3.h vector3.h. vector3.h ThePriest.topo. ThePriest.topo Run ReliefMap.exe.ReliefMap.exe

Relief Map The primary purpose of this project is to compute normals to a mesh so that the lighting models creates the right effects. A secondary purpose is to learn how to render the mesh.

The Grid The grid of terrain points extends from a beginning to an ending longitude and from a beginning to an ending latitude. Each grid point is represented by three coordinates, expressed in miles. x – the distance from the west edge. y – the elevation. z – the distance from the north edge.

The Grid You may render the grid as a grid of rectangles.

The Grid Or you may render it as a grid of triangles.

The Topo Structure The data from the file ThePriest.topo is read into a Topo structure. typedef struct { int lngCnt; int latCnt; Point3** pt; Vector3** norm; double min; double max; } Topo;

The Topo Structure lngCnt (“longitude count”) is the number of grid points in an east-west direction. latCnt (“latitude count”) is the number of grid points in a north-south direction. pt is a pointer to a 2-dimensional array of Point3 objects. norm is a pointer to 2-dimensional array of Vector3 objects. min and max are the minimum and maximum elevations in the file.

The Project Your job is to compute the normals at the grid points and to render the surface. This will involve writing parts or all of three functions setNormals() drawTerrain() computeNormal()

The setNormals() Function The setNormals() function should compute a unit normal for each grid point by calling on computeNormal(). The direction of the normal should represent the general slope of the land. The normals should be stored in the Topo structure as they are computed.

Computing Normals To compute normals, we consider three cases. Interior grid points – 4 neighbors. Edge grid points – 3 neighbors. Corner grid points – 2 neighbors.

Computing Interior Normals The four neighbors are north, south, east, and west. N S E W P

Computing Interior Normals We may form two vectors and take their cross product. N S E W P

Computing Edge Normals For edge points, use a similar method, but use the grid point itself as one of the four points. P W E S

Computing Edge Normals For edge points, use a similar method, but use the grid point itself as one of the four points. P W E S

Computing Corner Normals For corner points, again use a similar idea, but based on only three points. P S E

Computing Corner Normals For corner points, again use a similar idea, but based on only three points. P S E

Newell’s Algorithm The textbook, on page 292, discusses Newell’s Algorithm for computing a normal to a (possibly) non-planar polygon. It is based on the concept of the cross product, but it is more efficient. You may use Newell’s algorithm instead of computing cross products.

Newell’s Algorithm for Quadrilaterals Let the vertices be (x 0, y 0, z 0 ), (x 1, y 1, z 1 ), (x 2, y 2, z 2 ), (x 3, y 3, z 3 ). Then the normal v = (v x, v y, v z ) is computed as: v x = (y 0 – y 1 )(z 0 + z 1 ) + (y 1 – y 2 )(z 1 + z 2 ) + (y 2 – y 3 )(z 2 + z 3 ) + (y 3 – y 0 )(z 3 + z 0 ). v y = (z 0 – z 1 )(x 0 + x 1 ) + (z 1 – z 2 )(x 1 + x 2 ) + (z 2 – z 3 )(x 2 + x 3 ) + (z 3 – z 0 )(x 3 + x 0 ). v z = (x 0 – x 1 )(y 0 + y 1 ) + (x 1 – x 2 )(y 1 + y 2 ) + (x 2 – x 3 )(y 2 + y 3 ) + (x 3 – x 0 )(y 3 + y 0 ).

Newell’s Algorithm for Triangles Let the vertices be (x 0, y 0, z 0 ), (x 1, y 1, z 1 ), (x 2, y 2, z 2 ). Then the normal v = (v x, v y, v z ) is computed as: v x = (y 0 – y 1 )(z 0 + z 1 ) + (y 1 – y 2 )(z 1 + z 2 ) + (y 2 – y 0 )(z 2 + z 0 ). v y = (z 0 – z 1 )(x 0 + x 1 ) + (z 1 – z 2 )(x 1 + x 2 ) + (z 2 – z 0 )(x 2 + x 0 ). v z = (x 0 – x 1 )(y 0 + y 1 ) + (x 1 – x 2 )(y 1 + y 2 ) + (x 2 – x 0 )(y 2 + y 0 ).

Quadrilaterals vs. Triangles If you use Newell’s algorithm, you may write a separate function to deal with triangles. Or you may use the function designed for quadrilaterals by repeating the first point as the fourth point. The results will be the same.

The drawTerrain() Function The drawTerrain() function will draw render the grid with each polygon properly colored. To draw a vertex, we must first Color the vertex. Give it a normal vector.

The drawTerrain() Function This uses the functions glColor*(). glNormal*(). glBegin(GL_POLYGON); glColor3f(1.0, 0.0, 0.0);// Red glNormal3f(0.0, 1.0, 0.0);// Up glVertex3f(1.0, 2.0, 3.0);// Coordinates : glEnd();

The setColor() Function The setColor() function is provided, but you should understand how it works. The elevation of the point is compared to each elevation that was read from the file, starting with the smallest. As soon as a higher elevation is found, the corresponding color is set. If no higher elevation is found, then the last color is set.