35
BOWEN UNIVERSITY, ` IW ´ O, ` O . SUN-STATE DEPARTMENT OF COMPUTER SCIENCE MODULE 3: UNIT 1 Geometric Representation 0.1 Introduction Modelling means forming a mathematical representation of the world, the output of the modelling process might be a representation of anything from an object’s shape, to the trajectory (path) of an object through space (Cartesian space, x and y coordinates). Points are important because they form the basic building blocks for representing models in Computer Graphics. We can connect points with lines, or curves, to form 2D shapes or trajectories. Or we can connect 3D points with lines, curves or even surfaces in 3D. Geometric modelling is a branch of applied mathematics and computational geometry that studies methods and algorithms for the mathematical description of shapes. It is the process of constructing a complete mathematical description to model a physical entity or system. 0.2 Geometric modeling Geometric modelling refers to a set of techniques concerned mainly with developing effi- cient representations of geometric aspects of a design, it is a branch of applied mathemat- ics and computational geometry that studies methods and algorithms for the mathemat- 1

BOWEN UNIVERSITY, IWO, O . SUN-STATE Geometric …

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

BOWEN UNIVERSITY, IWO, O. SUN-STATE

DEPARTMENT OF COMPUTER SCIENCE

MODULE 3: UNIT 1

Geometric Representation

0.1 Introduction

Modelling means forming a mathematical representation of the world, the output of the

modelling process might be a representation of anything from an object’s shape, to the

trajectory (path) of an object through space (Cartesian space, x and y coordinates).

Points are important because they form the basic building blocks for representing models

in Computer Graphics. We can connect points with lines, or curves, to form 2D shapes

or trajectories. Or we can connect 3D points with lines, curves or even surfaces in 3D.

Geometric modelling is a branch of applied mathematics and computational geometry

that studies methods and algorithms for the mathematical description of shapes. It is the

process of constructing a complete mathematical description to model a physical entity

or system.

0.2 Geometric modeling

Geometric modelling refers to a set of techniques concerned mainly with developing effi-

cient representations of geometric aspects of a design, it is a branch of applied mathemat-

ics and computational geometry that studies methods and algorithms for the mathemat-

1

ical description of shapes. Geometric modelling is also a collection of methods used to

define the shape and other geometric characteristics of an object, it is used to construct a

precise mathematical description of the shape of a real object or to simulate some process.

Geometric Modeling is the field that discusses the mathematical methods behind the

modeling of realistic objects for computer graphics and computer aided design. The field

was initially developed in the mid- 1970s and has evolved as the speed and memory of

computer systems has advanced. Geometric modelling approaches are;

i. Two-Dimensional (2D) models

ii. Three-Dimensional (3D) models

The shapes studied in geometric modeling are mostly two or three dimensional, al-

though many of its tools and principles can be applied to sets of any finite dimension.

Today most geometric modeling is done with computers and for computer- based appli-

cations. Two- dimensional models are important in computer typography and technical

drawing. Three-dimensional models are central to computer aided design and manufac-

turing(CAD/CAM), and widely used in many applied technical fields such as civil and

mechanical engineering, architecture, geology and medical image processing.

A 2D geometric model is a geometric model of an object as a two- dimensional figure,

usually on the Cartesian plane. 2D figures usually have length and breadth, and they

are they are located on the x and y axis of the Cartesian plane. It is often necessary for

representing 3D images on a flat surface. It is also adequate for certain flat objects like

paper cut-outs and machine parts made of sheet metal. 2D geometric models are also

convenient for describing certain kinds of artificial images, such as technical diagrams,

logos, etc. A 3D geometric model is the process of developing a mathematical represen-

tation of any three-dimensional surface of an object via specialized software. It can be

displayed as a two-dimensional image through a process called 3D rendering.

Geometric models explicitly represent the shape and structure of an object, and from

these, one can deduce what features will be seen from any particular viewpoint and where

2

they are expected to be and to determine under what circumstances a particular image

relationship is consistent with the model.

0.3 Geometric Modelling Scheme/Techniques

There are three geometric modelling scheme which includes;

a. Wireframe model: In this scheme, the shape of the object is defined by a collection

of points (vertices) and a set of edges(line or curved connects pair of points). The

disadvantage of wire frame model is that it is ambiguous, it is a complex model that

is difficult to interpret but the advantages are that it is easy to construct, It is most

economical in term of time and memory requirement and it is used to model solid

object. A diagram is as shown in Figure 1.

Figure 1: Wireframe model

b. Surface Model: It is an area within which every position is defined by mathematical

method. Surface may be Planar, Cylindrical/conic and Sculptured or free-form in

shape. It is used to overcome ambiguity in wire-frame model. A diagram is as shown

in Figure 2.

c. Solid Model: The solid modelling technique is based upon the ‘half-space’ (by

specifying different boundary surface) concept. It is the most complex of all geo-

metric modelling techniques and it offers unambiguous description. A solid model is

