Mtg 22/23: Mon-02-Dec-2024

Outline for Today

Modelling and Hierarchy

Administration

Today

For Next Meeting

Wiki

Link to the UR Courses wiki page for this meeting

Media

Transcript

Audio Transcript

  • So how's everyone doing Today? I
  • How Does that Sound? Well?
  • So here We are at the
  • so
  • touch a bit on chapter nine today, modeling and hierarchy.
  • So it's our first meeting in December today, and I saw
  • they're putting up a Christmas tree in the Research and
  • Innovation Center,
  • And we have our final exam in a week. I
  • so we're gonna write in here.
  • Yeah, that's about
  • all to sit all there is to be said about that.
  • So I wanted to point out that I uploaded enough I uploaded
  • enough data, filed the matrices. So the first page is the same.
  • Actually, the first two pages are the same at the bottom and
  • talks about the midterm exam
  • question. So we're using the application Matrix,
  • and we Are I
  • so in this case, instead of rotating around, so So With this
  • rotation matrix,
  • what point about which point are we rotating? Just with rotation
  • matrix as it is?
  • Is it 111? I?
  • No, is it the origin?
  • Yes,
  • so what if you want to rotate around a different point.
  • So we have the idea of translating from the
  • the origin to the center and rotation
  • translate center to
  • the origin so this gets applied first.
  • So
  • that's what I've done here. I'm
  • so we're rotating around
  • five minus seven and two and
  • so we have five minus seven and two. That's translate origin to
  • center, and we have a rotation matrix and translate center to
  • origin.
  • So in this case,
  • the rotation portion of the matrix doesn't change. You can
  • see the first three columns are the same as we started with
  • what changes is a translation.
  • So we have minus two plus five, minus seven plus minus seven and
  • minus five plus two. So that gives us
  • this transformation
  • matrix.
  • And so
  • to verify that we have
  • changed the center of rotation,
  • we specify, or we take our center of rotation and apply the
  • transformation matrix to it,
  • and we get
  • the same point. So that means
  • the center of rotation is fixed. Does
  • that make sense?
  • Is that
  • too much excruciating detail?
  • So I also added an
  • example of a tune shader.
  • This is using three
  • js and
  • let's look at look at the vertex shader that
  • large enough to See.
  • So we're getting the vertex attributes for the position, and
  • we're calculating the normal and I'm multiplying by the normal
  • matrix, and
  • then the GL position is
  • transform position multiplied by the ball of U Matrix, by the
  • projection
  • matrix I,
  • so we calculate The Diffuse factor, and here we are using
  • four levels of shading. We're
  • so the idea of The tomb shading is So
  • This look. Like
  • it's meant the same way
  • as the others.
  • Doesn't feel like
  • the light is changing
  • as you don't see the
  • sphere anyway,
  • I think The tourist snot is
  • the nicest looking example there. I
  • so this is copied
  • from the book's website, but they made a simple typo. So
  • this isn't available
  • to click on and experiment without making a change you
  • so here's The figure.
  • You can say it's a robot. Maybe I
  • so talking about hierarchical modeling, the Taurus is at the
  • root, and thing and
  • changes
  • to the tour Taurus torso Part B, impact all the other
  • angles And
  • what position should we Put this figure In? I
  • so what would make This a better program and
  • maybe some realistic constraints on the angles so we're not i
  • doing things a contortionist couldn't do.
  • But what else
  • might make this easier to determine How the figure looks.
  • So This is a
  • variation on
  • sample code that's over it that's been provided, but I've
  • added
  • laying in shaming here.
  • And animation,
  • So I
  • so all three pieces of the robot arm here are made from the same
  • cube. Let's take a look at the source code and
  • so we're doing all the calculation for shading in the
  • vertex shader and the
  • fragment shape were just passing
  • through the colors, so
  • we've computed the intensity at The vertices, and then we
  • interpolate between the vertices and
  • so something interesting here Is that we have a geometry.js,
  • that we're adding a
  • So you've seen something
  • like this before In the labs and elsewhere, I think you
  • so we have a cube object.
  • We can say my cube and give it a side length,
  • if we don't give a length, then we get the unit cube. Then with
  • the cube, we can have texture coordinates, triangle vertices,
  • triangle vertex colors, triangle face colors and triangle normals
  • And
  • and then we can translate scale and rotate and
  • so we also have
  • cylinder object to
  • and a sphere object, then we have
  • a gold material and
  • so we define the ambient, diffuse, specular and shininess
  • values For that gold material, and
  • we have a Light and
  • checkerboard texture which we can apply and
  • so this lets us work With cubes and other shapes, spheres and so
  • on. And
  • so we have 36 vertices, because we have six faces of the cube,
  • two triangles, each with three vertices. So that makes
  • a six times
  • six is 36
  • so in this case, we're specifying parameters as
  • constant. So say the Base Height and Width, lower arm height and
  • width, and the upper arm height and width.
  • So then there are three angles, first one for the base. So we're
  • having a vector of three angles, theta, and the angle at index
  • zero is for the base angle index, one is for the lower arm,
  • and two is for the upper arm. And
  • so here we create a queue and
  • with the gold made from a gold material,
  • and
  • with a basic light and
  • so these are the callbacks For the plane, for the angles of the
  • robot two
  • uniforms, then we have called to function base. So it's using a
  • scale function to change the unit cube into one that has base
  • width and base height
  • and base width. So that's X, Y and Z dimensions.
  • So the instance matrix is positioning the base
  • in space. So
  • then we're multiplying the modeling matrix with the
  • instance matrix, and then we're drawing the base transform by
  • that matrix. And
  • x. So for the upper R,
  • we do a scale, and then we
  • the position the
  • upper arm with a translation, and then you multiply instance
  • matrix by the model view matrix, and then pass passing that
  • transformation matrix to the shader as a uniform,
  • and then we're drawing the vertices again. And the
  • same thing happens with the lower arm.
  • So when you're rendering it you off.
  • I added
  • the function
  • the changes in the angle so they just loop and have
  • the have looked like the robot is a bit of control. I
  • it so based on that enemy,
  • that varying of the angles, so I set The base lower arm and upper
  • arm angles
  • based
  • be based on the ankle sign. So I get it to do something always,
  • and then we
  • render the base and
  • so the first slide in the render the base
  • is going to update the slider
  • with the current value, so It's keeping the interface accurate.
  • So to enter the base, we through the long view matrix as a
  • rotation with the rotation angle of the base around the Y axis,
  • and then we call the base
  • so we set model view matrix
  • outside of base.
  • We call the base and Get that render.
  • Then we we
  • so we've sent first of all the model view matrix to be the
  • rotation of
  • the base
  • and then the render the lower arm. We're multiplying the model
  • V matrix and
  • by the translation. So we're going moving up to the base
  • height, and then we're applying the rotation and
  • here. So we're really doing the rotation and then the
  • translation, because the last the last matrix specified is the
  • first one applied, and then we do the lower arm,
  • and then we do the upper arm. And
  • so the law of U matrix that we're working with accumulates
  • transformation. So we're always at the point of where we need To
  • draw a new piece.
  • Does that make sense? So
  • Okay, I
  • Okay, so,
  • just An Introduction to hierarchical modeling. So we can
  • start with a prototype object, like a cube or a cylinder, and
  • so like in the code, we called my cube
  • to instantiate it,
  • And then we do the transformation, scaling,
  • rotation, translation
  • to put it into the scene,
  • into our Put them into our robot, robotic arm,
  • for example, we
  • so we can think of
  • parts having, each having a transformation, a scale, rotate
  • and translate and
  • right? So that's helpful in the sense that we can think about
  • a primitive,
  • and then we can apply a transformation to it
  • and create
  • a more complicated model based on instancing the same shape
  • over and over again. But if we just
  • list
  • the scaling, rotation and translation, that doesn't tell
  • us about
  • all the parts fit together.
  • So we can think of a
  • car and the chassis and four identical wheels.
  • The rate of forward motion is determined by the rotational
  • speed of the wheels. Does that model of a card
  • have some limitations, or is that a good place To start? You?
  • Four wheels. I
  • so that's okay if
  • we want to go in A straight line and
  • well, we can have an idea
  • of making the Car turn, irrespective of what direction
  • fields are going. I
  • that was
  • about the
  • so this is another representation of the model. It
  • doesn't really reflect the relationships. Either.
  • It's not clear how the speed parameter is
  • impacting the car.
  • Anyway, let's see if we can come to better representation. So
  • graph, we can think of nodes and edges.
  • Edges can be directed or undirected, and the graph can
  • have a cycle, a directed path, and it's a loop.
  • So a tree
  • is a graph, but each node except the root has exactly one parent
  • node. So we start from the root and
  • we go down to leaf nodes. So
  • that's can be an effective way
  • of organizing a model. So if we think of a tree model for the
  • car, we
  • have the chassis, and then we have the four wheels,
  • and there's a parent, child relationship between the chassis
  • and each of the four wheels. It's
  • so here we can think about the wheels being identical, so we
  • have the chassis and wheel,
  • and then
  • each of the directed arrows, directed edges, pardon me,
  • indicates one of the four wheels, so we have right front,
  • right rear, left front and left rear.
  • So dag stands for directed acyclic graph. So We have
  • direction here, and no cycles while.
  • So we can think about how to use these structures to convey
  • information about the model
  • so here's a robot arm and so each of these three are parts.
  • So we have the cylinder base, lower arm and then the upper arm
  • and
  • so we have the instance, we have scaled the instance,
  • so The upper arm is bigger than the lower arm. So
  • assuming the lower arm, this should be the upper arm and
  • so this is an articulated Model,
  • and when we put
  • the pieces together, we're translating to the top of the
  • base and then to the top of the lower arm.
  • And adding the next pieces, we're
  • so following this setup that we've looked at in the code, we
  • can specify the state of the model by giving those three
  • angles and
  • so here are some relationships in The robot arm case
  • so the base rotates independently and
  • and the position of
  • the base
  • is specified by that one rotation angle. Then the lower
  • arm is attached to the base, so its position depends on the
  • rotation of the base must also translate relative to base and
  • rotate above connecting joint.
  • So the upper arm is attached to the lower arm. Its position
  • depends on the base and the lower arm.
  • So they're all connected. So if we think of this in terms of
  • matrices.
  • We have rotation of the base
  • so we can set m to be that first matrix,
  • and we apply and we apply that to the base,
  • and then we translate,
  • translate The lower arm so it's on top of the base,
  • and we rotate lower arm around the joint so we have a have
  • rotate lower arm, translate lower arm and rotate base.
  • So that
  • this matrix will specify the lower arms
  • position,
  • and then we add to that matrix M by doing the same
  • rotation for the upper arm, translation for the upper arm,
  • and then here, the rest
  • of this
  • is determined here.
  • So we're adding on to the matrices.
  • So because we're accumulating the matrix matrices, what
  • happens if we change the order of drawing and
  • You're going to come out as you would expect you
  • No, I Don't think so. I
  • so this is, you can think of this a tree model of the robot.
  • So the base is the root node, and then there's one child of
  • the base, which is the lower arm, and then one child of the
  • lower arm, which is the upper arm, and the upper arm is a leaf
  • node. So there's no more No more pieces we could transform. We
  • could add fingers, appendages, and to the end of the robot arm.
  • We might put spheres in the joints so we don't have obvious
  • points where it doesn't look like the arms. So we're not just
  • touching cube transform cubes to Get the arm, but we Have more
  • convincing representation and
  • that could be a problem. I guess the arm,
  • if we have the physical interpretation of
  • this, the arm
  • is Pushing, will push the pace over, but I haven't I
  • I haven't.
  • So adjusting the sliders, I can have that happen, but in the
  • animation doesn't happen.
  • I so we can think about a structure, how we're going to
  • deal with the data structure,
  • the thing to draw, the matrix
  • relative To the parent
  • and the Children of that parent, I
  • so a more complicated example is the figure I
  • I Don't know what
  • happened to the figure from this
  • drawing
  • didn't make it into figure, dot, HTML example,
  • but the structure is similar. So it's torso is at the root, and
  • we have head, and there are two angles for the head, and then
  • the left upper arm, right upper arm, left upper leg, right upper
  • leg.
  • And then the left lower
  • leg, left lower arm, sorry, right lower arm, left lower leg
  • and right lower leg.
  • So like we did with the base and the upper arm and the lower arm
  • for the robot arm, we can
  • can use functions to
  • organize for
  • and then we have a matrix
  • that can be applied after the torso
  • to move the head and and the upper arms and legs, and then
  • falling down the lower arms and legs.
  • So when we display the figure we're traversing from the torso
  • through the other pieces. I
  • so we talked about 11 angles on the slide before, because there
  • are two head angles, so you can tilt One way and the other.
  • So when we're doing this, think of a stack. We can
  • set the model view matrix
  • and draw the torso, and we set the model view matrix
  • to m times m h1
  • and M h2
  • and then we specify the different pieces.
  • So we're compositing those matrices before we draw slowly,
  • draw the torso and then the right upper arm, the right lower
  • arm. So this is how we traverse and apply the matrices and
  • so here's the idea of using The push and pop operators
  • to save our matrices and
  • so when we get So
  • when we've drawn The left lower arm and it can pump the matrices
  • and then go on to the right upper arm.
  • Sorry, we would push first, then to the right upper arm and the
  • right lower arm, and then
  • Pop at The End and
  • so the idea is that We Get the
  • Yeah, Daryl doesn't figure any more than that.
  • So does that make sense in terms of a general way of of
  • operating? If
  • and you go, questions or concerns.
  • Thank you for today, it
  • doesn't really specify what parameters
  • a lot of you was thinking about
  • the line for option one so it select option One and for option
  • two,
  • and for option one and point elevation,
  • And then the spiral center
  • radius and the height the
  • Okay, okay, thank you for today. So our last meeting on Wednesday
  • will go over towards finish. COVID reports, understand things
  • and reviewing okay. Thanks
  • again to the first day. Take care. Everyone.
  • See you on Wednesday, Happy
  • Spring rocks. You
  • Spring rocks. You

