Presentation is loading. Please wait.

Presentation is loading. Please wait.

SE 313 – Computer Graphics Lecture 6: Transformations Lecturer: Gazihan Alankuş Please look at the last three slides for assignments (marked with TODO)

Similar presentations


Presentation on theme: "SE 313 – Computer Graphics Lecture 6: Transformations Lecturer: Gazihan Alankuş Please look at the last three slides for assignments (marked with TODO)"— Presentation transcript:

1 SE 313 – Computer Graphics Lecture 6: Transformations Lecturer: Gazihan Alankuş Please look at the last three slides for assignments (marked with TODO) 02.11.20121

2 Projects 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 02.11.20122

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

4 3D Transformations Tools for setting the state of objects in space 02.11.20124

5 3D Transformations 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. 02.11.20125

6 Example in Blender 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&Scale and 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. 02.11.20126

7 3D Transformations are useful 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?) 02.11.20127

8 Making the Earth revolve around the Sun What if it is attached to a pole? What you are rotating around is important 02.11.20128

9 How do you rotate around an arbitrary position? 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 02.11.20129

10 Order of Transformations 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! 02.11.201210

11 Intuitive Understanding of Combining Transformations 02.11.201211

12 Intuitive Understanding of Combining Transformations Combine and connect them like Legos one after the other 02.11.201212

13 Combining Transformations Order: Insert new ones near the object (world-to-local) 02.11.201213 12 34

14 Combining Transformations Order: Insert new ones near the wall (local-to-world) 02.11.201214 12 34

15 Ordering Transformation Combinations 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 02.11.201215

16 Implementation 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. 02.11.201216

17 Blender and Transformations Every object has three transformations attached to them in this order: – Translate, rotate, scale (world-to-local) 02.11.201217

18 Blender and Transformations 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) You can drag objects in the outliner or select them and do Object->Parent 02.11.201218

19 Let’s do it 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/se 313/material/day6/chaining%20transformations.blen d http://homes.ieu.edu.tr/~galankus/teaching/12fall/se 313/material/day6/chaining%20transformations.blen d 02.11.201219

20 Question: Why? 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. 02.11.201220

21 Answer: Animation! 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. 02.11.201221

22 Animating in Blender 1.Go to a frame in the timeline below with right-click dragging 2.Set the state of your objects to how you want them to be at that frame (rotate, etc.) 3.Select the objects that you want to animate 4.Hit Object->Animation->Insert Keyframe… ->LocRotScale (or others if you want to be more specific) 5.Go to step 1 for the next keyframe. Set some keyframes in time and Blender will fill the rest with a smooth animation. 02.11.201222

23 Lab Assignment 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) 02.11.201223

24 TODO: Homework 4 (deliverable) 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) 02.11.201224


Download ppt "SE 313 – Computer Graphics Lecture 6: Transformations Lecturer: Gazihan Alankuş Please look at the last three slides for assignments (marked with TODO)"

Similar presentations


Ads by Google