3D Graphics Rendering and Terrain Modeling
description
Transcript of 3D Graphics Rendering and Terrain Modeling
![Page 1: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/1.jpg)
3D Graphics Rendering and Terrain ModelingTechnology and Historical Overview
By Ricardo Veguilla
![Page 2: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/2.jpg)
Overview Introduction to 3D Computer
Graphics OpenGL SGI vs Linux 3D Animation Terrain Modeler: Project Status
![Page 3: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/3.jpg)
Introduction to 3d Computer Graphics 3D computer graphics is the
science, study, and method of projecting a mathematical representation of 3D objects onto a 2D image using visual tricks such as perspective and shading to simulate the eye's perception of those objects.
![Page 4: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/4.jpg)
3D Graphics and Physics 3D graphic software is largely
based on simulating physical interactions.
Generally: Space relations. Light interactions.
In particular cases: Material properties. Object Movement.
![Page 5: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/5.jpg)
Goals of 3D computers graphics Practical goal:
Visualization - to generate images (usually of recognizable subjects) that are useful in some way.
Ideal goal: Photorealism - to produce
images indistinguishable from photographs.
![Page 6: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/6.jpg)
Components of a 3D Graphic System 3D Modeling:
A way to describe the 3D world or scene, which is composed of mathematical representations of 3D objects called models.
3D Rendering: A mechanism responsible for
producing a 2D image from 3D models.
![Page 7: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/7.jpg)
3D Modeling Simple 3D objects can be modeled using
mathematical equations operating in the 3-dimensional Cartesian coordinate system.
Example:
the equation x2 + y2 + z2 = r2
is a model of a perfect sphere with radius r.
![Page 8: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/8.jpg)
Modeling considerations Pure mathematical equations to
represent 3D objects requires a great deal of computing power
Impractical for real-time applications such as games or interactive simulations.
![Page 9: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/9.jpg)
Alternatives: Polygon Models Modeling objects by sampling only
certain points on the object, retaining no data about the curvature in between
More efficient, but less detailed.
![Page 10: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/10.jpg)
Alternatives: Texture Mapping Technique used to
add surface color detail without increasing the complexity of a model.
An image is mapped to the surface of a model.
![Page 11: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/11.jpg)
From 3D models to 2D images A 3D world or scene is composed
of collection of 3d models Three different coordinates
systems (or spaces) are defined for different model related operations:Object SpaceWorld SpaceScreen Space
![Page 12: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/12.jpg)
Object Space The coordinate system in which a
specific 3D object is defined.
Each object usually have its own object space with the origin at the object's center
The object center is the point about which the object is moved and rotated.
![Page 13: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/13.jpg)
World Space World space is the coordinate
system of the 3D world to be rendered.
The position and orientation of all the models are defined relative to the center of the world space.
The position and orientation of the virtual camera is also defined relative to the world space.
![Page 14: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/14.jpg)
Screen Space 2D space that represents the
boundaries of the image to be produced.
Many optimization techniques are performed on screen space.
![Page 15: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/15.jpg)
Mathematics of 3D graphics 3D operations like translation,
rotation and scaling are performed using matrices and lineal algebra.
Each operation is performed by multiplying the 3D vertices by a specific transformation matrix.
![Page 16: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/16.jpg)
3D Rendering The process of taking the
mathematical model of the world and producing the output image.
The core of the rendering process involves projecting the 3D models onto a 2D image plane.
![Page 17: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/17.jpg)
Types of Rendering Algorithms Two general approaches:
Pixel-oriented rendering: Ray tracers
Polygon-oriented rendering: Scan-line renderers
![Page 18: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/18.jpg)
Ray tracers Operates by
tracing theoretical light rays as they intersect objects in the scene and the projection plane.
![Page 19: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/19.jpg)
Ray tracer limitations Processor intensive. A full ray
tracer is impractical for real-time applications.
Does not take into account inter-reflections of diffuse light, resulting in hard shadows.
![Page 20: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/20.jpg)
Radiosity Technique that models the inter-
reflections of diffuse light between surfaces of the world or environment.
Produces more photorealistic illumination and shadows.
![Page 21: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/21.jpg)
Scan-line renderers Operate on an object-by-object
basis, directly drawing each polygon to the screen.
Requires all objects – including those modeled with continuous curvature – to be tessellated into polygons.
Polygons are eventually tessellated into pixels.
![Page 22: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/22.jpg)
Illumination for scan-line renderers Lighting and shading is
calculated using the normal vector.
The color is linearly interpolated across the polygon surface.
![Page 23: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/23.jpg)
Common shading techniques scan-line rendererFlat shading
Gouraud Shading
Phong Shading
![Page 24: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/24.jpg)
Flat Shading The color of the polygon is
calculated at the center of the polygon by using the normal vector.
The complete polygon surface is uniformly lighted.
![Page 25: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/25.jpg)
Gouraud Shading A normal vector is calculated at
each vertex. Color is calculated for each
vertex and interpolated across the polygon
![Page 26: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/26.jpg)
Phong Shading The normal vectors are
interpolated across the surface of the polygon
The color of each point within the polygon is calculated from its corresponding normal vector
![Page 27: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/27.jpg)
Polygon shading techniques compared
![Page 28: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/28.jpg)
Viewing frustum Segment of the 3D world to be
rendered Objects outside the viewing
volume are ignored.
![Page 29: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/29.jpg)
Hidden surface determination Not all objects inside the viewing
frustum are always visible from the point of view of the camera.
Not all polygons of a particular object are visible from the point of view of the camera.
Common Techniques Painters Algorithm Z-Buffering
![Page 30: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/30.jpg)
Painter’s Algorithm Polygon-oriented. All the polygons are sorted by
their depth and then displayed in this order.
![Page 31: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/31.jpg)
Z-Buffering Pixel-oriented. When multiple objects
overlap (from the point of view of the camera) on a particular pixel, only the value of the pixel closest to the camera is used.
Implemented by saving the depth value of each displayed pixel in a buffer, and comparing the depth of each new overlapping pixel against the value in the buffer.
![Page 32: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/32.jpg)
Perspective Projection Projects the 3D world to a 2D
image
![Page 33: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/33.jpg)
The Open Graphics Language
![Page 34: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/34.jpg)
OpenGL – The Open Graphics Language De facto Application
Programming Interface (API) for cross-platform development of 3D graphics applications.
Implementations available for all major Operating Systems and hardware platforms.
Support for hardware accelerated 3D rendering.
Scalable, high-level, easy to use, well documented.
![Page 35: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/35.jpg)
History of OpenGL Originally released by SGI in the
early 90s. Descendant of IRIX GL. Previous 3D graphics APIs were
generally platform dependant. Born out of market pressure for a
cross-platform 3D API during the late 80s.
![Page 36: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/36.jpg)
OpenGL - Code Example How to define a triangle:
glBegin (GL_TRIANGLES); glVertex (0,0,0); glVertex (1,1,0); glVertex (2,0,0); glEnd ();
![Page 37: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/37.jpg)
Development with OpenGL OpenGL API designed only for
drawing images.
Auxiliary visual toolkits are required for developing OpenGL applications for modern windowed desktop environments.
Potential options: GLUT, SDL, GTK+
![Page 38: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/38.jpg)
Potential Auxiliary Toolkits GLUT: Specifically designed for
developing OpenGL demo applications.
SDL (Simple DirectMedia Layer): Library for multimedia and game development.
GTK+: General purpose toolkit for creating graphical user interfaces with OpenGL extensions available.
![Page 39: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/39.jpg)
SGI vs Linux
VS
![Page 40: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/40.jpg)
SGI vs Linux Linux is quickly becoming the
preferred OS for OpenGL and 3D computer graphics development.
Today Linux dominates one of SGI’s most controlled market: Movie Special Effects.
Why?
![Page 41: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/41.jpg)
SGI and Hollywood Special effects production
pipeline involves:
The graphic workstation – Used by the artists to create the models and textures used in the visual effects sequence.
The render-farm – A computer cluster dedicated for rendering the images or animations that form the visual effect sequence.
![Page 42: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/42.jpg)
SGI’s Market dominance SGI dominated the market of 3D graphics
solutions during the 80s and 90s.
SGI hardware provided excellent performance for rendering calculations combined with a fast video subsystem.
The computer special effects market was locked-in to SGI’s hardware.
Most of the 3D rendering software was developed for IRIX (SGI’s UNIX OS).
![Page 43: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/43.jpg)
SGI economics disadvantages SGI’s workstations are
expensive.
Historically FX houses purchased large amount of SGIs, which were amortized over several movies (usually 5 years).
![Page 44: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/44.jpg)
The rise of Lintel (Linux+Intel)Causes:
The development of Linux (an open source UNIX clone for the PC) during the 90s.
The continuous performance increase of the Intel CPUs.
The development of consumer-level 3D acceleration hardware for the PC driven by the growing video game market.
![Page 45: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/45.jpg)
Why the switch to Lintel? Lintel platform provides a higher
cost/performance ratio.
Linux is a POSIX complaint UNIX clone, porting the software from IRIX is trivial.
Linux is open-source and runs in multiple-architectures which greatly limits the possibility of vendor lock-in.
![Page 46: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/46.jpg)
Lintel economic benefits
Using Lintel, a large portion of the hardware costs can be recouped with every movie.
Buying a new render-farm for each new movie is economically viable.
![Page 47: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/47.jpg)
Not just for the render-farm Initially Linux was used for render-
farm.
Now it is used for the graphic workstation as well.
It is even displacing Apple computers as the standard platform for video/film editing and compositing.
![Page 48: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/48.jpg)
Results? Movies created using Lintel:
Titanic Star Wars Prequel Trilogy The Harry Potter Movies The Lord of the Rings Trilogy Shrek and Shrek 2 Practically every movie involving
special-effects made after the year 2000
![Page 49: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/49.jpg)
Lintel on other 3D graphics areas. The Lintel cost/performance also
benefits the academic/scientific applications of 3D computer graphics.
Heavily used in automotive and aeronautics industries for solid modeling and simulations.
![Page 50: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/50.jpg)
3D Animation
![Page 51: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/51.jpg)
Luxo Jr. The first film produced by Pixar
in 1986. It demonstrates the use of ray
tracing to simulate the shifting light and shadow given by the animated lamps as well as simple surface textures.
It was the first CGI film to be nominated for an Academy Award.
![Page 52: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/52.jpg)
Luxo Jr. Returns 16 years after the debut of Luxo Jr.,
Steve Jobs demonstrated the same animation running in real-time on a Apple G5 computer with an Nvidia Geforce 3 GPU (Graphics Processor Unit).
On 1985 - Rendering each frame of the original animation took 55 hours of processing on a Cray Supercomputer
On 2001 – Rendering each frame took 1/30 of a second on a personal computer
![Page 53: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/53.jpg)
Terrain ModelerProject Status
![Page 54: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/54.jpg)
Previously implemented features
Application developed in C and tested exclusively on SGI.
Terrain image loading tested with a 201x201 Matlab generated input file.
Terrain Modeling with OpenGL using points or unshaded polygons.
Fixed camera. Terrain rotation and scaling. Limited option for Level-of-detail
(LOD) rendering.
![Page 55: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/55.jpg)
Newly Implemented Features Support for Autotools for cross-
platform development (currently tested on SGI and Linux).
Code modularization and refactoring.
Full virtual camera. Memory Manager subsystem for
monitoring memory utilization. Preliminary Lighting support. Preliminary support for rendering
multiple terrains.
![Page 56: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/56.jpg)
Future Improvements Full windowed application. Support for screen captures. Support for Land-marking (3D
bookmarks) Support for animation scripting
and recording. Support for simultaneous
rendering of multiple terrains.
![Page 57: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/57.jpg)
Future Improvements (Cont.) Restructure code to accommodate
three module abstraction layers: IO Layer – Modules for reading and
writing terrain files of different formats. Sampling Layer – Modules implementing
different LOD algorithms with user-selected sampling value.
Rendering Layer – Modules for rendering the terrain using different OpenGL primitives, rendering attributes and vendor-optimized code paths.
![Page 58: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/58.jpg)
Long-term Porting the project to Jogl: Java
OpenGL
http://java.sun.com/products/jfc/tsc/articles/jcanyon/
![Page 59: 3D Graphics Rendering and Terrain Modeling](https://reader034.fdocuments.us/reader034/viewer/2022051518/56815c39550346895dca2df3/html5/thumbnails/59.jpg)
References: Wikipidia – The Free Encyclopedia
http://www.wikipedia.org/ OpenGL - The Industry Standard for High
Performance Graphics http://www.opengl.org/
Google Image Search http://images.google.com
Overview of 3D Interactive Graphics http://www.siggraph.org/project-grants/com97/
com97-tut.html Linux Journal - Industry of Change: Linux
Storms Hollywood http://www.linuxjournal.com/article/5472
JCanyon - Grand Canyon Demo http://java.sun.com/products/jfc/tsc/articles/jcanyon/