- 46 Views
- Uploaded on
- Presentation posted in: General

SE 313 – Computer Graphics

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

SE 313 – Computer Graphics

Lecture 6: Transformations

Lecturer: GazihanAlankuş

Please look at the last three slides for assignments (marked with TODO)

- Proposals need to have sufficient detail, saying “we’ll create models for our game in SE 320” without explaining the details of your game and the list of models is not enough
- We will e-mail you back feedback about your proposals
- You will start weekly meetings and send individual weekly meeting reports
- Follow these guidelines here (the link is also in the course website): http://homes.ieu.edu.tr/~galankus/teaching/12fall/se313/weeklyreportpolicy.html

- Understand how 3D transformations work in a conceptual level. Supplement this knowledge with practice in Blender.

- Tools for setting the state of objects in space

- Example:
- I have an object that has the points p1 and p2
- Their are (p1x, p1y, p1z) and (p2x, p2y, p2z)

- I want the object to be somewhere else
- Let the object be 3 meters to the right

- I can change the coordinates of these points manually like this: (p1x+3, p1y, p1z) and (p2x+3, p2y, p2z)
- This is tedious, considering that the object may have many points

- Instead, I keep the original coordinate values of the object’s points (local coordinates), and apply a transformation operation to the whole object.

- I have an object that has the points p1 and p2

- I look at the coordinates of a point
- I move the whole object to the right
- The coordinate values of the point did not change
- They were with respect to the pivot point

- I rotate the object, they still do not change
- I do Object->Apply->Rotation&Scaleand Object->Transform->Origin to 3D Cursor
- Now I see that the coordinates of the point have changed, and the pivot point went back to the world’s origin.

- You can manipulate your object without having to forget the original coordinates of your object
- Some more demonstrations in Blender
- Translate
- Rotate
- Scale
- Around what? (earth revolving around sun?)

- What if it is attached to a pole?
- What you are rotating around is important

- Mathematically, rotation is always around the origin (0, 0, 0)
- We will talk about the mathematical background next week

- Therefore, to revolve around some other point, we need to translate first and then rotate

- I said “Translate, and then rotate”
- How is this different?
- (I’ll translate and rotate in blender)

- The order of transformation operations is different!
- Rotate and then translate, translate and then rotate
- Confusing? Let’s make it not confusing!

- Combine and connect them like Legos one after the other

1

2

3

4

1

2

3

4

- When I say “first translate and then rotate” you need to ask “in which order?”
- It’s either world-to-local or local-to-world
- World-to-local: New transformations are applied in the local coordinate frame of the object.
- Local-to-world: New transformations are applied in the world coordinate frame.

- Once you know the order, you know exactly how to apply the transformations

- Games heavily use ordered combination of transformations. Game developers have to be very comfortable with these concepts.
- Implemented as matrices, euler angles, quaternions, etc. (we will see them next week)

- In Blender, combining transformations is not very straightforward. We will do it using parent relationships.

- Every object has three transformations attached to them in this order:
- Translate, rotate, scale (world-to-local)

- We can use the parent-child relationships between objects to combine these transformations
- Parent (translate, rotate, scale)
- Child (translate, rotate, scale)
- Grandchild (translate, rotate, scale)

- Child (translate, rotate, scale)
- You can drag objects in the outliner or select them and do Object->Parent

- Two small cubes, one large cube
- You can use this to implement any order of transformations (by ignoring some in between)
- You can also download a sample of it here:
- http://homes.ieu.edu.tr/~galankus/teaching/12fall/se313/material/day6/chaining%20transformations.blend

- Why should we chain transformations like this anyway?
- If I want to put the box there, I can just use one box, translate it and rotate it to be exactly there.

- It matters when you are animating things.
- You want the Moon to revolve around the Earth, which is also revolving around the Sun.
- You want the robot’s fingers to move with the robot’s arm

- Calculating these separately for each object is very difficult
- Chaining transformations and changing some of the transformations in between makes it simple.

- Go to a frame in the timeline below with right-click dragging
- Set the state of your objects to how you want them to be at that frame (rotate, etc.)
- Select the objects that you want to animate
- Hit Object->Animation->Insert Keyframe…->LocRotScale
- (or others if you want to be more specific)

- Go to step 1 for the next keyframe. Set some keyframes in time and Blender will fill the rest with a smooth animation.

- Part 1:
- Create a yellow sphere for the Sun
- Create a blue sphere for the Earth
- Create a gray sphere for the Moon
- Let the Sun be the parent of the Earth and the Earth be the parent of the Moon (see slide 18)

- Part 2:
- Create an animation to revolve the Earth around the Sun and the Moon around the Earth
- Implement revolving by rotating the parent

- Part 3 (bonus)
- Make the Earth and the Moon rotate around themselves as well without breaking the revolving motion
- Use some visual cues to show that the rotations around themselves are independent of any other motion (e.g. children revolving around them)

- Create a full-body robot.
- You can use scaled cubes and spheres, or your own small models for the pieces of the robot.
- You do not need to create fingers, but I want a nose.
- Animate the robot in a creative way by rotating its body parts.
- Tips:
- You need to use parent-child relationships
- You can place spheres where the joints should be and rotate those spheres.
- Due next week (as usual)