ComputerGraphicsWeek3 (Rasterization)
ComputerGraphicsWeek3 (Rasterization)
Rasterization of 3D Images
Week 3
• Raster graphics are easy to use and easy to edit. It is also commonly used in real-
time 3D graphics processing, as rasterization is an easy and fast way to convert
images for display
Rasterization of 3D images
What is Rasterization?
• First job: enumerate the pixels covered by a primitive
– Simple definition: pixels whose centers fall inside
• Second job: interpolate values across the primitive
•Shading model – technique that defines when and where do we calculate the components needed for light
calculations.
•Lighting model – technique that defines how do we calculate the final color given all the components
required for it.
•Material properties – properties of the material that determine how much an object with this material
reflects a light from different channels.
•Light properties – properties of a light source that determine how much this light source emits light from
different channels
Shading
• In computer graphics, shading refers to the process of altering
the color of an object/surface/polygon in the 3D scene, based
on the surface's angle to lights, its distance from lights, its angle
to the camera and material properties.
• Flat Shading:
• The lighting is evaluated only once for
each polygon (usually for the first vertex
in the polygon based on the polygon's
surface normal and on the assumption
that all polygons are flat.
• The second image is the same model rendered without edge lines. It is difficult to tell where one face of
the box ends and the next begins.
• The third image has shading enabled, which makes the image more realistic and makes it easier to see
which face is which
Shading and Lightning
What is Object Silhouette?
A silhouette is an object or scene represented as a solid shape of a single color, usually black,
with its edges matching the outline of the subject. We cannot determine the edges or patterns
in the object.
In the given figure, we cant identify the shape of the object. As the object is in solid color and
edges color are same as the surface color. Such objects are called Object Silhouette.
However, by using shading and lightning techniques the object shape and color can be
determined.
Lightning
• When a shader computes the result color, it uses a lighting model to determine the amount of light
reflected at specific points on the surface.
• Different lighting models can be combined with different shading techniques — while lighting says how
much light is reflected, shading determines how this information is used in order to compute the final
result.
• It may for example compute lighting only at specific points and use interpolation to fill in the rest. The
shader may also decide about how many light sources to take into account etc
Lightning
• Types of Lightning in OpenGL:
1. Ambient lighting
An ambient light source represents an omni-directional, fixed-intensity and fixed-color light
source that affects all objects in the scene equally
Lightning
• Types of Lightning in OpenGL :
2. Point lighting
Light originates from a single point and spreads outward in all directions
Lightning
• Types of Lightning in OpenGL :
3. Spotlighting
Models a spotlight: light originates from a single point and
spreads outward in a cone.
4. Area lighting
Light originates from a small area on a single plane.
(A more realistic model than a point light source.)
Lightning
• Types of Lightning in OpenGL :
5. Directional lighting
A directional light source illuminates all objects equally from a given direction, like an area light
of infinite size and infinite distance from the scene; there is shading, but cannot be any distance
falloff. This is like the sun.
Lightning
• Lighting Interactions in OpenGL :
In computer graphics, the overall effect of a light source on an object is
determined by the combination of the object's interactions with it usually
described by at least three main components:
1. Ambient
2. Diffuse
3. Specular
Lightning
• Lighting Interactions in OpenGL :
• Ambient
As ambient light is directionless, it interacts uniformly across all surfaces, with its intensity determined by the
strength of the ambient light sources and the properties of objects' surface materials
• Diffuse
Diffuse lighting or diffuse reflection is the direct illumination of an object by an even amount of light interacting
with a light-scattering surface.
• Specular
The specular lighting component gives objects shine and highlights. This is distinct from mirror effects
because other objects in the environment are not visible in these reflections. Instead, specular lighting
creates bright spots on objects based on the intensity of the specular lighting component and the
specular reflection coefficient of the surface.
Lightning
• Lighting Interactions in OpenGL :
EXAMPLE:
Computer Graphics is an Art
• Art is the term for a range of human activities that express human
creativity and imagination in forms such as painting, music, dance,
and literature
• Computer graphics deals with generating images and art with the aid
of computers.
• A computer graphic artist primarily creates artwork with computer
software. He or she may work in the multimedia, film, or game
animation industries.
• Hence, Art is an application of Computer graphics.
Computer Graphics is an Art
Elements of Drawing Pictures
• Point
It is a basic element in graphics. To draw a line, you need two points between which you can draw a
line. In the following three algorithms, we refer the one point of line as (X0,Y0) and the second
point of line as (X1,Y1).
• Line
In graphics, a line can be described as a single point that continues for a distance, or
as the connection between two points
Elements of Drawing Pictures
• Polygon
Polygons are used in computer graphics to compose images that are three-
dimensional in appearance.
• Polyline
A polyline is a list of points, where line segments are drawn between
consecutive points. A polyline has the following properties: Points. The
vertices of the line. Line segments are drawn between consecutive
points.
Elements of Drawing Pictures
Examples:
Elements of Drawing Pictures
• Pixel
A pixel is the smallest unit of a digital image or graphic that can be displayed and
represented on a digital display device. Pixels are combined to form a complete
image, video, text, or any visible thing on a computer display.
• Picture
A computer image is a picture composed of an array of elements called pixels.
• Resolution
Resolution indicates the number of pixels that are displayed per inch for an
image (or pixels per centimeter).
Pixels VS Resolution
• Pixels
• Graphic images are made up of tiny dots called pixels.
• Each pixel has a particular address on the screen.
• Resolution
• It is defined as the maximum number of pixels or dots can be displayed on the
screen.
• Examples:800 by 600 pixels,1024 by 768 pixels,1152 by 864 pixels etc.
Elements of Drawing Pictures
Pixel
Active and Passive Graphic System
(a) Non-Interactive/ Passive Computer Graphics:
• In non-interactive computer graphics, the picture is produced on the monitor, and the
user does not have any controlled over the image, i.e., the user cannot make any change
in the rendered image. One example of its Titles shown on T.V.
• Non-interactive Graphics involves only one-way communication between the computer
and the user, User can see the produced image, and he cannot make any change in the
image.
(b) Interactive / Active Computer Graphics:
• In interactive Computer Graphics user have some controls over the picture, i.e., the user
can make any change in the produced image. One example of it is the ping-pong game.
• Interactive Computer Graphics require two-way communication between the computer
and the user. A User can see the image and make any change by sending his command
with an input device