3

Figure 2: Surface Model

appropriate for the world of engineering objects, it offers a complete representation

of an object.

0.4 Lines and Curves

Space curves are nothing more than trajectories through space; e.g. in 2D or 3D. A line

is also a space curve. A line is simply the distance between two points, a line can also

be called a curve in some areas e.g. space curve. In general we can represent a 2D space

curve using y = f(x). An abstract definition of this is f(x) = mx + c. But we cannot

represent all space curves in the form y = f(x). Specifically, we cannot represent curves

that cross a line x = a, where a is a constant more than once.

A curve is similar to a line, but it does not have to be straight. An open curve has

beginning and end points that are different, while a closed curve joins up so there are no

end points. E.g. circle, square. A space curves consists of both lines and curves.

0.5 Explicit, Parametric and Implicit Forms

Geometric modeling is often classified into Implicit, Explicit and Parametric methods.

4

0.5.1 Implicit Forms

This is a continuous mathematical representation of an attribute across a volume. It has

an infinitely fine resolution. The model is a mathematical function in terms of x, y and

z.

The generic function of this is:

x2 + y2 − r2 = 0 (1)

The implicit form is very useful when we need to know if a given point (x, y) is on a

line, or we need to know how far or on which side of a line that point lies. This is useful

in Computer Games application e.g. ‘clipping’ when we need to determine whether a

player is on one side of a wall or another, or if they have walked into a wall (i.e. collision

detection). The other forms cannot be used to determine this easily. It is more complex

than the explicit.

0.5.2 Explicit Forms

The generic format is y = f(x). Here, a variable on the left is expressed in terms as

another variable on the right hand side of the equation. Explicit functions are single

valued. It provides coordinate in one dimension (here, y) in terms of the others (here, x).

It is limited in the variety of curves in can represent. The explicit form is useful when we

need to know one coordinate of a curve in terms of others. This is less commonly useful.

0.5.3 Parametric Forms

:

This is useful when we want to model a line in our Computer Graphics system. The

components of the output are based on some parameter. The Generic format is x = Fx(t),

y = Fy(t). t represents ‘time’.

The parametric form is:

5

p(s) = x0 + sx1 (2)

Here, vector x0 indicates the start point of the line, and x1 a vector in the positive

direction of the line. The dummy s was introduces as a mechanism for iterating along

the line; given an s, we obtain a point p(s) some distance along the line. When s = 0,

we are at the start of the line. Positive values of s moves us forward along the line and

negative values of s move us backward. p(0) is used to denote the start of a space curve,

and p(1) to denote the end of the point of the curve.

In mathematics, parametric equations of a curve express the coordinates of the points

of the curve express the coordinates of the points of the curve as functions of a variable,

called a parameter. E.g. x = cost, y = sint are parametric equations for the unit circle,

where t is the parameter. Together these equations are called parametric equations of

the curve. The notion of parametric equation has been generalized to surfaces, manifolds,

and algebraic varieties of higher dimension, with the number of equations being equal to

the dimension of the manifold or variety, and the number of equations being equal to the

dimensions of the manifold or variety is considered.

The parametric form allows us to easily iterate along the path of a space curve, this

is useful in a very wide range of applications e.g. ray tracing or modeling of object

trajectories. It is difficult to hard to iterate along space curves using the other two forms.

The parameter typically is designated t, because often the parametric equations represent

a physical process in time.

0.6 Parametric Space Curves

Parametric Space Curve is the most common form of curve in Computer Graphics. This

is because:

a. They generalize to any dimension: the x1 can be vectors in 2D, 3D, etc.

b. We usually need to iterate along the shape boundaries or trajectories modeled by such

6

curves. It is also trivial to differentiate curves in this form with respect to s, and so

obtain tangents to the curve or even higher order derivatives.

Therefore we can model complex shape by breaking it up into simpler curves and

fitting each of these in turn. For example, suppose we want to model the outline of a

teapot in 2D, we could attempt to do so using a parametric cubic curve, but the curve

will need to turn several times to produce the complex outline of the teapot, implying a

very high order curve. Such a curve could be of order n = 20 or more, requiring the same

number of xi vectors to control its shape (representing position, velocity, acceleration ,

rate of change of acceleration, rate of change of the rate of change of acceleration and

so on). We can see that such a curve is very difficult to control (or fit) to the required

shape, and in practice, using such curves is manageable; we tend to over-fit the curve. The

result is actually that the curve approximates the correct shape, but undulates (moving

in a wavelike motion or wobbles) along that path. The Cubic curves gives a compromise

between case of control and expressiveness of shape:

p(s) = x0 + sx1 + s2x2 + s3x3 (3)

0.6.1 Basics of Scientific Modelling

a. Modelling as a substitute for direct measurement and experimentation

Models are typical used when it is either impossible or impractical to create experimen-

tal conditions in which scientist can directly measure outcomes. Direct measurement

