Outline for Today
Wiki
Link to the UR Courses wiki page for this meeting
Media
Transcript
Audio Transcript
-
Okay, we're still a little bit
we're not quite on time yet. So
-
morning.
-
Yes
-
question the assigned today is
the last day of submission,
-
right?
-
Yes and one minute to midnight
tonight.
-
Is there any flexibility on that
I have a root canal treatment
-
today oh and I don't know how
good or bad that's gonna be. Are
-
you going to Doctor fee? No.
Campus? Dentist yeah what do you
-
mean by a decision people get
every page I had already it's a
-
root canal
-
yeah I've had to
-
this the first time
-
I've never had
-
my dentist. So the thing is my
dentist said oh, I can do this.
-
And he did it but he couldn't
get all the routes out. So then
-
I went to see an endodontist
who's in southeast Regina. Dr.
-
fee.
-
So anyway, are they good?
-
Yeah, they're good. But I mean,
this one tooth boy has bothered
-
me for 50 years. So there's a
time where I've just putting it
-
off and then I finally got a
root canal and then a word was
-
better for a while but then I
got infected. Anyway so if you
-
have the chance. Me some places
have entered artists who do the
-
root canals and things like that
-
for two hours, blocked out two
hours had they actually so he's
-
so I've never had any dental
issues back home. So I'm from
-
India and never had any dental
issues. I land here four days
-
later, I get a toothache and
then my insurance doesn't cover
-
dental because I just landed and
it activates in September so I
-
was living with toothache. for
like eight, nine months. And
-
then when I went there, he's
like, Well, you waited a little
-
too long. So I'll try and RCT
but come ready for an extraction
-
that's not something that I was
looking forward to.
-
Well, we're not talking it's now
10 o'clock we could start no
-
more talking about root canals.
I was gonna say that once. I
-
used to go to a computer
graphics conferences. Like
-
SIGGRAPH, the big one in LA and
is mostly in LA now it's been in
-
Vancouver and other places as
well but it was in LA
-
and obviously, in these things
called Invisalign, or
-
I have those.
-
So
-
they were recruited ever
recruiting at SIGGRAPH for
-
people to do the
-
graphics with models of the
teeth I got cells from scans. So
-
I remember I remembered that for
some reason, because I didn't
-
have Invisalign when I was had
my braces. I just had braces in
-
high school which were which
were not fun
-
so sorry. Back to where we
started. Would it be possible to
-
extend all right, right. And not
just for me, I don't want
-
everyone else today. So could it
be possible to extend it for the
-
whole class by another day?
-
Or we can say two days. How's
that?
-
Sounds great. That's a
Halloween.
-
Today is All Saints Day, all
things all things Halloween is
-
the Eve the eve of All Saints
Day.
-
It's written Hello. The E
apostrophe en at the end is a
-
contraction of
-
evening Eve anyway.
-
Okay, so let me
-
log into your courses and change
that right away. So then Monday
-
we'll have a discussion about
next assignments. Sounds good.
-
So we'll fit three of them in
somehow over the next or the
-
remaining part of the semester.
-
So while I'm doing this you can
all take record your attendance
-
Don't forget about doing the
responses to meetings. I've
-
gotten a bit out of my rhythm
here but I'll get caught up.
-
I should turn this back on or
put this on the screen so you
-
can tell them I'm not just
making it up and changing this
-
for you.
-
Okay,
-
so is there a reason do you
think that I only have five
-
to 13 people here
-
Professor something brought up
that I've lost. People are just
-
not getting good with the
weather. Like with the sudden
-
change a few of them felt sick.
I
-
was sick I guess it was
wondering too. About whether
-
it's if you're living in
different parts of the city it's
-
hard to come to campus or
-
anyway try and
-
make the class time valuable
-
especially today, you can tell
-
put a note on our courses they
should come or
-
come to see me in my office
-
so here's proof that I changed
the date. It's not on yet
-
okay, so
-
you see that the new date for
assignment two Thank you
-
hello morning.
-
To be able to
-
communicate across the coffee or
people suddenly have an
-
extended.
-
Practice
-
save me shave
-
Okay, so the two of you came in.
Here's the reward. Thank you so
-
much. Thank you one candy bar
goes down.
-
Okay.
-
I'm feeling like I'm writing my
writing is reasonable size here.
-
He just can't get the lower
right he gets smaller. So maybe
-
I'll just read on the top of the
board just one line one line.
-
Next line Yeah.
-
So I've improved that
-
that cube example and we'll look
at that in more detail
-
what are some of the ideas
-
that you
-
that you had that you've
-
gotten from the past or previous
discussion about lighting and
-
shading
-
we had the local light coming
into view
-
so we can have
-
that's fine
-
so here we sit down to get
comfortable
-
my wife pointed out today some
of them are peanuts in them.
-
Yeah this one Yeah. Peanut
Butter anyway but you're welcome
-
would surely pointed that out
after she was there when I
-
bought them and I said I was
gonna do get one of each of
-
these two boxes from Costco
-
and, and then yesterday, it's
like, well, why'd you do this?
-
But you're right I don't know
what I was thinking. Anyway. So
-
I hope there's no one allergic
to peanuts
-
anyway, so
-
I'm talking about point lights
or point light is located in the
-
scene in the world coordinates.
And directional light is you can
-
think of it as being off an
infinity let's say the sun so
-
you have a constant angle of the
light direction for directional
-
lights, but the angle of
incidence of the light from a
-
point light is going to change
depending on the orientation.
-
Pardon me.
-
So we talked about the
difference between calculating
-
intensities of vertices or
calculating colors of vertices
-
and then interpolating that
along the edges compared to
-
calculating vectors and
interpolating vectors so that we
-
can do lighting calculations as
appropriate at each point along
-
the line as it gets transformed.
-
So if you want to do
-
calculations based on vectors
between vertices, what do we
-
have to do? In general terms
-
where do we have to put the
code?
-
Could you repeat the question?
-
If we want, we don't want to
just interpolate colors between
-
vertices but we want to
interpolate more information to
-
get a more realistic sense of
highlights on the surface for
-
example. Where do we need to do
that calculation? In the
-
shadows,
-
yeah, okay,
-
they're in the shaders. Yeah. So
in our JavaScript program, we're
-
organizing the data, then
passing it to the shaders, so
-
the shaders are. So we're doing
for each vertex we're getting
-
recalling the vertex shader. But
then, for each pixel, we call
-
the fragment shader.
-
So if we put.
-
Following Fung Shui so where's
my cut off here? Here,
-
yep, that's it. Okay.
-
All right. So I'm gonna try and
stick with that. We decided that
-
I'm doing fine writing at the
top of the board. The writing
-
gets smaller as you go down the
board. So we're going to try and
-
manage to keep
-
writing the top
-
so I want to just make clear
that there's two different parts
-
to
-
this entire board flying so
there's shading and reflections.
-
So there's a modification to the
farm reflection. model called
-
the blin farm fun model. That
-
so instead
-
of having to look at the
interaction of so doing the
-
calculation based on the labor
position vector and the viewer
-
we can approximate it using a
normal
-
which means we don't have to do
that calculation in the fragment
-
shader. We can do it in the
vertex shader.
-
So let me show you what I did to
the
-
shaded q1
-
Okay, so here we are
-
so I put the latest
-
API point. Let's do some
rotation here.
-
So you can see they did a once
the face is facing us. It gets a
-
highlight.
-
That makes sense.
-
Yep.
-
Okay. Let's look at
-
this, while it was rotating,
even on a axis which should not
-
be directly pointing at me there
was a highlight. So if you
-
rotate it now. So even though it
should not be because it is
-
turned on an X, Y and Zed x one
three of them, so no face should
-
be directly looking at.
Actually, that if you had this
-
one, so this highlights is the
reflection still accurate.
-
So let's look at
-
the card game
-
meant.
-
To be about
-
Okay.
-
Course the sharing is good.
-
Morning Okay, so
-
what we're doing in the vertex
shader here. So first
-
transforming the vertex into my
coordinates. So we're specifying
-
the view position and the leg
position in world coordinates.
-
So we use the model view matrix
to get the new position of the
-
vertex in world coordinates in
our model viewport and that's it
-
so
-
they're like factor is between
like position and the vertex
-
and as a viewer position, so
I've added a variable to
-
indicate that in the JavaScript
program so this halfway vector
-
we normalize the length vector
because of your vector
-
and then we get the normal
vector from the vertex
-
which we chain
-
put into world coordinates
coordinates and then we compute
-
the different terms
-
so we have an ambient, diffuse
so that's the main contribution
-
that's the main lighting
contribution. We see when we
-
have a light is a diffuse
reflection.
-
So k d is based on ganglion
between the light and the
-
surface normal.
-
We're multiplying that by the
product that we're getting from
-
our program
-
and then the specular highlights
we're looking at the angle
-
between the normal and the
halfway vector and erasing
-
the power of shininess to get
the constant that we're modeling
-
so if we don't
-
to zero raise the bar of shyness
is not going to give us any
-
highlights so we only see
highlights when we're facing the
-
light which is about the viewer
position.
-
Material is defined in this as
well so like reflective
-
materials as opposed to
-
so the material properties are
defined in the program, the
-
JavaScript side, okay. And so
that's encoded in three years.
-
In these products. So look at
that next.
-
So we're having
-
a defining some storage here
near the vertices. So we're
-
doing a cube centered at the
origin minus point five minus
-
point five minus point 5.5 point
5.5. So it's a unit cube
-
centered at the origin so I've
added viewer position in the, on
-
the website as a position for
the viewer, but it's not used.
-
So I made use of it here. And
here's the leg position. And
-
I've set the leg position to be
the same as same as if you were
-
a physician. So you could change
that. So the length for the
-
ambient is a low powered light,
but it's a white light because
-
we have
-
light
-
intensity, same intensity for
red, green and blue. And then,
-
here we have a few sliders, full
intensity white specks, their
-
latest full intensity white as
well. So here are the materials
-
for the ambient, so this is
-
blueish and this is red plus
green. So it's yellowish and
-
this is white ish.
-
And we put material shyness at
100.
-
Sooner during the cube we do the
faces. So we're doing a
-
quadrilateral but then we're
dividing those into two
-
triangles and we're taking
-
finding
-
finding the normals based on the
subtraction so taking two
-
vertices so we get a vector and
another vector and then we do a
-
cross product to get the normals
then we're storing the vertices
-
and the normal vectors. So
because the quadrilateral faces
-
playing here, so we can just
store with the same normal for
-
each vertex
-
so here we're creating a normal
buffer buffer for the normals.
-
And we're storing that data in
there. And we're making a
-
connection between the attribute
normal in the shader with our
-
their data are doing the same
with the vertices so we have a
-
projection matrix which does
-
the graphic projection so a
parallel projection and then the
-
ambient product. So we're
multiplying the light times the
-
material ambient properties so
that's where the information
-
about the surface gets fed into
the shader. Because then we're
-
going to make uniform
-
so you Ambien product, so that's
the place in the shader. We
-
connected with the variables in
our jabsco program the render
-
we're doing
-
multiplying the modelview
matrix, start with identity
-
matrix, and we multiply by the
rotation in x, y and Zed
-
and then we pass that to the you
ModelView matrix in the shader.
-
So that's how we transform the
vertices. into real coordinates.
-
Tertiary move the light to what
change would you like to make?
-
leg position or the actually
let's try it let's do
-
another version of nmbm Lake
which is.
-
So he's a full intensity. Like
for the Ambien chaining
-
Save?
-
So we made
-
the ambient faces blue. So you
can see that we're getting lots
-
of blue
-
and then because surfaces Wait
-
let's make another
-
change. Here.
-
That's that's a big impact
-
go back to our original ambient
light
-
let's see what if we move too
late to a distance of two
-
so light position vector this is
the value of the distance of the
-
light or the angle of this is
the
-
position of the light. Right so
and so when I do the calculation
-
and shader comes true. So we're
transforming the vertex. So the
-
position the pause vector has
the role coordinate position of
-
the vertex. Okay. And then the
lake position is there and then
-
we're going to normalize this to
the late and the position
-
so we're calculating the vector
the lighting vector is doing the
-
leg position
-
the difference from the leg
position
-
on the vertex so for each each
vertex are going to do that
-
calculation. So the angle is
going to be
-
but I have
-
to change the source or the
direction of where the light is
-
coming from. Let's say want to
be obtuse angle coming on to the
-
object move that also be defined
in here or is that
-
well we can change the light
position
-
so here we putting it at the
same position we start out with
-
the same position as the
-
right but how do we change it?
How do we tell it that?
-
I mean I get it but we're
setting it at the same point of
-
the viewing point like the eye
and the light is coming from the
-
same point but if you have to
say the eyes coming straight
-
towards the object while the
light is shining on the top.
-
Okay, so let's think about
-
where we want that to be
-
so let's change it
-
so let's let's make it not let's
make it to it's
-
so this will put
-
the lady in position above the
queue fairly close to the queue.
-
To try that.
-
So we got a kind of interesting
highlight there
-
let's change the lighting
position a little bit more was
-
put a little bit towards the
viewer as well. So to still be
-
involved but just a little bit
-
see these
-
these are fun to play with.
Yeah.
-
And think about
-
from from our human side
computing perspective. I can see
-
all your smiling faces. If you
think about human centered
-
computing perspective, we want
to think about the my
-
frustration with these examples
as they are is that it's not
-
they're not the interesting
things to manipulate aren't made
-
accessible. So that's part of
what would be interesting here I
-
think to
-
just change the direction of
-
yeah so you can
-
we can make the interface work
more available, so we can
-
understand, see what's going on.
-
So there's some other thing
websites
-
I want to show you as well. I'll
do that before too long here.
-
It's a time Raven so let's see
what we did here. With this and
-
then.
-
Hear you can see an artifact
-
of two triangles on the surface
-
anyway
-
it's more noticeable than when
he added as I said related 20
-
Because the difference in angles
between different vertices are
-
more pronounced.
-
So this is from WebGL one
-
but if I was kind of needed
-
I need animation so you can see
in the shader So, we're passing
-
the colors
-
so you have a color associated
with each vertex and then
-
fragment shaders doing the
interpolation.
-
So that's that's the way this is
happening here and in this
-
fragment shader
-
specifying the vertex color as
an out and then in the fragment
-
shader we specify the color
hasn't been masking out the
-
fragment color
-
so the fragment color
-
value interpolated from vertex
colors.
-
going to
-
show you a spotlight example. as
well.
-
Three Jas
-
so the lines there are an
addition or a helper to see
-
where the spotlights are being
defined
-
anyway
-
that's the other question I want
to get
-
the demo that
-
we just created. With the cube,
we are not taking into
-
consideration any shadow of the
object. Like with the light
-
source, we're not changing the
position of the shadow or or
-
showing any shadow on the
object.
-
Now we're not it's nothing there
to
-
he's not he's not
-
there isn't anything there. It's
-
like a sort of face should
-
cast a shadow on
-
you like so
-
make sense? Like not like a
plane so would it not change
-
some areas around the canvas
itself? Which is being blocked
-
by the light? Let's say that
Candice is getting has an
-
ambient light. And then there is
light that is coming in from
-
like you don't have to Sandy
will that not be diffused onto
-
the canvas as well. For housing
message that do we not do or do
-
we just consider the object in a
vast empty space
-
basically
-
suing so in computer graphics, I
mean we think we don't have the
-
same idea of the arrangement of
so many things are handled for
-
us in the real world. You know,
so there are walls that of
-
making lunch which we can cast
shadows and add some realism but
-
with a computer graphics model,
we have to describe everything.
-
Everything so if we need to add,
add a feature we need to add it
-
add it to the scene so we can
-
Okay, so all I'll take that on
as and we'll we'll talk about
-
that. On Monday. We'll take the
shader cube example and add
-
shadows. Add a place for them to
appear and make sure there
-
we'll deal with all that okay
-
so these web pages here that I
I'm flashing here I'll put them
-
in links for for you to look at
the meeting. Notes.
-
So this one is using
-
her fragment shading I just want
to just show what's going on
-
here
-
it's not very well documented
here. So we have the light
-
which isn't used
-
so he's making some assumptions
about think the viewer is at the
-
origin here
-
so he is for the eye so the idea
is we're getting a GL position
-
based on our projection so this
is in our clip coordinates
-
and then
-
sort of passing out the normal
vertex lighting vector for the
-
vertex
-
vector which is a viewer
position relative to the vertex.
-
So those three vectors are being
passed to the fragment.
-
outputting the vector not
putting the fragment so here
-
we're doing
-
calculating the halfway vector
-
during the diffuse
-
so the idea here is a missed
example. We're doing the
-
interpolating the vectors for
-
so we're at the vertices for
calculating the normal relating
-
back here and of your position
vector with respect to each
-
vertex, and we're passing those
to the fragment shader, and then
-
we're doing essentially the same
computations we did in the
-
shading cube exam example. But
I'll create another version of
-
the shaded cube which uses a per
fragment shading so you can
-
compare the two of them.
-
I just found a website. When do
you think we can reach this
-
level?
-
Quickly just discuss the code of
this
-
insurance what why once you one
Can you post the
-
URL? Sure.
-
This like when I started work,
so there used to be this website
-
called Code rocks. I'm sure you
all have it in palace wardrobes.
-
I used to just grow through it
every day. Like I have a huge
-
bookmark for all these WebGL
things and I've always wondered
-
how they used to do and I just
remembered when you showed that
-
you that I saw one of those add
that to the to add that to the
-
notes. Actually, you can add to
the discussion. Yeah, that'd be
-
good please.
-
CMRA things getting more clear.
-
So we'll take on
-
the suggestions, the shadows and
so on. We'll talk about that on
-
Monday and then we'll also get
into chapter seven.
-
Okay, sounds good. Thank you for
today.
-
I'll try and remember to keep my
writing in the top half of the
-
board
-
and if anyone wants another
treat
-
you come
-
and get them as you leave
-
Thank you for today.
-
Thank you for today.
Responses
Was there anything today about which you would like to know more?
- We continued on shading and lighting. Studied about Phong shading, reflectance,
- I would like to know more about bling Phong and reflectance. On the other hand it's was really important to know about interpolation and all the practical examples in class.
- I would like to know more the reason behind the reflection or shadow on the tube surface' artifacts seem like a triangle shape.