Your SlideShare is downloading. ×
아이폰 3D 프로그래밍 챕터2
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

아이폰 3D 프로그래밍 챕터2

226
views

Published on

블루사이드 스터디 발표 자료 …

블루사이드 스터디 발표 자료

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
226
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. iPhone 3D Programming Chapter 02. Math and Metaphors 2012. 01. 26. Sanghoon LeeSunday, December 9, 12
  • 2. 수학과 비유 Graphics Rendering Pipeline & Metaphor Transforms Matrix stack Vector Beautification with C++ HelloConeSunday, December 9, 12
  • 3. Sunday, December 9, 12
  • 4. What we’re going to study!Sunday, December 9, 12
  • 5. Different kind of topologySunday, December 9, 12
  • 6. Different kind of topology The first argument specifies the topologySunday, December 9, 12
  • 7. Drawing rectangleSunday, December 9, 12
  • 8. Properties with VerticesSunday, December 9, 12
  • 9. Setting vertex properties examplesSunday, December 9, 12
  • 10. Homogeneous coordinates Internally, the OpenGL implementation always converts it into a 4D floating-point number. It’s an artificial construction that allows all transformations to be represented with matrix multiplication. These 4D coordinates are known as homogeneous coordinates. So, shortly after entering the assembly line, all vertex positions become 4D; don’t they need to become 2D at some point? The answer is yes.Sunday, December 9, 12
  • 11. The Life of a Vertex Perspective transform ( removal of w )Sunday, December 9, 12
  • 12. Vertex goes from 4D to 2D Early life of a vertex. Top row is conceptual; bottom row is OpenGL’s viewSunday, December 9, 12
  • 13. Vertex goes from 4D to 2DSunday, December 9, 12
  • 14. The photography metaphor 1. Arrange the various dishes on the table. 2. Arrange one or more light sources. 3. Position the camera. 4. Aim the camera toward the food. 5. Adjust the zoom lens. 6. Snap the picture. 1. Adjust the camera’s field-of-view angle. (projection matrix) 2. Position the camera and aim it in the appropriate direction. (view matrix) 3. For each object: a. Scale, rotate, and translate. (model matrix) b. Render the object.Sunday, December 9, 12
  • 15. ES 1.1 ES 2.0Sunday, December 9, 12
  • 16. Matrix MultiplicationSunday, December 9, 12
  • 17. Model Matrix The three most common operations when positioning an object in a scene Scale Translation RotationSunday, December 9, 12
  • 18. Setting the Model Matrix (Scale)Sunday, December 9, 12
  • 19. Setting the Model Matrix (Scale)Sunday, December 9, 12
  • 20. Setting the Model Matrix (Translation)Sunday, December 9, 12
  • 21. Setting the Model Matrix (Translation)Sunday, December 9, 12
  • 22. Setting the Model Matrix (Rotation ES 1.1) glRotatef(m_currentAngle, 0, 0, 1); counter-clockwise rotation about the Z-axis angle in degrees the latter three arguments define the axis of rotationSunday, December 9, 12
  • 23. Setting the Model Matrix (Rotation ES 2.0)Sunday, December 9, 12
  • 24. Setting the Model Matrix (Rotation) arbitrary axis rotation * ES 1.1 glRotatef generates the matrix for you glRotatef only rotates about the originSunday, December 9, 12
  • 25. Setting the Model Matrix (Rotation) arbitrary axis rotation * ES 2.0Sunday, December 9, 12
  • 26. What we have been throughSunday, December 9, 12
  • 27. Setting the View TransformSunday, December 9, 12
  • 28. Setting the View Transform The simplest way to create a view matrixSunday, December 9, 12
  • 29. Setting the Projection Transform think of the projection as being the cameras "zoom lens"Sunday, December 9, 12
  • 30. Setting the Projection Transform ES 1.1Sunday, December 9, 12
  • 31. Setting the Projection Transform Perspective Orthographic ES 2.0Sunday, December 9, 12
  • 32. Matrix stacksSunday, December 9, 12
  • 33. Matrix stacksSunday, December 9, 12
  • 34. Matrix stacks Only ES 1.1 supports You need to create by yourself in ES 2.0Sunday, December 9, 12
  • 35. InterpolationsSunday, December 9, 12
  • 36. Example of easing equationsSunday, December 9, 12
  • 37. Quaternions For position keyframes and color keyframes Its easy What if interpolating between two orientations?Sunday, December 9, 12
  • 38. Quaternions Storing an angle for each joint would be insufficient youd also need the axis of rotation This is known as Axis-Angle notation requires a total of four floating-point values for each jointSunday, December 9, 12
  • 39. Quaternions Storing an angle for each joint would be insufficient youd also need the axis of rotation Quaternions This is known as Axis-Angle notation requires a total of four floating-point values for each jointSunday, December 9, 12
  • 40. Quaternions Storing an angle for each joint would be insufficient Study of rotation youd also need the axis and This is understand it!! known as Axis-Angle notation requires a total of four floating-point values for each jointSunday, December 9, 12
  • 41. Vector Beautification template <typename T> Vector3 Cross(const Vector3& v) const struct Vector3 { { return Vector3(y * v.z - z * v.y, Vector3() {} z * v.x - x * v.z, Vector3(T x, T y, T z) : x(x), y(y), z(z) {} x * v.y - y * v.x); void Normalize() } { T Dot(const Vector3& v) const float length = std::sqrt(x * x + y * y + z * z); { x /= length; return x * v.x + y * v.y + z * v.z; y /= length; } z /= length; Vector3 operator-() const } { return Vector3(-x, -y, -z); Vector3 Normalized() const } { Vector3 v = *this; bool operator==(const Vector3& v) const v.Normalize(); { return v; return x == v.x && y == v.y && z == v.z; } } T x; T y; T z; };Sunday, December 9, 12
  • 42. Vector Beautification vec3 z; normalize(&z, &(eye-target)); vec3 cross; vec3 z = (eye - target).Normalized(); cross(&cross, &up, &z); vec3 x; vec3 x = up.Cross(z).Normalized(); normalize(&x, &cross); vec3 y = z.Cross(x).Normalized(); cross(&cross, &up, &z); vec3 y; normalize(&y, &cross);Sunday, December 9, 12
  • 43. Hello Cone Fixed FunctionSunday, December 9, 12
  • 44. Hello Cone ShadersSunday, December 9, 12
  • 45. Further study Graphics Rendering pipeline QuaternionSunday, December 9, 12
  • 46. Q/ASunday, December 9, 12

×