of outcomes under controlled conditions will always be more liable than modelled

estimates of outcomes.

b. Simulation

A simulation is the implementation of a model. A stead state simulation provides

information about the system at a specific instant in time. A dynamic simulation

provides information over time. It is used for testing, analysis or training in cases

where real world can be represented in models.

7

c. Structure

Structure is a fundamental and sometimes intangible notion covering the recognition,

observation, nature and stability of patterns and relationships of entities i.e. the

concept of structuring is an essential foundation of nearly every mode of inquiry and

discovery in science, philosophy and art.

d. System

A system is a set of interacting or interdependent entities, real or abstract, forming an

integrated whole. In general, a system is a construct or collection of different elements

that together can produce results not attainable by the elements alone.

e. Generating a model

Modelling refers to the process of generating a model as a conceptual representation

of some phenomenon.

f. Evaluating a model

A model is evaluated first and foremost by its consistency to data; any model in-

consistent with reproducible observations must be modified or rejected. Some factors

important in evaluating a model;

i. Ability to explain past observations

ii. Ability to predict future observations

iii. Cost of use, especially in combination with other models

g. Visualization

This is any technique for creating images, diagrams or animations to communicate a

message.

Types of Scientific Models

There are various types of scientific models like;

8

i. Analogical modelling

ii. Assembly modelling

iii. Climate modelling

iv. Micro-scale modelling

Application of Scientific Models

i. Modelling and Simulation

ii. Model Based learning in Education: This involves students creating models for sci-

entific concepts in order to gain insight of the scientific ideas.

Examples of Scientific Models

i. The wave model of light

ii. Atomic modes

iii. Periodic tables

Uses of Scientific Models

i. Used to provide ways of explaining complex data

ii. Used for predicting what might happen

0.7 Solid Modelling

Solid modeling is a consistent set of principles for mathematical and computer modeling of

3 dimensional solids. Solid modeling is based more on physical fidelity. In solid modeling

objects can be viewed from any angle. The use of solid modeling techniques allows for

automation of several difficult engineering calculations that are carried out as a part of the

design process. Solid modeling technique serve as the foundation for rapid prototyping,

9

digital archival and reverse engineering by reconstructing solids from sampled points on

physical objects, mechanical analysis using finite elements, motion planning, kinematics

and dynamic analysis of mechanisms, and so on.

Solid modeling research and development has effectively addressed many of these

issues, and continues to be a central focus of computer aided engineering.

0.8 Simulation

Simulation can be referred as a process of running a model. It is defined as the use of

a computer to represent dynamic responses of a system by the behavior of the system

modelled after it. It uses mathematical description (or model) of a real life system and

then convert it into a computer program. The models contain equations that is identical

to the functional relationships within the real system. The program run is converted from

the resulting mathematical dynamics form to an analog form of the real system; which

the results given takes the form of data.

A simulation can take the form of a computer graphic image that represents dynamic

processes in an animated order. They are used to study the response to conditions

that cannot be easily applied in real life situations. Mathematical equations could be

used to adjust the model using certain variables. Simulations are useful in allowing the

observers measure and predict the functionality of a system may be affected by altering

the individual components within the system. Simulations are done on both business and

geometric models respectively. Geometric model is used for numerous applications that

requires simple mathematical modelling objects e.g. building, the molecular structure of

chemicals etc. A more advanced simulation like the emulation of weather patterns; is

usually performed using a powerful workstation or mainframe computers.

2D graphics models may combine geometric models (also called vector graphics), dig-

ital images (also called raster graphics), text to be typeset (defined by content, font style

and size, color, position, and orientation), mathematical functions and equations, and

more. These components can be modified and manipulated by two-dimensional geomet-

10

ric transformations such as translation, rotation, scaling. In object-oriented graphics,

the image is described indirectly by an object endowed with a self-rendering method a

procedure which assigns colors to the image pixels by an arbitrary algorithm. Complex

models can be built by combining simpler objects, in the paradigms of object-oriented

programming.

0.9 Applications of Geometric modelling

a. Computer Aided Design/ engineering (CAD/CAE)

b. Entertainment: Special effects, Animation, games.

c. Scientific Visualization

d. Education, Information and advertising.

11

MODULE 3: UNIT 2

Surfaces

0.10 Introduction

A surface is the outer or topmost boundary of an object. In mathematics, specifically, in

topology, a surface is a two-dimensional, topological manifold. The most familiar exam-

ples are those that arise as the boundaries of solid objects in ordinary three-dimensional

Euclidean space R3, such as a sphere. On the other hand, there are surfaces, such as

the Klein bottle, that cannot be embedded in three-dimensional Euclidean space without

introducing singularities or self-intersections.

To say that a surface is ‘two-dimensional’ means that, about each point, there is a

coordinate patch on which a two-dimensional coordinate system is defined. For example,

the surface of the Earth is (ideally) a two-dimensional sphere, and latitude and longi-

