Outline for Today
Geometric Objects and Transformations
Administration
Today
- Happy 1st meeting of October
- will be grading for thoughtfulness of responses from today forward
*October 11 will have 50th anniversary events related to Computer Science
- Pierre Lemire (BSc ‘87), CEO of Kent Imaging will give a presentation at 3:30 in the Education Auditorium
- for a lunchtime event, would you prefer sandwiches and wraps or pizza?
- Chapter 4 Code
For Next Meeting
Wiki
Link to the UR Courses wiki page for this meeting
Media
Transcript
Audio Transcript
-
Okay, Okay.
-
So Happy first meeting of
October, they were
-
going to enjoy the two
transition from 31 to
-
13 and
-
rain in the wind.
-
Error, he here.
-
So I want to talk about October,
11. I
-
so that's the day that we're
going
-
to be having
-
an event for The theme of the
50th
-
anniversary of the university. I
-
thank you. I so We have our
guest. I
-
So he was a contemporary of mine
in The undergraduate program.
-
He's now CEO of Kent imaging. He
-
does that sound like somebody
would be interesting to even
-
talk with? I
-
Okay,
-
there wasn't a correct answer
there,
-
but I went to get your input,
-
because there's a
-
tragic set of circumstances here
at university. I think there's
-
no peace on campus presently who
-
thinks us no age,
-
it's not clear, because there's
so many food service places that
-
are boarded up,
-
but apparently they don't have
pizza as an option to order for
-
Food Services.
-
So
-
we can order
-
pizza from off campus.
-
So would you like to would you
I?
-
Do you think a lunchtime event
would be something you could
-
you might take in on the 11th?
-
Okay? I
-
And if we have a choice between
sandwiches and rats and pizza,
-
who votes for pizza? You don't
have to commit to going to the
-
lunch and
-
and who votes for sandwiches and
rats? Oh, strong showing for
-
sandwiches and rats. So I
-
Is that a true statement of the
fact that you can get free food,
-
that's that's the biggest
factor.
-
Okay,
-
I'll be sending a note out
-
tonight or tomorrow with some
more particular details. This
-
will be
-
recorded and available
-
later. So this is in the regular
seminar slot for The Department
-
i Okay,
-
down to Business here for
-
so
-
points are you can draw points
on the screen and
-
we can approximate well,
-
they don't have any size or
shape or
-
they are
-
Just a location space i
-
What else Do we need?
-
Time points to describe
geometric objects that we'd like
-
to render on the screen
measures.
-
I enough to get a space there,
-
because
-
nationals are important a
triangular mesh is an important
-
way to represent objects, to
model them.
-
So how do we get to think about
the triangles?
-
So
-
if we start with points,
-
scalars. So What are they?
-
Can be real numbers, maybe
complex numbers,
-
usually real and
-
so if you think about the
distance between points, this
-
is between 00, and one, zero is
one
-
as a scalar.
-
And vectors.
-
So what's going on with vectors,
direction
-
and direction? So
-
so we can think of
-
directed line segments and
-
so if two vectors have the same
direction and magnitude,
-
They're the same because they
don't have a position what if
-
there
-
were 10 years? I factors. Yeah,
-
so.
-
I diving. So we can talk about
it as a frame. So we have
-
vectors plus two. We have
vectors
-
x, y and z. We could
-
have, we could think of the most
unit vectors along the X, Y and
-
Z axes and
-
so we don't usually think of
them being drawn that way, but I
-
so we can put them in
-
together that way.
-
So what hand?
-
What handed, which handed
coordinate system Is that
-
in here? Yeah, I
-
so when we're thinking about
computer graphics,
-
We might deal with a number of
different frames and
-
so you might think, first of
all, object frame.
-
So the thing, the primitives
that
-
we are going to work with,
-
we define them on their own
coordinate
-
system, in their own frame.
That's convenient. We have Q
-
define it from the origin and
-
should I try that again? I
-
looks more parallel, but it's
still not I
-
it. So you can take the cube and
say, We want to make it. You can
-
scale it, rotate it, translate
it into
-
our model.
-
And we might think of many cubes
-
from the models or making the
transformation from the object,
-
spade, object frame
-
of the cube into
-
the world coordinates that,
pardon me, into the Model
-
coordinates and
-
so then we're putting them into
-
this new frame
-
where the transform
-
objects
-
are
-
in one frame together.
-
There's one origin and so on
-
What other frames to deal with,
I
-
any thoughts i
-
What about a camera frame? So
-
when we're taking pictures of
the camera.
-
How do we
-
specify the three three vectors
for the
-
of the frame and the origin and
-
so We can think of the eye or
the camera, and
-
at the origin here.
-
So what if I want to take a
picture of
-
the exit sign here
-
we described
-
The screen so
-
I have the camera here.
-
That's a position in
-
space, x, y and Z, and I'm
looking At the sign I'm
-
okay,
-
still doesn't look like he's
running, but so I have a
-
position for the camera. I'm
looking at something like the
-
chair. So that's one direct I
can have that direction. I have
-
the vector going from the camera
to the chair or whatever I'm
-
looking at.
-
What else do I need to specify
the coordinates i
-
What if I want To take a
portrait picture
-
or an angled picture,
-
which way is up and
-
and then we can make the third
vector by
-
the cross product of look at and
up and
-
so that's the core camera frame.
I
-
what other you mentioned one set
of coordinates the other Day
-
that was I
-
can you Imagine this is A key
again. So
-
so that's another frame
-
that we're getting
-
the world, which might be
hundreds of 1000s of kilometers,
-
and we squish it into
-
the clip or
-
depth frame to the
-
together, ready to display. I
-
so we had a window
-
frame as well. And
-
that relates to the viewport
-
that we set up and
-
does that make sense?
-
So we can Do transformations
between them. Do
-
so We Can You
-
so let's look at A matrix to do
scaling I
-
so We can have so it starts with
A Okay,
-
so the identity matrix so
-
so if We apply a negative scale
factor, we get reflections and
-
So we want to preserve the
object would just reflect around
-
y,
-
so we could apply a scale factor
of y minus one. What if
-
we Want to translate the point?
I
-
so we take the hard scale
-
and maintenance you
-
And then we have
-
So we apply
-
transformation and
-
so We multiply our point, p1 px,
-
py, pz, by our transformation
matrix, and then we would add a
-
translation component. So that's
not Very effective or efficient.
-
I so using the homogeneous
coordinates,
-
we have the 3d affine
-
transformation.
-
Simple example is the scaling
matrix. So we have
-
suspects and and
-
now we can do
-
to specify the translation
vector in the same matrix, so
-
then we have Tx
-
equal I instead.
-
So points
-
are represented as
-
four tuple, so we have x, y, z
and w.
-
So w is often one, but for
points, we
-
convert them to three dimensions
and
-
so we can think of lights w
equal
-
to one and vectors W equal to
zero. And
-
okay, so the idea is that
-
we can, in our rendering
pipeline, we
-
can transform our world
coordinates
-
into Window coordinates by doing
a series of
-
transformations you
-
so when I look at the cube,
rotating cube, this is Coda
-
sound from chapter four. So
-
So if we're looking in the z
direction, which X are we
-
rotating on here to Begin with
you
-
so if We're out here somewhere,
-
is It Z?
-
No, it's an X, Y, I think it's
x.
-
Let's do rotating or y. I
-
Does that make sense? And
-
we can add rotations as well? I
-
if you stare the blind enough
with false feeling, maybe go.
-
Just did hypnosis. You
-
so eventually you're getting a
rotation around the center and
-
the axis of rotation is a
combination of x, y and z
-
angles. So that's as finite
controls are given in this
-
example. Let's check out the
source code for this.
-
Okay, so the vertex shader, so
we have uniform VEC 3u theta, so
-
the angle is a uniform and so we
have X, Y and Z values as part
-
of the VEC three we're passing
for u, theta. And then the first
-
thing is to compute the size of
cosines of theta for each of the
-
three axis and one computation.
-
So it's converting the angles
into radians and then computing
-
vectors of cosines and sines
based on the rate the the angles
-
specified in radians. So then.
So you'll notice, as you look
-
through examples of the code
that this typo has repeated many
-
times over.
-
So what does it mean that
matrices are in column major
-
order? I
-
Yes. So a column major means
that we're putting the column,
-
putting them together in
columns. So
-
the first formula is going to
the first column. Next four
-
going to the second column, the
next four go in the third
-
column, and the last four going
to the last column, and the
-
fourth, fourth and last column.
Does that make sense? So these
-
are the way. This is the way to
define rotation matrices around
-
the X, Y and Z axes, so using
the dot notation here to specify
-
the x component of the vector,
the y component of the vector
-
and the z component of the
vector. Vector is the cosine.
-
So the vertex color is taken
from the attribute color that we
-
specify in the JavaScript
program. And GL position is our
-
attribute position that we've
started with, the our initial
-
cube that we specified in the
JavaScript code. And then we're
-
applying
-
X, Y and Z rotations to
determine new position.
-
And then the vertex, the private
shirt is just passing through
-
the color and
-
so we're specifying a cat. This
is 512 by 512 so let's look at
-
the pupa js to see what's going
on there. We're
-
so why do we have none positions
as 36 so
-
secured by three or six sides.
-
So How many faces?
-
Four,
-
six, I?
-
And so how many? So
-
we're not going to represent
them as squares, because squares
-
might be non planar. So how many
triangles make up a square? Two?
-
Two, yeah, two triangles.
-
So now we've got 12. How
-
do we roll? So what's what?
-
What do we need three of them
for each triangle.
-
So we have three vertices. So
-
three vertices per triangle. So
six times two times three is 36
-
so we're going to generate we're
going to store 36 positions. We
-
can do better than that. You
don't have to store because how
-
many vertices are there? Not Q?
I?
-
So there's four on the top and
four on the bottom.
-
So we can use a more efficient
way to
-
you can look at that for
yourselves, and we'll talk about
-
it some more as well. Okay, so
10 minutes left, let's see
-
what's going on here.
-
Okay, so we do the standard
stuff. So we define so we have
-
the red GL to campus, get the
context, and we set the set up
-
the viewport. And we enable
depth tests so that we're using
-
the Z buffer loading shades,
-
and you're restoring colors and
the colors is defined.
-
Okay, so color cube is called
first, so that sets up the
-
colors. So we're taking that
brain that We've set up and
-
flattening it.
-
So we put the colors there, and
now we're giving the A color.
-
We're linking that to the
attribute, so it's a four RGBA
-
that we're passing as the color
locate, color value, Color
-
attribute,
-
and then we're
-
storing the vertex data, another
array there, and then we're
-
associating with the variable in
the shader. And then finally, we
-
do the uniform variable for the
theta, the X, Y and Z angles. So
-
if we click on the on the X
button in the interface that we
-
get when we set the axis to X, Y
and Z and we go to Render and
-
so in a render, we set the color
bit, and we're doing the clear
-
of the color bit and the theft
buffer bit, so we're resetting
-
the Z buffer and resetting The
screen to be the background
-
cover that we set. So the thing
we do is we increment the angle
-
by two degrees, depending on
which axis we've chosen, and
-
then we set it. We connect the
value that we've just said in
-
theta to the uniform variable in
the shader. We say, draw arrays,
-
draw triangles to start at zero.
We go for 36 positions, and we
-
say, request animation frame for
render. So that's the rendering.
-
Use
-
the color key. So we do quads.
So there are six calls to quad.
-
And so they will be given the
vertices. So 1032,
-
so we start with so the first
quad is minus point five, point
-
5.5, and one. And zero is minus
point five, minus point 5.5,
-
and one and
-
then then three minus or point
five minus point 5.5, and one
-
and two is point five point 5.5,
And one.
-
So we specify the vertices of
the quad based on our input to
-
the function, and then we also
have colors, vertex Colors and
-
so we're so we take the indices,
so we're taking the quad face
-
and dividing the two triangles.
That means the four vertices
-
have become six because we're
duplicating vertices, so we have
-
three vertices for each
triangle.
-
So you can see A, B, C, A, C, D,
so A and C are repeated.
-
So that's the way to describe
the two triangles that
-
correspond to the one face the
cube.
-
They've commented on the
-
stuff that assigns different
colors to each vertex. So just
-
using solid colors so for each i
-
So for each vertex, we're
pushing the same color. So A is
-
C,
-
see. So A is one for the first
squad. So we're going to color
-
the those two triangles red. So
the face is going to be red for
-
that.
-
Okay?
-
So, what would happen if we had
a bigger Q instead of minus
-
point five to plus point five in
x, y and z? What if it was one
-
minus one to one? I?
-
Because we're not specifying the
details of the transformation,
-
so we're relying on our
coordinates after our from the
-
vertex shader to be in the minus
one to plus one range. Does that
-
make sense? So if you experiment
and make just take this naive
-
implementation of the code and
would change the vertex
-
vertices, and you won't be able
to see the whole cube anymore.
-
So we'll talk about transforming
objects, we're going to apply
-
the same transformations to
viewing that's in the next
-
chapter, and we'll see how we
can how we
-
can work with the clipping
frame, clip coordinate frame.
-
It's a feature, not a bug, that
-
we have to put everything
careful about keeping things in
-
the minus one to plus one range,
the pipe where we set the
-
pipeline will handle that for
us. Anyway. Does that make
-
sense? Any questions or
concerns?
-
So we'll talk a bit more about
-
viewing transformations. Next
-
day, we'll get into chapter five
as well.
-
Okay, thank you for today.
-
Have a good weekend.
-
Take care, everyone. Thank you
-
for today.
-
You
-
You
Responses
What important concept or perspective did you encounter today?
- The important concept I learned from last meeting was that we use matrices to represent vectors, and other types of coordinates in order to make a geometric objects/model. We use 4x4 matrix for homogenous coordinates and 3x3 matrix for vector scale. However, the matrice depends upon the object we are creating thus we will have to adjust or change representation by modifying the coordinates.
- Transformation matrices! I cannot wait to talk about quaternions >:3
- The scaling matrix, translation, and rotation matrices that make up the points of every object in a scene, and how we interact with them in order to be able to properly perform transformations to each matrix, cause that was the main aspect of Linear Algebra I
- Geometric object + Transformation and Camera
- The concept of producing reflections which is as easy as applying a negative scale factor to transform the matrix. It made a lot of sense to me.
- Geometric objects and Transformation, Things needed to define/render an object on screen, different frames that deal with CG, coordinate system and 3d rotating cube's code
- how we can showcase both a vector and translation matrices together in one 4d matrix
- Today, I learned about geometric objects and transformations. Scalars represent quantities like distance. A point indicates a location in space without size, while a vector shows direction. Vectors require an origin and basis vectors to define a frame. I learned different frames in the graphics rendering pipeline: object, model, camera/eye, and clip coordinates. I also studied 4x4 matrices in homogeneous coordinates and a cube program.
- The geometric objects including points, scalars, vectors, meshes and their definition
Was there anything today that was difficult to understand?
- Sierpenski Gasket
- No
- Why for the homogeneous matrix we use 1 points and 0 for vectors
Was there anything today about which you would like to know more?
- I would like to know more about how to easily identify which axis something is spinning on.
- I would like to know more about how rotation is calculated. I couldn't quite see it in cube.html, unless there was something I missed. I've had a similar problem in this course's first lab because the variable for rotation was also used to calculate speed and I could not find a way to create them as separate variables.
- I would like to know more about camera/eye frames and how exactly they work
- I would like to know more about how we can represent points and transforms as vec4's and 4x4 matrices. What other kinds of transformations can we represent with a 4x4 matrix? Can we do rotations?
- The different kinds of coordinate systems, when to use them, why they were originally developed. Especially why Blender decided to have Z as the up/down axis.
- coordinate systems seem to be similar to the frames we learnt about? is that so? like object space = object, world space = Model, view space = camera/eye, clip = projection space
- it was mentioned that a cube could be represented in 3d using only 8 points, a showcase of this would be very interesting
- It was all clear and we understood most !