Responses

What important concept or perspective did you encounter today?

  • One of the most important concept I learned in the meeting was the car model hierarchy which includes chassis (the body) and 4 wheels (left, right, front, rear) and the calculations will be a bit different because we need to factor the movement (backward, forward), speed and whether it is moving in straight line. I also learned there are other examples of model hierachy such as the tree and robot arm.
  • I found the additional conversations about matrix multiplication and transformation good to know before the final exam
  • Some important topics from todays meeting were that the final is next week, the matrix multiplication file now has the question from the midterm in it, how toon shading reduces depth/levels in the output, then we went through slides about hierarchical modeling with the example of modeling a car, we also went over graphs and trees for hierarchical modeling, then we ended with stack-based traversal.
  • The discussion on Toon Shading, and a deep dive into what the lines of the fragment shader does shows the creativity and approaches that can be taken in order to create more complex shaders
  • About questions which can be asked in final exams
  • We looked at the figure.html/js and roboticArm.html/js. Moreover, we discussed the hierarchical models.
  • We discussed means of outlining a model through hierarchical graphs such as trees and DAGs. We also looked at ways of coding these models through multiple push/pops of the model view matrix
  • The concept of modeling a car involves using the chassis as the root, attaching four wheels, and understanding how to rotate, translate, scale, and add light to a robotic arm.

Was there anything today that was difficult to understand?

    Was there anything today about which you would like to know more?