Download ACSC330 - Computer Graphics

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Molecular graphics wikipedia , lookup

Stereoscopy wikipedia , lookup

3D scanner wikipedia , lookup

Stereo display wikipedia , lookup

2.5D wikipedia , lookup

Ray tracing (graphics) wikipedia , lookup

Rendering (computer graphics) wikipedia , lookup

Transcript
ACSC330 - Computer Graphics
Chapter 5B – Viewing, 6 – Shading
Chapter 5B – Viewing
Hidden-Line and Hidden-Surface Elimination
i.e. Rendering
To determine those line segments or surface regions that are visible from a particular
viewing position and eliminate those that are ‘hidden’.
Image-Space Algorithms: For each pixel in display one determines which line segment or
surface section is visible (visibility is decided point by point at each pixel position on the
projection plane).
Object-Space Algorithms: For all surface sections (faces) one determines which hide which
others from the viewing point (compares objects and parts of objects to each other).
Hidden-Line Removal Algorithm – primarily for line drawings on vector displays
(normally use object-space method).
Hidden-Surface Removal Algorithm – primarily for surface drawings on raster displays
(normally use image-space method).
Also, Back-Face Removal
To improve performance for each method, account for:
- sorting (to facilitate depth comparisons)
- coherence (to take advantage of regularities in a scene)
(normally, a left-handed viewing system is used)
Other methods,
Depth-Buffer Method (z-buffer)
Scan-Line Method
Depth-Sorting Method or Painter’s Algorithm
Area-Subdivision Method
Franklin Algorithms
Comparison of Hidden-Surface Methods:
- if little overlap in depth – depth sorting method
- well separated horizontally surfaces – scan line or area subdivision
- only few surfaces – depth sorting method, scan line method
- greater than a few thousand surfaces – depth buffer method or octree approach
(divides regions of 3D space into octants and stores 8 data elements in each note)
Dr. Stephania Loizidou Himona – Chapter 6 - ACSC330 Computer Graphics
Chapter 6 – Shading
Up to now, the images look flat and thus fail to show the 3D nature of the model. That is,
each surface is lit such that it appears to a viewer in a single colour. E.g. a sphere is a
uniformly coloured circle, and a cube appears as a flat hexagon.
However, if you look at a photograph of a lit sphere, you see not a uniformly coloured
circle but rather a circular shape with many gradations or shapes of colour. It is these
gradations that give 2D images the appearance of being 3D.
That is, a shading model is used to calculate the intensity of light that we should see when
we view a surface. These intensity calculations are based on the optical properties of
surfaces, the relative positions of the surfaces, and the higher their orientations with respect
to light sources.
The intensity of light seen on each surface of an object depends on the type of light sources
in the vicinity and the surface characteristics of the object. Some objects have shiny
surfaces, and some have dull, or matte, surfaces. In addition, some objects are constructed
of opaque materials, while others are more or less transparent.
Also, you need some kind of interaction between light and the surfaces in our models.
Also,


Ray Tracing
Radiosity
Ray Tracing is a technique for generating an image by tracing the path of light through
pixels in an image space and simulating the effects of its encounters with virtual objects.
The technique is capable of producing a very high degree of visual realism, usually
higher than that of typical scanline rendering methods, but at a greater computational
cost. This makes ray tracing best suited for applications where the image can be rendered
slowly ahead of time, such as in still images and film and television special effects, and
more poorly suited for real-time applications like computer games where speed is critical.
Ray tracing is capable of simulating a wide variety of optical effects, such as reflection
and refraction, scattering, and chromatic aberration.
Radiosity is a global illumination algorithm used in 3D computer graphics rendering.
Radiosity is an application of the finite element method to solving the rendering equation
for scenes with purely diffuse surfaces.
2
Dr. Stephania Loizidou Himona – Chapter 6 - ACSC330 Computer Graphics
Light
A surface can either emit light by self-emission (e.g. light bulb, sun), or reflect light from
other surfaces that illuminate it (e.g. walls of the room). Some surfaces do both. The colour
that you see is determined by multiple interactions among light sources and reflective
surfaces, i.e. a recursive process. Mathematically, this recursive process results in an
integral equation, the rendering equation, used in finding the shading of all surfaces in the
scene. This equation cannot always be solved, therefore, there exist a number of
approximations such as radiosity and ray tracing.
Light sources
Light sources that illuminate an object are of two basic types, light-emitting sources and
light-reflecting sources.
2 independent parts of the problem:
1. model the light sources in the scene
2. build a reflection model that deals with the interactions between materials and light
Types of surfaces:
 Specular surfaces – shiny because most of the light that is reflected is
scattered in a narrow range of angles close to the angle of reflection, e.g.
mirrors.
 Diffuse surfaces – scatter light equally in all directions, appear the same to
all viewers, e.g. matt painted walls.
 Translucent surfaces – only some light is allowed to penetrate the surface,
refraction characterises glass and water.
The Phong Reflection Model
A good rendering technique under a variety of lighting conditions and material
properties, close approximation to physical reality.
It uses 4 vectors and supports 3 types of material-light interactions – ambient, diffuse and
specular.
Polygonal Shading: 3 ways to shade the polygons
Flat shading (all vectors are the same - constant)
glShadeModel(GL_FLAT);
Interpolative or Gouraud Shading
The normal at a vertex to be the normalised average of the normals of the
polygons that share the vertex
glShadeModel(GL_SMOOTH);
Phong Shading
Interpolate normals across each polygon
3
Dr. Stephania Loizidou Himona – Chapter 6 - ACSC330 Computer Graphics
Smoother renderings at significantly greater computational cost
Concluding Remark
A good graphics workstation can render a polygon scene using the Phong reflection
model and interpolatative shading in the same amount of time as it can render a scene
without shading.
Adding shading requires only setting parameters that describe the light sources and
materials.
Point source – dimensions of a light source are small compared to the size of an object
(e.g. sun)
Distributed light source – large, nearby source
Diffuse reflection from matte surfaces (surface roughness or graininess)
Specular reflection – highlights, or bright spots (shiny surfaces)
4