Outline for Today
Midterm and Lighting and Shading
Administration
Today
- Midterm
- Lighting and Shading
For Next Meeting
Wiki
Link to the UR Courses wiki page for this meeting
Media
Transcript
Audio Transcript
-
I forgot
-
something. I just forgot
something. Yeah, I
-
time. Okay, it's 232, 230
-
let's see if The projector is
going to work today. You
-
I called them about this on
Monday last week, and I got an
-
email today saying the ticket
was closed. I tried they had
-
done
-
They had done something about
it.
-
Okay, that's looks better.
Fingers crossed.
-
So
-
has anyone heard of fractals
before anyone hear that word?
-
Okay, so I've done a Web GL
program I'll share with you a
-
bit later,
-
that generates shapes like these
and
-
and I just wanted to share with
you.
-
So this is
-
so these are screen captures,
and this little icon is in the
-
middle and says, Apple thinks
this is a plant.
-
So it thinks this is a Norway
maple. And
-
and this one is an aloe vera. So
-
wrote, wrote, wrote a book
called the fractal geometry of
-
nature. He talked about fractal
shape which are self similar,
-
being very good at describing
natural objects.
-
So they were being computer
graphics and
-
some years ago,
-
and like I said, I'll share my
web channel two program with
-
you,
-
just needs a bit of cleaning up.
-
So I thought I'd go over the
midterm. I've started marking
-
it, but I'm not yet complete.
Haven't completed that yet,
-
but I thought we could go Over
the exam questions, does that
-
seem alright?
-
Post a questionnaire for you to
give me some feedback about the
-
exam later today, I
-
so I tried to follow your
suggestions about making short
-
answer Questions. I didn't do
multiple choice per se, but I
-
but what do I want to say I took
a lot of the questions are well,
-
some of them are directly from
the midterm we talked about in
-
class last week. Other ones
questions are rephrased the same
-
material that I was getting
after.
-
So the window is 512 by 512
pixels and
-
what's the width and height of
the clip space? Does it depend
-
on the size of the canvas?
-
Yes, no,
-
I saw one person put their hand
up, maybe more. Yeah, it's not
-
related to the size of the
canvas. Anyone know what the
-
width and height of the clip
space are? Yeah? That's two,
-
because it goes from minus One
to 1x
-
so the proportion is two divided
by 512, one over 256,
-
I also so. People who did one
over 256, squared. That was also
-
a k.
-
So we have a
-
the model in terms of
-
when we get to eclipse space, we
have everything expressed in the
-
range minus one to one, minus
one to one minus one to one. And
-
then we now
-
map that into Window cord.
That's so
-
We're
-
Does that make sense? I
-
so if we had 16 by 16, then we'd
have 25 by 16, one, eight.
-
So
-
we still have the
-
same range
-
between minus one and one, but
we're dividing it much more
-
coarsely, so there's a bigger
proportion. Of the clip space
-
per pixel.
-
Any questions or concerns about
that? I
-
Do you have a question or
Comment? Okay?
-
So we can think of RGB as three
RGB as three coordinate axes. So
-
we go from black to white to
-
so this Hue Saturation and
Value.
-
Looking from the top, we have
Green. Red, Green,
-
Blue, Janta, Cyan and
-
I imagine those are equally
spaced around a circle.
-
So from the side we go, value
zero to one, black to light.
-
These are grays and
-
and we go from white to
-
the pure colors. And
-
so this is s the saturation and
-
so we go, if we have red, let's
say we go from white to
-
different shades of paint, and
we get more and more red until
-
we get to pure red color. I
-
that's just a bit of the
intuition behind it, any
-
questions or concerns? Applause,
-
we create a computer graphics
image, we are Taking
-
continuous renowned, I
-
discretizing it and
-
the fidelity of the represent of
our discrete and
-
the fidelity of our
representation depends on Two
-
Things You
-
so we can see the number of
samples we're taking. We have a
-
camera with how many megapixels
as you can.
-
Have 10 megapixels, so that's a
lot of samples. And the other
-
thing is, how much storage are
we allocating to recording each
-
sample? So if we just have one
bit per sample, we get a very
-
high resolution black and white
image. But if we store 32 or 48
-
bits per pixel per sample, we
get a lot more,
-
A much higher quality
representation.
-
Does that seem Okay? I
-
show between red, green, blue
and sand, Bucha yellow, RGB is
-
additive. CMY is subtractive and
-
so we'll use RGB on displays and
use CLI for printers and
-
bless you.
-
So why do we sometimes have, or
oftentimes have black ink and
-
because if we want to print
something in black, if we don't
-
have black ink, We have to print
it three times in cyan, magenta
-
and yellow, so we in 30 will get
Black. But
-
if we're using ink, the paper
might get soggy.
-
It's much easier to do one pass
with black instead of three
-
passes of full cyan, magenta and
Yellow, Okay,
-
so the object space, we're
thinking
-
of The representation of the
models, cubes, spheres, whatever
-
an image space. We're dealing
with,
-
pixels, screen coordinates and Z
-
buffer is an image space
algorithm, because we're testing
-
the depth of points and clip
space and
-
Ace, is that Okay? Any
questions?
-
Triangle strips and this is the
same question from the midterm
-
we looked at last week, except
are there alternatives? I
-
more efficient than triangles
because we don't have to specify
-
three vertices per triangle, we
can link them together so
-
so Latin will convert the data
into a float, three, Two array
-
that we can pass to Web GL and
-
okay, Then the next three
questions related to This. No,
-
I so let's use For Visible
Surface determination and
-
so we're going To be using the
physical search determination,
-
it has The depth with each of
each pixel. So if depth,
-
new pixel value
-
is less than the
-
store nine And
-
so if the new value that we have
for position on screen, if the
-
depth of the new value is less
than or closer to the viewer,
-
then the one in store e update
that pixel with the new value,
-
And then we update the buffer.
-
Yeah, okay, does That make
sense? I
-
so what three things do we need
for the lookout, a way to
-
specify the position of the
camera i
-
So i is where we're we have our
where the camera is Located, and
-
so we have E and
-
A And then we specify an up
vector and
-
so that gives us two directions,
and then to do The cross product
-
of the vectors we can get. So
-
our moral Thank you, our third
coordinate axis.
-
I Okay.
-
So I gave you some share Code
and JavaScript here some
-
fragments and
-
so I recall that
-
when we talked last week, I
About exam questions that.
-
Questions about, what does this
code Do?
-
Were favored by some people. I
-
so this is a very basic vertex
shader. It's just taking the
-
vertex position that we've set
up in the JavaScript and
-
attached it to the a position
variable. Then the fragment
-
shader is just setting a
constant color.
-
And here's the bit for the
JavaScript file where we're
-
setting up the vertex buffer and
associating a position so the
-
after vertex attribute position
with that variable that links to
-
the shader, the vertex shader.
So
-
okay, so If we're going to make
per vertex colors? What's the
-
first thing?
-
We have to change something in
each of these bits in the vertex
-
shader, the fragment shader and
The JavaScript.
-
Okay, let's start with a vertex
shader. I
-
so we need an a color.
-
And so a color would be in, and
B color would be out, and
-
does That make sense? Okay, what
About the fragment shader I
-
so we carry the color we've
created, we've assigned In the
-
vertex shader as an out V color
gets passed out of the vertex
-
shader, and then we connect it.
Here we say in V color. And
-
then, instead of assigning F
color to be a constant red,
-
1001, and we say f color equals
V color.
-
And so what do we need to do in
the JavaScript? So Buffer. Yeah,
-
so we just, we're going to use
the same structures we have for
-
the vertex buffer, except for
colors, and we're going to make
-
it a four
-
black, four or four positions
per color, and we're
-
going to link The
-
color buffer to a color I
-
so it's this basically, except
-
in the vertex attribute pointer
-
could be color location, And
instead of two, it will be A
-
four and
-
does that seem okay? I
-
so I was being too clever with
this next question. I
-
this is a bug that I encountered
in my own code, the one that
-
generated the fractal shapes
-
so
-
what I could have said in
question 11, I
-
three by three Matrix and
-
and dream do
-
so What the output? So I
-
get that point, since it's
identity matrix, that's not very
-
interesting, but it's easy to do
the math on the board for that.
-
So I have a VEC three that I'm
pushing to
-
positions
-
now the
-
so I have three values for each
position, because I've, I've
-
been pushing back three two
positions. I
-
But what am I telling it to look
for in the second last line? How
-
many? Yeah, two values.
-
And because I flattened it, so I
don't have the idea that, Oh, I
-
just need two of the three
values from the vector, three
-
that are stored in the array.
And
-
so i get i
-
So what happens is, let's say
these are guys are pushed to
-
positions.
-
And I'm going to get a
-
Does that make sense? So we have
data for three
-
positions that were in we're
-
sampling or taking values off
out of that vertex buffer two at
-
a time.
-
Does that make sense? I
-
instead of
-
let's do put them
-
out like this,
-
so 001, 0.5 0.5 the
-
so we get those two,
-
those two, those Two,
-
and those two. So this one is
what you expect. This one too,
-
but these aren't.
-
I really want to have 00, 10,
0.54, 0.5 0.5
-
I've split that over two, so I
should get 00, 0.5 0.5 0.25
-
0.25, and point seven.
-
Does That make sense?
-
Okay? I
-
Does anyone recognize that
Matrix? I
-
Oh, this is in that matrices dot
pdf,
-
so describe The effect of this
transformation, a rotation and
-
you can
-
say more detail about how
coordinates get flipped and
-
so how would I would you go
about computing the
-
transformation matrix At centers
the above rotation at point
-
five minus seven, two. So what
do we need to do?
-
So we had our rotation, but we
want to apply it to a point
-
that's not at the origin, yeah,
I thought you had your hand up.
-
So what do we need to do?
-
Or Yeah,
-
so we can write that as a
-
so we're going to do minus five
plus seven,
-
minus two.
-
Then we're going to apply the
matrix, and then we're going to
-
go
-
five minus seven, two and to
move
-
so we can bring that as
multiplications as I
-
then we can do the rotations,
And then you do
-
three. So we get, I think it's
minus 314, three. I might have
-
the signs mixed up.
-
So how do we verify that we have
the rotation centered at that
-
point, applied to 572,
-
and she had the same one back.
Yeah, that's just like we did in
-
class. We took the center of the
rotation. So because it's the
-
center of the rotation, it's the
fixed point. So the image of the
-
center of rotation under the
rotation is the center. It's the
-
same thing. So yeah, can
-
you go back to number 12? I
think you might have skipped it.
-
It was on that previous page,
-
the last 20. Oh, yeah. How does
it work? You
-
so I've noticed that some people
are answering it after they've
-
made changes in question 10, but
I would say it's it works
-
because we have a good set of
defaults, because things are
-
lined up. And
-
we're looking down the Z axis.
-
So we don't need to do a model
view matrix or projection
-
matrix, to get something to
display on the screen.
-
So then the limitation part,
well, what's the caveat if you
-
want to see something on the
screen?
-
What's the limitation? You have
to have coordinates and what
-
range and
-
I Wonder if we had a minus 10. I
-
would we be able to see
something that has an x
-
coordinate of minus 10? No the
-
minus one work.
-
So the same in y, so the
coordinates have to be in the
-
clip space if they're not they
get clipped. We never see them
-
again.
-
That makes sense. You.
-
So here's, this is chapter Six,
lighting and shading. I
-
so have a look at the code For
shaded cube and
-
shaded cube to the
-
Okay,
-
any questions or concerns. Thank
you for today. Have a great rest
-
of your Monday. See you on
Wednesday. Take care. Thank you
-
for today. Thank
-
you.
-
You're welcome. You
-
You're welcome. You
Responses
What important concept or perspective did you encounter today?
- Going over the midterm examination answers
- The important concept we covered in the meeting today was reviewing the answers to the questions from the Midterm last week.
- Midterm review - checking what I got wrong is indeed pretty helpful.
- Midterm Discussion
- Homogeneous cordinates
- Midterm review. I may have performed more poorly than I thought based on the answers provided in class today
- We looked at the midterm exam questions and solutions.
- Went over the midterm and learned more about lighting and shadings
- Midterm answers, Q11 vertex shaders and transformation matrix
- Discussed the Mid-term paper
- We review the midterm and the professor explain the answers
Was there anything today that was difficult to understand?
Was there anything today about which you would like to know more?