tude provide two-dimensional coordinates on it (except at the poles and along the 180th

meridian).

The concept of surface finds application in physics, engineering, computer graphics,

and many other disciplines, primarily in representing the surfaces of physical objects. For

example, in analyzing the aerodynamic properties of an airplane, the central consideration

is the flow of air along its surface.

In computer-aided geometric design a control point is a member of a set of points used

to determine the shape of a spline curve or, more generally, a surface or higher-dimensional

object.

0.11 Planar Surface

Planar surface object is a flat object that creates floors or adds a surface below a model

to receive shadows that are being cast from light sources. Planar surface are created in

two ways;

12

a. Pick two points in a drawing

b. Select a closed 2D object such as a circle, closed poly-line or region.

In mathematics, a plane is any flat, two-dimensional surface. A planar surface means

that the surface of a material is straight in two dimensions, an example would be a

perfectly flat smooth piece of glass. If a chip is on the glass surface, or if the glass is

heated and curves, then it is no longer a planar surface. Planar simply means that the

thing has the form of a plane, a two dimensional surface. you could follow it left to right

and back to front but not up and down (well, two of those three depending on which

direction the plane is oriented; there will be one of the three primary directions where

whatever it is does not go because it is a plane).

It is like when you are looking at a rock face and you can see a horizontal bedding

plane (one dimensional), and then imagining that it goes back into the rock face (almost

like carpets stacked one above the other, you cannot see the ones underneath, but you

know they are there). Planar surfaces can be mapped using their surface normals and

per-pendicular distances, along with their convex hulls.

With Planesurf, planar surfaces can be created from multiple closed objects and the

edges of surface or solid objects. During creation, you can specify the tangency and bulge

magnitude. Planar surfaces are created from a set of closed edges. A software used here

in creation of planar surface is Solid Works.

0.12 Bi-cubic Surface Patch

Using bi-cubic Bezier surfaces instead of other surface types makes a lot of sense. They are

a nice balance between simplicity and complexity, providing freedom for the artist with a

minimal amount of complexity for the programmer and renderer. Bezier surfaces are just

about as simple as you can get for curved surfaces. They are defined by a square grid of

control points. The bounding curves of the surface are Bezier curves dictated purely by

the control points at the edge. The surface between the edges is controlled by a simple

13

proportion of nearby control points. The limitations placed on control point position to

ensure continuity between neighboring surfaces is well-known and easy to enforce. Bi-

cubic surface is used to compute a set of curves using control points first. Points on the

curves are then used as control points to compute the final point on the surface. Bi-cubic

interpolation considers 16 pixels (4 × 4). Images re-sampled with bi-cubic interpolation

are smoother and have fewer interpolation artifacts. Bi-cubic interpolation considers 16

pixels (4 × 4). Images re-sampled with bi-cubic interpolation are smoother and have

fewer interpolation artifacts.

The geometry of a single bi-cubic patch is thus completely defined by a set of 16 control

points. These are typically linked up to form a B-spline surface in a similar way as Bezier

curves are linked up to form a B-spline curve. In a mathematical subfield of numerical

analysis, a B-spline, or basis spline is a spline function that has minimal support with

respect to a given degree, smoothness, and domain partition. Figure 3 shows the bi-cubic

surface texture mapping.

Figure 3: The bi-cubic surface texture mapping

14

0.13 Curved Surfaces

The most important term in the field of curve and surface design is interpolation. It

comes from the Latin inter (between) and polare (to polish) and it means to compute

new values that lie between (or that are an average of ) certain given values. A typical

algorithm for curves starts with a set of points and employs interpolation to compute a

smooth curve that passes through the points. Such points are termed data points and

they define an interpolating curve. Some methods start with both points and vectors and

compute a curve that passes through the points and at certain points also moves in the

directions of the given vectors.

Another important term in this field is approximation. Certain curve and surface

methods start with points and perhaps also vectors and compute a curve or a surface

that passes close to the points but not necessarily through them. Such points are known

as control points and the curve or the surface defined by them is referred to as an ap-

proximating curve or surface.

In practice, curves (and surfaces) are specified by the user in terms of points and

are constructed in an interactive process. The user starts by entering the coordinates

of points, either by scanning a rough image of the desired shape and digitizing certain

points on the image, or by drawing a rough shape on the screen and selecting certain

points with a pointing device such as a mouse. Portions of curved graph surfaces can

be represented as surface patches. Curves can be represented in three forms: implicit,

explicit, and parametric (see Geometric modeling).

0.13.1 Curved surface types

i. Hermite curves

ii. Catmull-Rom curves

iii. B-Splines

iv. NURBS

15

0.13.2 What makes a good surface representation

i. Accuracy

ii. Concise

iii. Local Support

iv. Efficient Display

v. Stable Surface

vi. Easy Evaluation

vii. Guarantee Continuity

viii. Efficient Intersection

16

MODULE 3: UNIT 3

Color and Shading Models

