




































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The concepts of vertex lighting and normal transformations in computer graphics. It discusses how each vertex goes through a lighting process to determine its final color, which is then interpolated across the triangle during scan conversion. The document also covers the importance of accurate measurement of distances and angles for lighting and the different options for lighting in 3d space. It also explains the need to transform normals by the inverse transpose of the matrix to maintain their perpendicularity to the transformed triangle.
Typology: Slides
1 / 44
This page cannot be seen from the preview
Don't miss anything!





































The main stages in the
traditional graphics
pipeline
are:
Transform
Lighting
Clipping / Culling
Scan Conversion
Pixel Rendering
Today, we will mainly focus on vertex lighting
Each vertex goes through a lighting process whichdetermines its final color
This color value is then interpolated across the trianglein the scan conversion process
Usually, each vertex has some sort of initial colorassigned to it, which defines what color it would be if welllit by a uniform white light
This initial color is then modified based on the positionand normal of the vertex in relation to lights placed in thescene (in other words, a grey vertex dimly lit by red lightswill appear dark red…)
In GL, you pass in the ‘unlit’ color through glColor3f(). Itwill then compute the ‘lit’ color, which gets interpolated inthe scan conversion process
Lighting requires accurate measurement of distances and angles, so wewant to compute lighting in a regular 3D space (i.e., not 4D un-normalizedview space, or 2.5D device space…) ^
This leaves object space, world space, or camera space as our mostnatural options ^
To light in object space, we would have to transform the lights from worldspace into each object’s space ^
If we are applying shears or non-uniform scales to our object, this will distortthe object which will mean that object space isn’t actually a legitimate placeto do lighting ^
Lighting in world space would be fine, but it would require transforming theobject into world space, which is a step that we usually avoid explicitlydoing ^
Therefore, it makes good sense to light in camera space, as we willprobably want to perform clipping & some culling in this space as well ^
GL does it’s lighting in camera space, which means that we must transformnormals into camera space in addition to the vertex positions
z z z y z x z y z y y y x y x z x y x x x
x y z
z
z
z
z
y
y
y
y
x
x
x
x
c n b n a n n c n b n a n n c n b n a n n
n n n
d
c
b
a
d
c
b
a
d
c
b
a
0 1 0 0 0 n M n
It’s actually worse than that…
Let’s say we take the 3 vertices of a triangle andcompute the normal, then we transform the 3 verticesand the normal
If the transformation contains any shear or non-uniformscaling, then it is possible that the transformed normalwill no longer be perpendicular to the transformedtriangle itself
To fix this, we should actually transform the normal bythe
inverse transpose
of the matrix, or
M
-1T
The transformed normals will also not be unit length anymore, so they must also be renormalized before lighting
If we want to compute lighting in camera space,we need to first transform the vertices & normalsinto camera space:
1
1 n n
n
n
n
v
M
v
− −
T
[^
]
(^
)
[^
]
(^
) 1 0 z
y
x
z
y
x
n
n
n
v
v
v = = v n
However, if we are looking at a white piece ofpaper under uniform light, we can always turnmore lights on, and get more light to reflect off ofthe paper
There is no upper limit to the intensity of light
If we want to represent a light intensity (lightcolor), we can store it as red, green, and bluevalues ranging from 0.0 to an arbitrarily highvalue
In other words, a bright white light bulb mighthave an color of (10, 10, 10)
We need to make a distinction between material color and light color ^
Material colors represent the proportion of light reflected ^
Light colors represent the actual intensity of a beam of light ^
We never actually perceive the inherent material color, all we see isthe light reflected off of a material ^
If we shine a red light on a grey surface, the object appears dark redbecause it is reflecting beams of dark red light ^
I will use
m
to represent a material color and
c
to represent an
actual light color
A white sheet of paper might reflect 95% of thelight that shines on it
An average mirror might reflect 95% of the lightthat shines on it
Yet, these two things look completely different,because they reflect light in different directions
We say that the paper is a
diffuse
reflector,
whereas the mirror is a
specular
reflector
An
ideal diffuse reflector
will receive light from some
direction and bounce it uniformly in all directions
Diffuse materials have a dull or matte appearance
In the real world, materials will not match this behaviorperfectly, but might come reasonably close
Sometimes, a material behaves in a specular way, butnot quite perfect like a mirror (like an unpolished metalsurface)
In CG, this is sometimes referred to as
glossy
reflection
Glossy materials look shiny and will show
specular
highlights
Many materials have a mixture of diffuse and specularbehavior
Plastics are a common example of this, as they tend tohave an overall diffuse behavior, but still will catchhighlights