SlideShare a Scribd company logo
3D Graphics
• Goal: To produce 2D images of a mathematically
described 3D environment
• Issues:
– Describing the environment: Modeling (mostly later)
– Computing the image: Rendering
Graphics Toolkits
• Graphics toolkits typically take care of the details
of producing images from geometry
• Input:
– Where the objects are located and what they look like
– Where the camera is and how it behaves
– Parameters for controlling the rendering
• Output: Pixel data in a framebuffer
– Data can be put on the screen
– Data can be read back for processing (part of toolkit)
OpenGL
• OpenGL is an open standard graphics toolkit
– Derived from SGI’s GL toolkit
• Provides a range of functions for modelling,
rendering and manipulating the framebuffer
• Why use it? Portable, hardware supported, simple
and easy to program (really!)
• Alternatives: Direct3D, Java3D - more complex
and less well supported respectively
In the Coming Weeks…
• We will look at the math and algorithms on which
OpenGL is built
• We will look at how to access those algorithms in
OpenGL
Coordinate Systems
• The use of coordinate systems is fundamental to
computer graphics
• Coordinate systems are used to describe the
locations of points in space
• Multiple coordinate systems make graphics
algorithms easier to understand and implement
Coordinate Systems (2)
• Different coordinate systems represent the
same point in different ways
• Some operations are easier in one coordinate
system than in another
x
y
(2,3)
u
v
x
y
(1,2)
u
v
Transformations
• Transformations convert points between
coordinate systems
x
y
(2,3)v
x
y
(1,2)
u
v
u
u=x-1
v=y-1
x=u+1
y=v+1
Transformations
(Alternate Interpretation)
• Transformations modify an object’s shape and
location in one coordinate system
x
y
(2,3)
(1,2)
x
y
x’=x-1
y’=y-1
x=x’+1
y=y’+1
2D Affine Transformations
• An affine transformation is one that can be written
in the form:






+











=





′
′
++=′
++=′
y
x
yyyx
xyxx
yyyyx
xxyxx
b
b
y
x
aa
aa
y
x
byaxay
byaxax
or
Why Affine Transformations?
• Affine transformations are linear
– Transforming all the individual points on a line gives
the same set of points as transforming the endpoints
and joining them
– Interpolation is the same in either space: Find the
halfway point in one space, and transform it. Will get
the same result if the endpoints are transformed and
then find the halfway point
Composition of Affine Transforms
• Any affine transformation can be composed as a
sequence of simple transformations:
– Translation
– Scaling
– Rotation
– Shear
– Reflection
2D Translation
• Moves an object






+











=





′
′
y
x
b
b
y
x
y
x
10
01
x
y
x
y
bx
by
2D Scaling
• Resizes an object in each dimension
x
y






+











=





′
′
0
0
0
0
y
x
s
s
y
x
y
x
x
y
x
y
sxx
syy
2D Rotation
• Rotate counter-clockwise about the origin by an
angle θ






+










 −
=





′
′
0
0
cossin
sincos
y
x
y
x
θθ
θθ
x
y
x
y
θ
X-Axis Shear
• Shear along x axis (What is the matrix for y axis
shear?)






+











=





′
′
0
0
10
1
y
xsh
y
x x
x
y
x
y
Reflect About X Axis
• What is the matrix for reflect about Y axis?






+











−
=