0.14 Introduction

Real world objects can be modelled via computer visualization. Achieving realism is

no simple task. In a 3D scene realism can be achieved through the use of a technique

called Shading. Shading adds a photo-realistic effect to 3D objects by applying different

light intensities at varying angles on the object. Different techniques are used to apply

different levels of shading, However to truly capture the realism of a real world object

in a 3D scene shadows are necessary. Without them objects would look as if they were

floating in space.

0.15 Shading

Shading is the implementation of an illumination model to pixel points or polygon surfaces

of the graphics object. The illumination model is used to determine the colour of a

surface point by simulating some light attributes. Shading addresses how different types

of attributes are distributed across the object’s surface, descriptions of this kind are

expressed with a program called a shader. A simple example of shading texture which

uses an image to specify the diffused color at each point on a surface giving it more

apparent detail.

0.15.1 Shading model

In computer graphics a shading model is used to simulate the effects of light shining on

a surface. The intensity we see on the surface depends on:

i. The type of light source

ii. Surface characteristic eg matte, shining, dull or transparent

17

0.15.2 Types of shading models

There are basically three shading models. They are:

i. Flat (constant) Shading model

ii. Gouraud shading model

iii. Phong shading model

Flat (constant) shading model

The flat shading model is a lighting technique used in 3D computer graphics. It works

by calculating a single intensity value which is used to shade the whole polygon equally.

It is a fast and simple model which is usually used for high speed rendering when other

models are too computationally expensive. A downside to flat shading is that it does

not model specular reflection. Flat shading has the problem of intensity discontinuity

between polygons. It is illustrated in Figure 4.

Figure 4: Flat shading model

Gouraud Shading model

The gouraud shading model works by calculating intensity value for each vertex of a

polygon. The intensity values for the inside of the polygon are obtained by interpolating

the vertex values. Gouraud shading eliminates the intensity discontinuity problem and

still does not model Specular reflection correctly. It is illustrated in Figure 5.

18

Figure 5: Gouraud Shading model

Phong shading model

The Phong shading model works by interpolating the normal vectors between the vertices.

The intensity value is then calculated at each pixel using the interpolated normal vector.

The Phong shading model is the most accurate shading model as each pixel is represented

by its colour. It is illustrated in Figure 6.

Figure 6: Phong shading model

0.16 Shadows

A shadow is a region where light from a light source is obstructed by an opaque object.

Shadows tell us about the relative locations and motions of objects. Humans conceive

the motion of objects using shadows. It can be considered as areas hidden from light

19

source. A shadow on A due to B can be found by projecting B onto A with the light as

the centre of projection. This therefore suggests the use of projection transformations.

i. Shadows help to improve the realism in rendered images

ii. Shadows illustrate spatial relations between objects.

iii. Shadows provide useful visual cues that help in understanding the geometry of a

complex occlude: shadows can reveal occluded geometry or even geometry that is

out of the field of view, as a plane passing above the robot.

0.16.1 Point and non-point light sources

A point source of light casts only a simple shadow, called an ”umbra”. For a non-point

or ”extended” source of light, the shadow is divided into the

i. Umbra,

ii. Penumbra

iii. Antumbra

The wider the light source, the more blurred the shadow becomes. If two penumbras

overlap, the shadows appear to attract and merge. This is known as the Shadow Blister

Effect. The outlines of the shadow zones can be found by tracing the rays of light emitted

by the outermost regions of the extended light source. The umbra region does not receive

any direct light from any part of the light source, and is the darkest. A viewer located in

the umbra region cannot directly see any part of the light source.

By contrast, the penumbra is illuminated by some parts of the light source, giving it

an intermediate level of light intensity. A viewer located in the penumbra region will see

the light source, but it is partially blocked by the object casting the shadow. If there

are multiple light sources, there will be multiple shadows, with overlapping parts darker,

and various combinations of brightness’s or even colours. The more diffuse the lighting

20

becomes, the softer and more indistinct the shadow outlines become, until they disappear.

The lighting of an overcast sky produces few visible shadows.

The absence of diffusing atmospheric effects in the vacuum of outer space produces

shadows that are stark and sharply delineated by high-contrast boundaries between high

and dark. For a person or object touching the surface where the shadow is projected (e.g.

a person standing on the ground, or a pole in the ground) the multiple shadows converge

at the point of contact. A shadow shows, apart from distortion, the same image as the

silhouette when looking at the object from the sun-side, hence the mirror image of the

silhouette seen from the other side.

0.16.2 Types of Shadows

Umbra

The umbra (Latin for ‘shadow’) is the innermost and darkest part of a shadow, where

the light source is completely blocked by the occluding body. An observer in the umbra

experiences a total eclipse.

Penumbra

The penumbra (from the Latin paene ‘almost, nearly’ and umbra ‘shadow’) is the region in

which only a portion of the light source is obscured by the occluding body. An observer in

the penumbra experiences a partial eclipse. An alternative definition is that the penumbra

