2. INTRODUCTION
In the previous lecture we talked about the
nature of light reflection in rendering.
Complex and governed by physics
Approximations only
In this lecture we are going to talk about some of
the other things that are involved in the
rendering process.
Rasterisation
Hidden surface removal
3. RASTERISATION
Rasterisation is the process of turning a rendered
3D model into a two dimensional pixelized image.
Most usual technique for creating real-time 3D
images.
Directly competes with other techniques such as ray
tracing
Rasterisation is comparatively fast.
But limited by the number of polygons to be drawn.
4. RASTERISATION
Three processes for rasterisation:
Determine which squares of the 2D display are
occupied by the polygon.
Determine the depth of each square.
More on this later
Determine the colour of squares.
Process can introduce complications.
Adjacent polygons should fit together without gaps.
Can be complicated by nature of resolution.
6. HIDDEN SURFACE REMOVAL
Because processing cost is dependent on
the number of polygons to be rendered,
useful to restrict the number of polygons
to draw.
Polygons are sometimes partially or
completely hidden by other polygons.
Occluded
Determined by rasterisation.
A process by which we can reduce the
number of polygons we draw is important.
Handled in two separate ways
7. HIDDEN SURFACE REMOVAL
Object model
What the viewer would see
Entire polygons
hidden from view point
Some polygons closer
to viewer (overlapping)
8. HIDDEN SURFACE REMOVAL
Surfaces that are completely occluded are simply
culled.
They never get drawn.
Partially occluded polygons get dealt with using a
Hidden Surface Removal algorithm.
Most well known of these is the z-buffer algorithm.
9. HIDDEN SURFACE REMOVAL
1. 2.
Stage one deals
with culling
backface
polygons
Stage two deals
with partial
occlusion.
10. CULLING
Culling done relative to viewing angle.
If difference between the viewing angle and the
surface normal is greater than 90 degrees, the
surface is invisible.
Also known as back-face culling
Remove those triangles not facing the camera from
the rendering queue.
Deals with complete occluded polugons.
11. CULLING
If the difference is greater than 90 degrees,
then we remove the polygon from the list
Of objects to be rendered.
12. AFTER CULLING
Having removed the hidden polygons, we need to
decide upon overlapping polygons.
All polygons drawn as separate entities. No
knowledge of relationship in the scene.
Need an algorithm to decide on how partially
occluded polygons are to be drawn.
Such as the z-buffer algorithm.
13. THE PAINTER’S ALGORITHM
Deals with hidden visibility by drawing things
farthest to nearest.
Like a painter on a canvas.
Requires some pixels to be redrawn several
times.
And has some problems with overlapping shapes.
Compensation for this complicated and expensive.
Splitting polygons.
15. Z-BUFFERING
For each pixel, we could sort each polygon
by depth.
Draw only the one nearest.
Sorting a costly process
And done for each pixel to be rendered.
Z-Buffering achieves the same effect
without sorting.
Dramatic performance improvement in terms
of CPU.
Quite costly in terms of memory
representation.
Many hardware architectures have dedicated
z-buffer chips.
16. Z-BUFFER
The Z-Buffer is a 2D array that maps onto
the same dimensions as the image.
As we encounter polygons, we make a note of
their depth (z) value.
We assume our viewport is on the positive
z-axis
And we are looking down that z-axis towards
the scene.
Done during rasterisation.
We keep a track of the depth of each image we
are to draw.
We store the colour and the intensity as we do
this.
17. Z-BUFFER
While doing the rasterisation, we can
compare the z value against our current
‘nearest’ shape.
If it’s farther away, we don’t render it.
Skip it, move on to the next
If it’s closer than our previous closest, it
becomes the new closest match.
It replaces the colour and intensity as it does so.
The end result is that the frame buffer
contains only the information relating to
the nearest polygon for any pixel.
19. PROCESS
3D Scene leads to definition of
relationship of objects.
Scene gets broken down into polygons to
represent 3D shapes.
Back-face culling used to eliminate
polygons that are invisible.
Rasterisation goes over each non-culled
polygon to determine where it falls on the
viewing screen.
Colour and intensity of each pixel determined
Z-buffering used to ensure proper handling of
partial occlusion.
20. Z-BUFFERING AND TRANSPARENCY
The Z-Buffer algorithm doesn’t work for
transparent polygons.
Alas!
The z-buffer occludes things behind other
things.
With transparency, we should be able to see
the things we are in front of.
A quick fix:
Draw opaque polygons first
Then draw translucent polygons
Can be combined with alpha blending.
21. OTHER KINDS OF HSR
Contribution culling
If objects are too small to contribute to a scene,
then we simply discard them.
Viewport culling
If objects are outside our viewing projection,
we don’t process them.
Other visibility algorithms exists
Binary tree partitioning
Warnock algorithm
Ray Casting
22. IMPORTANCE OF HSR
Despite huge improvements in GPU
hardware, efficiency still important.
Hardware has gotten more powerful
Models have gotten more complex.
A certain frame-rate is required in order
for ‘realistic’ motion to be experienced.
Trade-off between polygon count and frame-
rate.
Easiest way to reduce polygon count
without compromising graphical quality.
23. SUMMARY
Important to be able to cull hidden polygons and
pixels.
Reduces rendering cost.
Two related processes.
Culling
Visibility
Z-Buffering one of the most common processes in
use today.