′
′
0
0
10
01
y
x
y
x
x x
Rotating About An Arbitrary Point
• What happens when you apply a rotation
transformation to an object that is not at the origin?
• Solution:
– Translate the center of rotation to the origin
– Rotate the object
– Translate back to the original location
Rotating About An Arbitrary Point
x
y
x
y
x
y
x
y
Scaling an Object not at the Origin
• What also happens if you apply the scaling
transformation to an object not at the origin?
• Based on the rotating about a point composition,
what should you do to resize an object about its
own center?
Back to Rotation About a Pt
• Say R is the rotation matrix to apply, and p is the
point about which to rotate
• Translation to Origin:
• Rotation:
• Translate back:
• The translation component of the composite
transformation involves the rotation matrix. What
a mess!
pxx −=′
RpRxpxRxRx −=−=′=′′ )(
pRpRxpxx +−=+′′=′′′
Homogeneous Coordinates
• Use three numbers to represent a point
• (x,y)=(wx,wy,w) for any constant w≠0
• Typically, (x,y) becomes (x,y,1)
• Translation can now be done with matrix
multiplication!




















=










′
′
11001
y
x
baa
baa
y
x
yyyyx
xxyxx
Basic Transformations
• Translation: Rotation:
• Scaling:










100
10
01
y
x
b
b










100
00
00
y
x
s
s









 −
100
0cossin
0sincos
θθ
θθ
Homogeneous Transform Advantages
• Unified view of transformation as matrix
multiplication
– Easier in hardware and software
• To compose transformations, simply multiply
matrices
– Order matters: AB is generally not the same as BA
• Allows for non-affine transformations:
– Perspective projections!
– Bends, tapers, many others
3D Transformations Watt Section 1.1
• Homogeneous coordinates: (x,y,z)=(wx,wy,wz,w)
• Transformations are now represented as 4x4
matrices
• Typical graphics packages allow for specification
of translation, rotation, scaling and arbitrary
matrices
– OpenGL: glTranslate[fd], glRotate[fd], glScale[fd],
glMultMatrix[fd]
3D Translation
























=












′
′
′
11000
100
010
001
1
z
y
x
t
t
t
z
y
x
z
y
x
3D Rotation
• Rotation in 3D is about an axis in 3D space
passing through the origin
• Using a matrix representation, any matrix with an
orthonormal top-left 3x3 sub-matrix is a rotation
– Rows are mutually orthogonal (0 dot product)
– Determinant is 1
– Implies columns are also orthogonal, and that the
transpose is equal to the inverse
3D Rotation
0
:exampleforand
11000
0
0
0
1
=++
























=












′
′
′
yzxzyyxyyxxx
zzzyzx
yzyyyx
xzxyxx
rrrrrr
z
y
x
rrr
rrr
rrr
z
y
x
Problems with Rotation Matrices
• Specifying a rotation really only requires 3
numbers
– Axis is a unit vector, so requires 2 numbers
– Angle to rotate is third number
• Rotation matrix has a large amount of redundancy
– Orthonormal constraints reduce degrees of freedom
back down to 3
– Keeping a matrix orthonormal is difficult when
transformations are combined
Alternative Representations
• Specify the axis and the angle (OpenGL method)
– Hard to compose multiple rotations
• Specify the axis, scaled by the angle
– Only 3 numbers, but hard to compose
• Euler angles: Specify how much to rotate about X,
then how much about Y, then how much about Z
– Hard to think about, and hard to compose
• Quaternions
Quaternions
• 4-vector related to axis and angle, unit magnitude
– Rotation about axis (nx,ny,nz) by angle θ:
• Easy to compose
• Easy to go to/from rotation matrix
• See Watt section 17.2.4 and start of 17.2.5
( ) ( ) ( ) ( )( )2/sin,2/cos,2/cos,2/cos θθθθ zyx nnn
Other Rotation Issues
• Rotation is about an axis at the origin
– Use the same trick as in 2D: Translate to origin, rotate,
and translate back again
• Rotation is not commutative
– Rotation order matters
– Experiment to convince yourself of this
Transformation Tidbits
• Scale, shear etc extend naturally from 2D to 3D
• Rotation and Translation are the rigid-body
transformations:
– Do not change lengths or angles, so a body does not
deform when transformed

More Related Content

What's hot

Lecture 06 geometric transformations and image registration
Lecture 06 geometric transformations and image registrationLecture 06 geometric transformations and image registration
Lecture 06 geometric transformations and image registration
obertksg
 
Biomedical image processing ppt
Biomedical image processing pptBiomedical image processing ppt
Biomedical image processing ppt
Priyanka Goswami
 
Image restoration and degradation model
Image restoration and degradation modelImage restoration and degradation model
Image restoration and degradation model
AnupriyaDurai
 
Chapter 5 Image Processing: Fourier Transformation
Chapter 5 Image Processing: Fourier TransformationChapter 5 Image Processing: Fourier Transformation
Chapter 5 Image Processing: Fourier Transformation
Varun Ojha
 
Fundamental steps in image processing
Fundamental steps in image processingFundamental steps in image processing
Fundamental steps in image processing
PremaPRC211300301103
 
Jpeg standards
Jpeg   standardsJpeg   standards
Jpeg standards
NikhilBanerjee7
 
image compression ppt
image compression pptimage compression ppt
image compression ppt
Shivangi Saxena
 
ImageProcessing10-Segmentation(Thresholding) (1).ppt
ImageProcessing10-Segmentation(Thresholding) (1).pptImageProcessing10-Segmentation(Thresholding) (1).ppt
ImageProcessing10-Segmentation(Thresholding) (1).ppt
VikramBarapatre2
 
discrete wavelet transform
discrete wavelet transformdiscrete wavelet transform
discrete wavelet transform
piyush_11
 
03 image transform
03 image transform03 image transform
03 image transform
Rumah Belajar
 
Chapter 9 morphological image processing
Chapter 9   morphological image processingChapter 9   morphological image processing
Chapter 9 morphological image processing
Ahmed Daoud
 
2d/3D transformations in computer graphics(Computer graphics Tutorials)
2d/3D transformations in computer graphics(Computer graphics Tutorials)2d/3D transformations in computer graphics(Computer graphics Tutorials)
2d/3D transformations in computer graphics(Computer graphics Tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
lalithambiga kamaraj
 
Image degradation and noise by Md.Naseem Ashraf
Image degradation and noise by Md.Naseem AshrafImage degradation and noise by Md.Naseem Ashraf
Image degradation and noise by Md.Naseem Ashraf
MD Naseem Ashraf
 
Edge Detection using Hough Transform
Edge Detection using Hough TransformEdge Detection using Hough Transform
Edge Detection using Hough Transform
Mrunal Selokar
 
Unit ii
Unit iiUnit ii
Digital Image Processing: An Introduction
Digital Image Processing: An IntroductionDigital Image Processing: An Introduction
Digital Image Processing: An Introduction
Mostafa G. M. Mostafa
 
Fundamental steps in Digital Image Processing
Fundamental steps in Digital Image ProcessingFundamental steps in Digital Image Processing
Fundamental steps in Digital Image Processing
Shubham Jain
 
Fundamentals steps in Digital Image processing
Fundamentals steps in Digital Image processingFundamentals steps in Digital Image processing
Fundamentals steps in Digital Image processing
KarthicaMarasamy
 
Image Restoration
Image RestorationImage Restoration
Image Restoration
Poonam Seth
 

What's hot (20)

Lecture 06 geometric transformations and image registration
Lecture 06 geometric transformations and image registrationLecture 06 geometric transformations and image registration
Lecture 06 geometric transformations and image registration
 
Biomedical image processing ppt
Biomedical image processing pptBiomedical image processing ppt
Biomedical image processing ppt
 
Image restoration and degradation model
Image restoration and degradation modelImage restoration and degradation model
Image restoration and degradation model
 
Chapter 5 Image Processing: Fourier Transformation
Chapter 5 Image Processing: Fourier TransformationChapter 5 Image Processing: Fourier Transformation
Chapter 5 Image Processing: Fourier Transformation
 
Fundamental steps in image processing
Fundamental steps in image processingFundamental steps in image processing
Fundamental steps in image processing
 
Jpeg standards
Jpeg   standardsJpeg   standards
Jpeg standards
 
image compression ppt
image compression pptimage compression ppt
image compression ppt
 
ImageProcessing10-Segmentation(Thresholding) (1).ppt
ImageProcessing10-Segmentation(Thresholding) (1).pptImageProcessing10-Segmentation(Thresholding) (1).ppt
ImageProcessing10-Segmentation(Thresholding) (1).ppt
 
discrete wavelet transform
discrete wavelet transformdiscrete wavelet transform
discrete wavelet transform
 
03 image transform
03 image transform03 image transform
03 image transform
 
Chapter 9 morphological image processing
Chapter 9   morphological image processingChapter 9   morphological image processing
Chapter 9 morphological image processing
 
2d/3D transformations in computer graphics(Computer graphics Tutorials)
2d/3D transformations in computer graphics(Computer graphics Tutorials)2d/3D transformations in computer graphics(Computer graphics Tutorials)
2d/3D transformations in computer graphics(Computer graphics Tutorials)
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
Image degradation and noise by Md.Naseem Ashraf
Image degradation and noise by Md.Naseem AshrafImage degradation and noise by Md.Naseem Ashraf
Image degradation and noise by Md.Naseem Ashraf
 
Edge Detection using Hough Transform
Edge Detection using Hough TransformEdge Detection using Hough Transform
Edge Detection using Hough Transform
 
Unit ii
Unit iiUnit ii
Unit ii
 
Digital Image Processing: An Introduction
Digital Image Processing: An IntroductionDigital Image Processing: An Introduction
Digital Image Processing: An Introduction
 
Fundamental steps in Digital Image Processing
Fundamental steps in Digital Image ProcessingFundamental steps in Digital Image Processing
Fundamental steps in Digital Image Processing
 
Fundamentals steps in Digital Image processing
Fundamentals steps in Digital Image processingFundamentals steps in Digital Image processing
Fundamentals steps in Digital Image processing
 
Image Restoration
Image RestorationImage Restoration
Image Restoration
 

Similar to Lecture 9-online

affine transformation for computer graphics
affine transformation for computer graphicsaffine transformation for computer graphics
affine transformation for computer graphics
DrSUGANYADEVIK
 
CO3303-1 Lecture 2.ppt
CO3303-1 Lecture 2.pptCO3303-1 Lecture 2.ppt
CO3303-1 Lecture 2.ppt
KaterinaMantzouni2
 
Introduction to Real Time Rendering
Introduction to Real Time RenderingIntroduction to Real Time Rendering
Introduction to Real Time Rendering
Koray Hagen
 
GeometricTransformations.ppt
GeometricTransformations.pptGeometricTransformations.ppt
GeometricTransformations.ppt
Debjit Doira
 
5_6221983039971394498.pptx
5_6221983039971394498.pptx5_6221983039971394498.pptx
5_6221983039971394498.pptx
NachiketKadlag1
 
Geometric objects and transformations
Geometric objects and transformationsGeometric objects and transformations
Geometric objects and transformations
saad siddiqui
 
Mesh Shape Editing
Mesh Shape EditingMesh Shape Editing
Mesh Shape Editing
ssuser24ddad
 
Transformations in Computer Graphics
Transformations in Computer GraphicsTransformations in Computer Graphics
Transformations in Computer Graphics
JatenderKhatri
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
Bala Murali
 
2d Transformation.pdf
2d Transformation.pdf2d Transformation.pdf
2d Transformation.pdf
Mattupallipardhu
 
Lecture24
Lecture24Lecture24
Intoduction to Computer Appl 1st_coa.pptx
Intoduction to Computer  Appl 1st_coa.pptxIntoduction to Computer  Appl 1st_coa.pptx
Intoduction to Computer Appl 1st_coa.pptx
gadisaAdamu
 
module 3 ppt2 (1).pptx
module 3 ppt2 (1).pptxmodule 3 ppt2 (1).pptx
module 3 ppt2 (1).pptx
RADHIKAB20
 
Overview of Transformation in Computer Graphics
Overview of Transformation in Computer GraphicsOverview of Transformation in Computer Graphics
Overview of Transformation in Computer Graphics
Chandrakant Divate
 
testpang
testpangtestpang
testpang
pangpang2
 
Virtual reality
Virtual realityVirtual reality
Virtual reality
ReachLocal Services India
 
3D Transformation in Computer Graphics
3D Transformation in Computer Graphics3D Transformation in Computer Graphics
3D Transformation in Computer Graphics
sabbirantor
 
september4.ppt
september4.pptseptember4.ppt
september4.ppt
CharlesMatu2
 
3D transformation and viewing
3D transformation and viewing3D transformation and viewing
3D transformation and viewing
Yogita Jain
 
Mk slides.ppt
Mk slides.pptMk slides.ppt
Mk slides.ppt
Tabassum Saher
 

Similar to Lecture 9-online (20)

affine transformation for computer graphics
affine transformation for computer graphicsaffine transformation for computer graphics
affine transformation for computer graphics
 
CO3303-1 Lecture 2.ppt
CO3303-1 Lecture 2.pptCO3303-1 Lecture 2.ppt
CO3303-1 Lecture 2.ppt
 
Introduction to Real Time Rendering
Introduction to Real Time RenderingIntroduction to Real Time Rendering
Introduction to Real Time Rendering
 
GeometricTransformations.ppt
GeometricTransformations.pptGeometricTransformations.ppt
GeometricTransformations.ppt
 
5_6221983039971394498.pptx
5_6221983039971394498.pptx5_6221983039971394498.pptx
5_6221983039971394498.pptx
 
Geometric objects and transformations
Geometric objects and transformationsGeometric objects and transformations
Geometric objects and transformations
 
Mesh Shape Editing
Mesh Shape EditingMesh Shape Editing
Mesh Shape Editing
 
Transformations in Computer Graphics
Transformations in Computer GraphicsTransformations in Computer Graphics
Transformations in Computer Graphics
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
2d Transformation.pdf
2d Transformation.pdf2d Transformation.pdf
2d Transformation.pdf
 
Lecture24
Lecture24Lecture24
Lecture24
 
Intoduction to Computer Appl 1st_coa.pptx
Intoduction to Computer  Appl 1st_coa.pptxIntoduction to Computer  Appl 1st_coa.pptx
Intoduction to Computer Appl 1st_coa.pptx
 
module 3 ppt2 (1).pptx
module 3 ppt2 (1).pptxmodule 3 ppt2 (1).pptx
module 3 ppt2 (1).pptx
 
Overview of Transformation in Computer Graphics
Overview of Transformation in Computer GraphicsOverview of Transformation in Computer Graphics
Overview of Transformation in Computer Graphics
 
testpang
testpangtestpang
testpang
 
Virtual reality
Virtual realityVirtual reality
Virtual reality
 
3D Transformation in Computer Graphics
3D Transformation in Computer Graphics3D Transformation in Computer Graphics
3D Transformation in Computer Graphics
 
september4.ppt
september4.pptseptember4.ppt
september4.ppt
 
3D transformation and viewing
3D transformation and viewing3D transformation and viewing
3D transformation and viewing
 
Mk slides.ppt
Mk slides.pptMk slides.ppt
Mk slides.ppt
 

Recently uploaded

Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
Anant Corporation
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
shadow0702a
 
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENTNATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
Addu25809
 
Hematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood CountHematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood Count
shahdabdulbaset
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
ecqow
 
Certificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi AhmedCertificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi Ahmed
Mahmoud Morsy
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
sachin chaurasia
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
NazakatAliKhoso2
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
gowrishankartb2005
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 

Recently uploaded (20)

Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
 
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENTNATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
 
Hematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood CountHematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood Count
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
 
Certificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi AhmedCertificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi Ahmed
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 

Lecture 9-online

  • 1. 3D Graphics • Goal: To produce 2D images of a mathematically described 3D environment • Issues: – Describing the environment: Modeling (mostly later) – Computing the image: Rendering
  • 2. Graphics Toolkits • Graphics toolkits typically take care of the details of producing images from geometry • Input: – Where the objects are located and what they look like – Where the camera is and how it behaves – Parameters for controlling the rendering • Output: Pixel data in a framebuffer – Data can be put on the screen – Data can be read back for processing (part of toolkit)
  • 3. OpenGL • OpenGL is an open standard graphics toolkit – Derived from SGI’s GL toolkit • Provides a range of functions for modelling, rendering and manipulating the framebuffer • Why use it? Portable, hardware supported, simple and easy to program (really!) • Alternatives: Direct3D, Java3D - more complex and less well supported respectively
  • 4. In the Coming Weeks… • We will look at the math and algorithms on which OpenGL is built • We will look at how to access those algorithms in OpenGL
  • 5. Coordinate Systems • The use of coordinate systems is fundamental to computer graphics • Coordinate systems are used to describe the locations of points in space • Multiple coordinate systems make graphics algorithms easier to understand and implement
  • 6. Coordinate Systems (2) • Different coordinate systems represent the same point in different ways • Some operations are easier in one coordinate system than in another x y (2,3) u v x y (1,2) u v
  • 7. Transformations • Transformations convert points between coordinate systems x y (2,3)v x y (1,2) u v u u=x-1 v=y-1 x=u+1 y=v+1
  • 8. Transformations (Alternate Interpretation) • Transformations modify an object’s shape and location in one coordinate system x y (2,3) (1,2) x y x’=x-1 y’=y-1 x=x’+1 y=y’+1
  • 9. 2D Affine Transformations • An affine transformation is one that can be written in the form:       +            =      ′ ′ ++=′ ++=′ y x yyyx xyxx yyyyx xxyxx b b y x aa aa y x byaxay byaxax or
  • 10. Why Affine Transformations? • Affine transformations are linear – Transforming all the individual points on a line gives the same set of points as transforming the endpoints and joining them – Interpolation is the same in either space: Find the halfway point in one space, and transform it. Will get the same result if the endpoints are transformed and then find the halfway point
  • 11. Composition of Affine Transforms • Any affine transformation can be composed as a sequence of simple transformations: – Translation – Scaling – Rotation – Shear – Reflection
  • 12. 2D Translation • Moves an object       +            =      ′ ′ y x b b y x y x 10 01 x y x y bx by
  • 13. 2D Scaling • Resizes an object in each dimension x y       +            =      ′ ′ 0 0 0 0 y x s s y x y x x y x y sxx syy
  • 14. 2D Rotation • Rotate counter-clockwise about the origin by an angle θ       +            − =      ′ ′ 0 0 cossin sincos y x y x θθ θθ x y x y θ
  • 15. X-Axis Shear • Shear along x axis (What is the matrix for y axis shear?)       +            =      ′ ′ 0 0 10 1 y xsh y x x x y x y
  • 16. Reflect About X Axis • What is the matrix for reflect about Y axis?       +            − =      ′ ′ 0 0 10 01 y x y x x x
  • 17. Rotating About An Arbitrary Point • What happens when you apply a rotation transformation to an object that is not at the origin? • Solution: – Translate the center of rotation to the origin – Rotate the object – Translate back to the original location
  • 18. Rotating About An Arbitrary Point x y x y x y x y
  • 19. Scaling an Object not at the Origin • What also happens if you apply the scaling transformation to an object not at the origin? • Based on the rotating about a point composition, what should you do to resize an object about its own center?
  • 20. Back to Rotation About a Pt • Say R is the rotation matrix to apply, and p is the point about which to rotate • Translation to Origin: • Rotation: • Translate back: • The translation component of the composite transformation involves the rotation matrix. What a mess! pxx −=′ RpRxpxRxRx −=−=′=′′ )( pRpRxpxx +−=+′′=′′′
  • 21. Homogeneous Coordinates • Use three numbers to represent a point • (x,y)=(wx,wy,w) for any constant w≠0 • Typically, (x,y) becomes (x,y,1) • Translation can now be done with matrix multiplication!                     =           ′ ′ 11001 y x baa baa y x yyyyx xxyxx
  • 22. Basic Transformations • Translation: Rotation: • Scaling:           100 10 01 y x b b           100 00 00 y x s s           − 100 0cossin 0sincos θθ θθ
  • 23. Homogeneous Transform Advantages • Unified view of transformation as matrix multiplication – Easier in hardware and software • To compose transformations, simply multiply matrices – Order matters: AB is generally not the same as BA • Allows for non-affine transformations: – Perspective projections! – Bends, tapers, many others
  • 24. 3D Transformations Watt Section 1.1 • Homogeneous coordinates: (x,y,z)=(wx,wy,wz,w) • Transformations are now represented as 4x4 matrices • Typical graphics packages allow for specification of translation, rotation, scaling and arbitrary matrices – OpenGL: glTranslate[fd], glRotate[fd], glScale[fd], glMultMatrix[fd]
  • 26. 3D Rotation • Rotation in 3D is about an axis in 3D space passing through the origin • Using a matrix representation, any matrix with an orthonormal top-left 3x3 sub-matrix is a rotation – Rows are mutually orthogonal (0 dot product) – Determinant is 1 – Implies columns are also orthogonal, and that the transpose is equal to the inverse
  • 28. Problems with Rotation Matrices • Specifying a rotation really only requires 3 numbers – Axis is a unit vector, so requires 2 numbers – Angle to rotate is third number • Rotation matrix has a large amount of redundancy – Orthonormal constraints reduce degrees of freedom back down to 3 – Keeping a matrix orthonormal is difficult when transformations are combined
  • 29. Alternative Representations • Specify the axis and the angle (OpenGL method) – Hard to compose multiple rotations • Specify the axis, scaled by the angle – Only 3 numbers, but hard to compose • Euler angles: Specify how much to rotate about X, then how much about Y, then how much about Z – Hard to think about, and hard to compose • Quaternions
  • 30. Quaternions • 4-vector related to axis and angle, unit magnitude – Rotation about axis (nx,ny,nz) by angle θ: • Easy to compose • Easy to go to/from rotation matrix • See Watt section 17.2.4 and start of 17.2.5 ( ) ( ) ( ) ( )( )2/sin,2/cos,2/cos,2/cos θθθθ zyx nnn
  • 31. Other Rotation Issues • Rotation is about an axis at the origin – Use the same trick as in 2D: Translate to origin, rotate, and translate back again • Rotation is not commutative – Rotation order matters – Experiment to convince yourself of this
  • 32. Transformation Tidbits • Scale, shear etc extend naturally from 2D to 3D • Rotation and Translation are the rigid-body transformations: – Do not change lengths or angles, so a body does not deform when transformed