is the region where some or all of the light source is obscured (i.e., the umbra is a subset

of the penumbra).

Antumbra

The Antumbra (from Latin ante, ‘before’) is the region from which the occluding body

appears entirely contained within the disc of the light source. An observer in this region

experiences an annular eclipse, in which a bright ring is visible around the eclipsing body.

If the observer moves closer to the light source, the apparent size of the occluding body

21

increases until it causes a full umbra.

0.16.3 Hard and Soft shadows

By default, most shadows are hard (having crisply defined and sharp edges). Some people

dislike hard shadows, especially the very crisp ones achieved through ray tracing, because

traditionally they’ve been an overused staple of most 3D renderings. Point lights have

hard edges, and area lights have soft edges.

Figure 7: A hard shadow

Figure 8: A soft shadow

Shading and shadows create realism in 3D objects.

22

MODULE 3: UNIT 4

Ray Tracing

0.17 Introduction

Ray tracing was first developed in the 1960s by scientists at an organization known as

Mathematical Applications Group (MAG). Ray tracing is used extensively in computer

gaming and animation, television and DVD programming and movie production. Ray

tracing was used long before the electronic computer was invented. Back then, the ‘com-

puter’ was the artist’s assistant and rays were strands of thread. Points on the object (a

lute) are projected onto the image. Nowadays we would call this process a ‘projection of

3D points onto a 2D image’. Ray tracing was also used for lens design for microscopes,

telescopes, binoculars, and cameras.

Ray tracing is a technique of rendering i.e. ray tracing is as a result of rendering.

But Ray Tracing is a very flexible rendering technique because of its ability to simulate

optical effects. Unfortunately, it requires much more computational resources than other

rendering techniques such as rasterisation. It used to be a method suitable only for offline

rendering, but with the ever increasing computational power of personal computers, ray

tracing is now used in real-time applications, executed on standard personal computers.

Ray Tracing is a technique for generating an image by tracing the path of light through

pixels in an image plane and simulating the effects of its encounters with virtual objects.

The First Big Idea of Ray Tracing came in 1968 by Arthur Appel who came up with

the idea of ray casting which is essentially unchanged today. He talked about generating

an image by sending one ray per pixel and figuring out which object each object each ray

hits first and checking for shadows by sending a ray to the light. The Second Big Idea

in Ray Tracing came in 1979 by Turner Whitted came up with recursive ray tracing,

which allowed reflection and refraction.

23

0.18 Ray reflection

When a ray hits an object, a reflected ray is generated which is tested against all of the

objects in the scene. An illustration is given in Figure 9.

Figure 9: Ray reflection (1)

This implies that: If the reflected ray hits an object then a local illumination model is

applied at the point of intersection and the result is carried back to the first intersection

point. This is illustrated in Figure 10.

Figure 10: Ray reflection (2)

0.19 Ray transmission

If the intersected object is transparent, a transmitted ray is generated and tested against

all the objects in the scene. It is illustrated in Figure 11.

24

Figure 11: Ray transmission (1)

This implies that; if the transmitted ray hits an object then a local illumination model

is applied at the point of intersection and the result is carried back to the first intersection

point. It is illustrated in Figure 12.

Figure 12: Ray transmission (2)

The bottlenecks of ray tracing is high computational cost: Rendering images of 3D

objects requires high functioning processors. In the past, getting or purchasing high func-

tioning processors and graphics card to implement Ray Tracing costs a lot and Memory

management. It requires all the scene geometry to be stored in memory while the image

is being rendered (Unlike Rasterisation that allows any object won’t be visible again to

be thrown away or removed from the memory). Reason why ray tracing requires that all

scene geometry be stored in memory is because in Ray Tracing, if an object is not visible

it might have casted shadows on/over objects which are visible to the camera and thus

need to be kept in memory until the last pixel in the image is processed.

25

0.20 How Ray Tracing Works

To produce an Image of a 3D scene using Ray Tracing involves:

i. Casting a ray from the eye (the camera position) and passing through the Centre of

each pixel

ii. We then find what object(s) from the scene, these rays intersect by tracing a line

from the camera’s origin to the pixel Centre and then extending that line into the

scene.

The process is repeated for every pixel in the image.

0.21 Ray Tracing Algorithm

The ray tracing algorithm renders an image by casting rays into the scene. A ray is cast

through every pixel of the image, tracing the light coming from that direction. When the

ray hits an object, the light incident of that point is evaluated to compute the amount

of light reflected back to the camera, casting more rays into the scene from this point.

Sampling the scene with many rays from each point of interest would be way too costly

to achieve interactive frame rates, so only the most important directions are sampled.

For diffuse surfaces, most reflected light will usually come directly from light sources,

thus one ‘shadow ray’ is cast towards each light source, to and whether the source is

visible or not. If it is not shadowed, the light incident is used to compute the shading of

the point of interest, according to the surface properties.

