Outline for Today
Wiki
Link to the UR Courses wiki page for this meeting
Media
Transcript
Audio Transcript
-
Okay, so this is meeting 15
-
So last day in October our last
day October
-
so anyone prepared or anyone
excited about Halloween anyone
-
have experience with Halloween
-
any costumes?
-
This is going to be my first.
-
Yeah. Well, depending how many
kids I get on, on Tuesday night
-
at my house I have I have some
candy to bring on Wednesday
-
so we decided to get these full
size bars and says little treat
-
sizes. So that's the first time
we're gonna try that. So we'll
-
see how it goes.
-
Morning
-
that's my attempt at a pumpkin
thanks
-
so what are we talking about
last day
-
we started chapter six
-
about the light lighting
-
so we have lighting and shading
in chapter six yeah so what are
-
some elements of that?
-
So I was listening to the audio
from last day and there's a lot
-
of nice writing on the board. So
I don't know if but I'll try and
-
post a post them I promised on
your courses if it's helpful
-
so what did we start out with?
When we looked at cubes spinning
-
around or triangles, what
happened? What did we start
-
with? The vertex shader or the
fragment shader was just putting
-
out a color right
-
so we had a light position.
-
Sorry Adelaide stars
-
say we add a point light source
point in space is emitting
-
light. So it's emanating from
that point in all directions. So
-
if we have an object
-
that's
-
found object it's facing away
from the late it doesn't get
-
illuminated by the light source.
-
So what's a way that we can tell
whether we're hitting the
-
lights? The latest hitting the
surface
-
you have to see this, from which
angle the light is coming on to
-
do to make a contract
-
so if we have
-
a triangle that has this normal
vector and we want to we can
-
test whether the angle between
-
light source and the surface
normal is less than 90 degrees.
-
Angle is less than 90 Only 10 It
will be
-
yeah
-
so that would be we'd have a
contribution from the light onto
-
that surface if it's less than
90 degrees
-
Is everyone clear about normal
vectors
-
so it's the vector perpendicular
from the surface. And because
-
we're using triangles then we
have one one normal vector for
-
the triangle.
-
Might have
-
might think of the normals at
the vertex at each vertex
-
because
-
light the light if it's a point
source, it's close. There might
-
be a difference in the angle
that the light source is making
-
with the surface at that at each
vertex.
-
Writing to smile again aren't i
-
That's very generous. So look at
the normal of each vertex
-
because we can consider the
angle of incidence of late may
-
be different from point sources
and we
-
do. So we may also want to
specify other vectors as
-
normals.
-
So I'll talk about texture
mapping and the next and the
-
next chapter. Or two
-
So what do you see you've seen
examples in the text where we've
-
interpolated colors on a cube
you can see strips of color that
-
stand out.
-
So that's a perceptual
phenomenon that.
-
Next lines appear where there
aren't supposed to be any
-
so with gross shooting we're
doing using the normals and the
-
lighting vector. So we calculate
the intensity of the or the
-
color at the vertex. So we've
been calculate them to each
-
vertex and then interpolate
those values. So we still have
-
an issue there. With Mark bonds
Mark bands.
-
In limited potential artifacts
-
Yes. Potential artifact after
that
-
is after that potential
artifacts match me see ah
-
wish I had a whiteboard instead
of a chalkboard. And have a
-
fighting chance than I think
-
so this is what I saying you can
do in the vertex shader. This is
-
something we do in the fragment
shader.
-
So I think I've got the issues
sorted out between my old
-
computer and my new computer and
I don't have.
-
Don't have everything quite
organized yet. So please bear
-
with me.
-
My computer's not today.
-
I must have said something.
-
preferences that mess me up
-
so maybe I spoke too soon and I
said I've got everything sorted.
-
Out
-
Okay. So this is this is doing
-
everything in the vertex shader.
-
So we're setting up
-
so we have the vertices for the
cube and then we indicate the
-
light position which is going to
be x y Zed 111. And then we
-
specify an amount of Ambien lake
-
so that's that's the amount of
light that's going to even if
-
the surface and being hit by the
light directly will still get a
-
bit of light in the scene on
that surface.
-
So another component of lighting
is the diffuse
-
which comes from
-
light and light hitting the
surface. And specular relates to
-
if we're getting a shiny
highlight on the surface
-
so this these are some next
variables describe the material
-
characteristics
-
doing the quad
-
as we've done before, except
we're adding normal calculation
-
and we're adding a normals array
and we're doing the color Q
-
which has six phases are setting
up GL stuff we have test
-
so once we've computed the color
cue here, then we're getting a
-
normal buffer of butter for the
normal vectors
-
and then we're associating
-
the per vertex attribute of the
normal with one of the shader
-
here
-
and then we're doing the same
with the positions array. The
-
vertices.
-
angle that we're using for
rotation. Your position so the
-
person's off along that axis and
20 distance or 20. So we'd have
-
an orthographic projection
-
so then we're multiplying the
ambient characteristics of light
-
and being characteristics of the
material same as diffuse and
-
specular so you get those
products and then we're passing
-
those into the shader.
-
Then here we're specifying the
modelview matrix and passing it
-
along to shader.
-
Finally, we're drawing
triangles. There's 36 vertices
-
because there's six faces. Two
triangles each. So that's 12
-
triangles and each triangle has
three vertices. So let's we get.
-
So we got a position
-
x y Zed of a position based on
multiplying the modelview matrix
-
by the position stored in the
vise invert the vertex
-
so, the light, light position is
passed in the uniform light
-
position the uniform for spot
actor with x y Zed and W
-
so, we got the lighting vector
based on the difference between
-
the light position and the
vertex L that we're going to use
-
later.
-
You ever again the normal NDI
coordinates the Ambien So, we're
-
getting that component of our
color based on the product we
-
get from js script.
-
Diffuse is calculated by the
angle between the light and the
-
normal
-
specular is calculated So,
notice you're doing an exponent
-
here based on the shininess.
-
Constant Value times a specular
product based on the interaction
-
of the light and the surf
material surface.
-
I get the position based on
projection the model view and
-
the original vertex V color is
the ambient plus diffuse
-
perspective and we set the alpha
the color to one so, this is all
-
done in the vertex shader.
-
The fragment shader we're just
passing
-
the color from the vertex shader
-
Sorry for hiding out there
-
so ambient background
illumination diffuse is.
-
Speculate specular.
-
something shiny this is kind of
shiny this door knob
-
so, it has some highlight
wherever you see take a picture
-
posterity
-
and you can see me in reflection
I bet
-
What's something else has.
-
Okay that's enough I think you
get the idea
-
does depend on the angle so when
the light is shining down on it
-
then we're getting a very bright
highlight here
-
light is coming into the muster
angle. Island is going to be
-
Less
-
so the idea of we do Phong
shading where we're
-
interpolating. We're deferring
the calculations to the fragment
-
shader. That means that
-
so let's say the lake if we're
-
if we're thinking about this
triangle and light shining down
-
at this point, only dealing with
vertices. We don't we're not
-
going to get a bright highlight
on the spot because we're only
-
we're calculating here at the
vertex the vertices, so we're
-
not going to get the full effect
of that late so it makes sense
-
so it's a bit like our sampling
issue.
-
So free, if we're deferring the
calculation to the fragment
-
shader, then we can get the
highlight in the middle of the
-
triangle and get the highlights
away. From the vertices
-
Let's take a look at the source
here.
-
So
-
you can see here, difference
between the split between the
-
vertex and the fragment shader.
So we get to a position
-
me check whether it's
directional light so like the
-
sun for example.
-
So then we have the eye
position. Normalizing
-
get the normal vector and then
we're doing the projection or
-
the position based on the model
view times of projection matrix.
-
So we're doing the
transformation so we get the
-
we get transformed through text
position. And then we're passing
-
the normal delayed vector and
the eye position so you're
-
seeing out for those and then
the fragment shader we're doing
-
in for those and we're giving a
fragment color.
-
So we're calculating the diffuse
contribution
-
so the the angle of incidence is
important here.
-
So thinking about the sun, if
it's noon day sun that's going
-
to be the brightest and the
Sun's right above us. And it'll
-
be less than that sunrise and
sunset
-
and then we're doing a specular
calculation and we're creating
-
the fragment color based on
ambient, diffuse and specular
-
are setting that alpha to one
Again
-
That makes sense about the
division. Between the fragment
-
and the vertex shaders.
-
So
-
I will get these examples
cleaned up and documented as
-
I've done the other ones
-
and we'll go through them
-
again on Wednesday, so there'll
be Halloween candy on Wednesday.
-
To be able to come in the
costumes. Now that will if you
-
get dressed up on Halloween you
can send send me a picture
-
extra candies
-
so I think we'll stop there for
today
-
any questions or concerns so
-
we'll just take care of what you
said following information and
-
feedback about the tranquil
oppression on the HTML page.
-
What do you mean by providing
information and feedback
-
rotation?
-
The rotation angles
-
well feedback I guess would be
updating
-
updating the display
-
interface so you can see what's
going on.
-
Some information would be
information and
-
the feedback would be wanting
that application run whatever
-
you'd like.
-
So the feedback I guess would be
updating so you identify the
-
information that you want to
display on the interface and
-
rotation angle and then you
update that information as as
-
the program
-
runs.
-
Everything good
-
thanks again for today.
-
See on Wednesday.
-
See on Wednesday.
Responses
What important concept or perspective did you encounter today?
- The most important thing I learned is what different kinds of shadings we have i.e flat shading, smooth shading,Grand shading and Phong shading.
Was there anything today about which you would like to know more?
- We studied about flat shading, smooth shading, phomg shading, goround shading,ambient, diffuse, specular