The steps described above would render an image with shadows and surface shading,

but to obtain light reflection and eventually refraction, we need to introduce recursion

into the algorithm. If the surface is reflective, another ray is cast in the direction of ideal

reflection. This ray is traced in exactly the same way as the primary rays (rays cast from

the camera). The recursion stops when a maximal depth is reached, or the contribution

factor drops below certain threshold.

26

TraceRay(ray, depth)

{

if(depth > maximal depth)

return 0;

find closest ray object/intersection;

if(intersection exists)

{

for each light source in the scene

{

if(light source is visible)

{

illumination += light contribution;

}

}

if(surface is reflective)

{

illumination += TraceRay(reflected ray, depth+1);

}

if(surface is transparent)

{

illumination += TraceRay(refracted ray, depth+1);

}

return illumination modulated according to the surface properties;

}

else return EnvironmentMap(ray);

}

for each pixel

{

compute ray starting point and direction;

27

illumination = TraceRay(ray, 0);

pixel color = illumination tone mapped to displayable range;

}

0.22 Bresenham’s line Algorithm

This is an algorithm that determines the points of an n-dimensional raster that should

be selected in order to form a close approximation to a straight line between two points.

It is commonly used to draw lines on a computer screen, as it uses only integer addition,

subtraction and bit shifting, all of which are very cheap operations in standard computer

architectures. It is one of the earliest algorithms developed in the field of computer

graphics. An extension to the original algorithm may be used for drawing circles. The

basic ‘line drawing’ algorithm used in computer graphics is Bresenham’s Algorithm. This

algorithm was developed to draw lines on digital plotters, but has found wide-spread

usage in computer graphics.

0.23 Importance of Ray Tracing and Basic Algorithm

The importance of Ray Tracing is used majorly for producing realistic images in computer

gaming and animation, television and DVD programming and movie production. Ray

tracing popularity stems from its basis in a realistic simulation of lightning over other

rendering method. Effect such as reflection and shadows which are difficult to simulate

using other algorithm are a result of natural ray trace algorithm.

28

MODULE 3: UNIT 5

Characteristics of vectors

0.24 Vector graphics

Vector graphics is the creation of digital images through a sequence of commands or

mathematical statements that place lines and shapes in a given two-dimensional or three-

dimensional space. In physics, a vector is a representation of both a quantity and a

direction at the same time. In vector graphics, the file that results from a graphic artist’s

work is created and saved as a sequence of vector statements. For example, instead of

containing a bit in the file for each bit of a line drawing, a vector graphic file describes a

series of points to be connected. One result is a much smaller file.

At some point, a vector image is converted into a raster graphics image, which maps

bits directly to a display space (and is sometimes called a bitmap). The vector image can

be converted to a raster image file prior to its display so that it can be ported between

systems.

A vector file is sometimes called a geometric file. Most images created with tools

such as Adobe Illustrator and CorelDraw are in the form of vector image files. Vector

image files are easier to modify than raster image files (which can, however, sometimes

be reconverted to vector files for further refinement).

Animation images are also usually created as vector files. For example, Shockwave’s

Flash product lets you create 2-D and 3-D animations that are sent to a requestor as a

vector file and then rasterized ‘on the fly’ as they arrive.

0.25 Characteristics of vectors

Vector graphics consist of illustrations created using line work. In technical terms, you

use points, lines, curves and shapes to create the illustration. Vector graphics are based

on vectors, also referred to as paths. You can think of drawing with a pencil as the

29

process of creating vectors, since you are drawing lines.

One of the key characteristics of a vector graphic is that the line work is sharp, even

when you zoom in very closely. In a computer application, the line work is stored as a

mathematical formula that describes the exact shape of the line. So when you zoom in,

you are seeing the line in more detail but it remains a line.

You can alter how vector graphics look by changing the properties of the line and by

filling in the area between the lines. This can turn a set of simple black and white lines

into a great illustration. When you see a photo-realistic illustration that is not actually a

photograph, the illustration typically consists of a very detailed vector graphic containing

hundreds or thousands of lines.

Vector graphics are created and edited using illustration software. There are a number

of different illustration applications. One of the most widely used ones is Illustrator

by Adobe. Others include CorelDraw by the Corel Corporation and the open source

applications Inkscape and Xara Xtreme. Vector graphics can be stored in a number of

different file formats, including AI, EMF, SVG and MWF

Vector graphics are computer graphics images that are defined in terms of 2D points,

which are connected by lines and curves to form polygons and other shapes. Each of

these points has a definite position on the x- and y-axis of the work plane and determines

the direction of the path; further, each path may have various properties including values

for stroke color, shape, curve, thickness, and fill. Vector graphics are commonly found

today in the SVG, EPS, PDF or AI graphic file formats and are intrinsically different

from the more common raster graphics file formats such as JPEG, PNG, APNG, GIF,

and MPEG4.

Unlike JPEGs, GIFs, and BMP images, vector graphics are not made up of a grid

of pixels. Instead, vector graphics are comprised of paths, which are defined by a start

and end point, along with other points, curves, and angles along the way. A path can be

a line, a square, a triangle, or a curvy shape. These paths can be used to create simple

drawings or complex diagrams. Paths are even used to define the characters of specific

typefaces.

30

Because vector-based images are not made up of a specific number of dots, they can

be scaled to a larger size and not lose any image quality. If you blow up a raster graphic,

it will look blocky, or ‘pixelated’. When you blow up a vector graphic, the edges of each

object within the graphic stay smooth and clean. This makes vector graphics ideal for

logos, which can be small enough to appear on a business card, but can also be scaled to

fill a billboard. Common types of vector graphics include Adobe Illustrator, Macromedia

Freehand, and EPS files. Many Flash animations also use vector graphics, since they

scale better and typically take up less space than bitmap images.

0.26 What you need to know about Vector Graphics

0.26.1 You Can Resize Them Easily

You can resize vector graphics without pixelating or losing image quality. The image

remains keeps crystal clear detail – even when zoomed in or enlarged several times. If

you?ve ever worked on an illustration or web graphic, you understand the importance of

this. There?s not much that makes you feel more like an amateur than a client asking,

?Can I see this in a larger size?? and all you have is an unscalable raster to send.

0.26.2 They Have a Smaller File Size

Every gigabyte counts, especially when you?re storing hundreds of designs. Another

benefit of vector graphics is their small file size. Mathematical equations don’t require as

much storage space because there?s less information to store. Meanwhile, raster graphics

need to house the data regarding thousands of pixels, which causes the file size to swell.

0.26.3 There are Several File Formats

The standard format for vector graphics in web design is .SVG. The World Wide Web

Consortium sets the standard requirements for modern web design. They set SVG as the

standard file format for online vector images. However, additional file formats include:

31

.cgm, .odg, .eps, and .xml. Vector images may also be found in .pdf files. Adobe Illustrator

uses its own vector file type AI for illustrations and print layout.

0.26.4 Raster Files Aren’t the Same

Lines and shapes formed from equations create vector graphics while raster images are

made up of thousands of pixels. Vector images are scalable. However, raster graphics lose

image quality when scaled. Vector graphics easily convert to raster graphics. However,

most raster graphics, especially digital photographs, can?t convert to vector.

0.26.5 You Can Use Them Several Ways

Business logos commonly use vector graphics because the logo will remain the same on

a tiny business card or a large billboard. Icons, infographics, illustrations, and computer

fonts commonly use vector graphics. Additional common uses include: - Printing on

paper and clothes - Signage - Embroidery - General graphic design - Online animations

such as HTML5 or Adobe Flash

0.26.6 There Are Also Times to Avoid Them

Do not use vector graphics when dealing with digital photography, images with many

shades of color, or images with high attention to detail. Raster graphics can provide up

to 16 million colors compared to vector’s mere thousands of colors.

32

MODULE 3: UNIT 6

Display processors

0.27 Display processors

Display processor is a specialized I/O processor used to mediate between a file of informa-

tion that is to be displayed and a display device. It reformat the information as required

and provides the information in accordance with the timing requirements of the display

system.

Display Processor is the interpreter or a hardware that converts display processor

code into picture. The Display Processor converts the digital information from CPU to

analog values. The main purpose of the Digital Processor is to free the CPU from most

of the graphic chores. The Display Processor digitize a picture definitions given in an

application program into a set of pixel intensity values for storage in the frame buffer.

This digitization process is called Scan Conversion.

0.28 Silent features of Display Processor

• Display processors includes functions such as generating various line styles, dis-

playing color area and performing transformations and manipulations on display

object.

• Display Processor was used before the GPU (Graphics Display Processor).

• Video Controller is the most widely used Display device that is based on CRT

(Cathode Ray Tube).

• In addition with the system memory, Display Processor have a separate memory

area.

33

0.28.1 Display Devices

There are large number of Display Devices available to free the CPU from graphic chores:

• Refresh Cathode Ray Tube

• Random Scan and Raster Scan

• Color CRT Monitors

• Direct View Storage Tubes

• Flat Panel Display

• Lookup Table

Figure 13: Block diagram for Display system

Display File Memory: It is used for generation of the picture. It is used for

identification of graphic entities.

Display Controller:

• It handles interrupt

• It maintains timings

• It is used for interpretation of instruction.

Display Generator:

34

• It is used for the generation of character.

• It is used for the generation of curves.

Display Console: It contains CRT, Light Pen, and Keyboard and deflection system.

The raster scan system is a combination of some processing units. It consists of

the control processing unit (CPU) and a particular processor called a display controller.

Display Controller controls the operation of the display device. It is also called a video

controller.

0.29 Conclusion

Geometric representation, Surfaces, Color and shading, Ray tracing, Characteristics of

vectors and Display processors have been studied.

35