SlideShare a Scribd company logo
Computer Graphics Hardware
GPU 
 GPU computing is the use of a GPU (graphics 
processing unit) together with a CPU to accelerate 
general-purpose scientific and engineering 
applications. 
 Pioneered five years ago by NVIDIA, GPU 
computing has quickly become an industry standard. 
 CPU + GPU is a powerful combination because CPUs 
consist of a few cores optimized for serial 
processing, while GPUs consist of thousands of 
smaller, more efficient cores designed for parallel 
performance. 
 Serial portions of the code run on the CPU while 
parallel portions run on the GPU.
GPU
THE CUDA 
 The CUDA parallel computing platform 
provides a few simple C and C++ extensions 
 Its GeForce 256 GPU is capable of billions of 
calculations per second, can process a 
minimum of 10 million polygons per second, 
and has over 22 million transistors, compared 
to the 9 million found on the Pentium III.
Pixels and Frame 
 All modern displays are raster-based. A raster is a 2D 
rectangular grid of pixels (or picture elements). 
 A pixel has two properties: a color and a position. 
 Color is expressed in RGB (Red-Green-Blue) 
components - typically 8 bits per component or 24 
bits per pixel (or true color). 
 The position is expressed in terms of (x, y) 
coordinates. The origin (0, 0) is located at the top-left 
corner, with x-axis pointing right and y-axis 
pointing down. 
 This is different from the conventional 2D Cartesian 
coordinates, where y-axis is pointing upwards.
 The number of color-bits 
per pixel is called 
the depth (or precision) of 
the display. 
 The number of rows by 
columns of the 
rectangular grid is called 
the resolution of the 
display, which can range 
from 640x480 (VGA), 
800x600 (SVGA), 
1024x768 (XGA) to 
1920x1080 (FHD), or 
even higher.
Frame Buffer and Refresh Rate 
 The color values of the pixels are stored in a special 
part of graphics memory called frame buffer. 
 The GPU writes the color value into the frame buffer. 
 The display reads the color values from the frame 
buffer row-by-row, from left-to-right, top-to-bottom, 
and puts each of the values onto the screen. 
 This is known as raster-scan. 
 The display refreshes its screen several dozen times 
per second, typically 60Hz for LCD monitors and 
higher for CRT tubes. This is known as the refresh 
rate. 
 A complete screen image is called a frame.
Double Buffering and VSync 
 While the display is reading from the frame buffer to 
display the current frame, we might be updating its 
contents for the next frame (not necessarily in raster-scan 
manner). 
 This would result in the so-called tearing, in which the 
screen shows parts of the old frame and parts of the new 
frame. 
 This could be resolved by using so-called double buffering. 
 Instead of using a single frame buffer, modern GPU uses 
two of them: a front buffer and a back buffer. 
 The display reads from the front buffer, while we can write 
the next frame to the back buffer. When we finish, we 
signal to GPU to swap the front and back buffer (known 
as buffer swap or page flip).
 Double buffering alone does not solve the entire 
problem, as the buffer swap might occur at an 
inappropriate time, for example, while the 
display is in the middle of displaying the old 
frame. 
 This is resolved via the so-called vertical 
synchronization (or VSync) at the end of the 
raster-scan. 
 When we signal to the GPU to do a buffer swap, 
the GPU will wait till the 
next VSync to perform the 
actual swap, after the entire 
current frame is displayed.
 The most important point is: When the VSync 
buffer-swap is enabled, you cannot refresh 
the display faster than the refresh rate of the 
display!!! 
 For the LCD/LED displays, the refresh rate is 
typically locked at 60Hz or 60 frames per 
second, or 16.7 milliseconds for each frame.
3D Graphics Rendering Pipeline 
 A pipeline, in computing terminology, refers 
to a series of processing stages in which the 
output from one stage is fed as the input of 
the next stage, similar to a factory assembly 
line or water/oil pipe. 
 With massive parallelism, pipeline can greatly 
improve the overall throughput. 
 In computer graphics, rendering is the process 
of producing image on the display from 
model description.
 The 3D graphics rendering pipeline consists 
of the following main stages
Stage 1 
 Vertex Processing: Process and transform 
individual vertices. 
A vertex has attributes: position, color, vertex 
Normal
Vertices 
 A vertex, in computer graphics, has these 
attributes: 
1. Position in 3D space V=(x, y, z): typically 
expressed in floating point numbers. 
2. Color: expressed in RGB (Red-Green-Blue) or 
RGBA (Red-Green-Blue-Alpha) components.
Vertices continue… 
Texture 
we often wrap a 2D image to an object to make it 
seen realistic. 
A vertex could have a 2D texture coordinates (s, t), 
which provides a reference point to a 2D texture 
image.
Vertex-Normal 
Vertex-Normal N=(nx, ny, nz): 
the normal vector is perpendicular to 
the surface. 
Normals are used to differentiate the 
front- and back-face, and for other 
processing such as lighting. 
Right-hand rule (or counter-clockwise) 
is used in OpenGL. The 
normal is pointing outwards, 
indicating the outer surface (or 
front-face).
 In modern GPUs, the vertex processing stage 
and fragment processing stage are 
programmable. 
 You can write programs, known as vertex 
shader and fragment shader to perform your 
custom transform for vertices and fragments. 
 The shader programs are written in C-like 
high level languages such as GLSL (OpenGL 
Shading Language), 
 HLSL (High-Level Shading Language for 
Microsoft Direct3D), 
 or Cg (C for Graphics by NVIDIA).
Vertex Processing ….. In-depth 
 Coordinates Transformation 
 The process used to produce a 3D scene on the 
display in Computer Graphics is like taking a 
photograph with a camera. 
 It involves four transformations: next slide…..
1. Arrange the objects (or models, or avatar) in the 
world (Model Transformation orWorld 
transformation). 
2. Position and orientate the camera (View 
transformation). 
3. Select a camera lens (wide angle, normal or 
telescopic), adjust the focus length and zoom 
factor to set the camera's field of view 
(Projection transformation). 
4. Print the photo on a selected area of the paper 
(Viewport transformation) - in rasterization 
stage 
A transform converts a vertex V from one space (or coordinate system) to another 
space V'. In computer graphics, transform is carried by multiplying the vector with 
a transformation matrix, i.e., V' = M V.
Model Transform (or Local Transform, or World 
Transform) 
 Each object (or model or avatar) in a 3D scene 
is typically drawn in its own coordinate 
system, known as its model space (or local 
space, or object space).
Model Transform (or Local Transform, or World 
Transform) cont… 
 As we assemble the objects, we need to 
transform the vertices from their local spaces 
to the world space, which is common to all 
the objects. This is known as the world 
transform. 
 The world transform consists of a series of 
scaling (scale the object to match the 
dimensions of the world), rotation (align the 
axes), and translation (move the origin).
 In OpenGL, a vertex V at (x, y, z) is 
represented as a 3x1 column vector: 
 Other systems, such as Direct3D, use a row 
vector to represent a vertex.
Scaling 
 3D scaling can be represented in a 3x3 matrix: 
 where αx, αy and αz represent the scaling 
factors in x, y and z direction, respectively. 
 If all the factors are the same, it is 
called uniform scaling.
Scaling count.. 
 We can obtain the transformed result V' of 
vertex V via matrix multiplication, as follows:
Rotation 
 3D rotation operates about an axis of 
rotation (2D rotation operates about a center 
of rotation). 3D Rotations about 
the x, y and z axes for an angle θ (measured in 
counter-clockwise manner) can be 
represented in the following 3x3 matrices: 
The rotational angles about x, y and z axes, denoted as θx, θy and θz, are known 
as Euler angles, which can be used to specify any arbitrary orientation of an object. 
The combined transform is called Euler transform.
Translation 
 Translation does not belong to linear 
transform, but can be modeled via a vector 
addition, as follows:
 Fortunately, we can represent translation using a 
4x4 matrices and obtain the transformed result 
via matrix multiplication, if the vertices are 
represented in the so-called 4- 
component homogenous coordinates (x, y, z, 1), 
with an additional forth w-component of 1. 
 The significance of the w-component later in 
projection transform. 
 In general, if the w-component is not equal to 1, 
then (x, y, z, w) corresponds to Cartesian 
coordinates of (x/w, y/w, z/w). If w=0, it 
represents a vector, instead of a point (or vertex).
 Using the 4-component homogenous 
coordinates, translation can be represented 
in a 4x4 matrix, as follows:
 The transformed vertex V' can again be 
computed via matrix multiplication:
Summary of Transformations
Transformation of Vertex-Normal 
 Recall that a vector has a vertex-normal, in 
addition to (x, y, z) position and color. 
 Suppose that M is a transform matrix, it can be 
applied to vertex-normal only if the transforms 
does not include non-uniform scaling. 
 Otherwise, the transformed normal will not be 
orthogonal to the surface. For non-uniform 
scaling, we could use (M-1)T as the transform 
matrix, which ensure that the transformed 
normal remains orthogonal.
View Transform 
 After the world transform, all the objects are 
assembled into the world space. We shall now 
place the camera to capture the view.
Positioning the Camera 
 In 3D graphics, we position the camera onto 
the world space by specifying three view 
parameters: EYE, AT and UP, in world space. 
 The point EYE (ex, ey, ez) defines the location 
of the camera.
Positioning the Camera 
 The vector AT (ax, ay, az) denotes the direction 
where the camera is aiming at, usually at the 
center of the world or an object.
Positioning the Camera 
 The vector UP (ux, uy, uz) denotes the upward orientation 
of the camera roughly. UP is typically coincided with the 
y-axis of the world space. 
 UP is roughly orthogonal to AT, but not necessary. As UP 
and AT define a plane, we can construct an orthogonal 
vector to AT in the camera space.
 In OpenGL, we can use the GLU 
function gluLookAt() to position the camera: 
 The default settings of gluLookAt() is: 
That is, the camera is positioned at the origin (0, 0, 0), aimed into the screen 
(negative z-axis), and faced upwards (positive y-axis). To use the default settings, 
you have to place the objects at negative z-values.
Computing the Camera Coordinates 
 From EYE, AT and UP, we first form the coordinate 
(xc, yc, zc) for the camera, relative to the world space. We 
fix zc to be the opposite of AT, i.e., AT is pointing at the - 
zc. We can obtain the direction of xc by taking the cross-product 
of AT and UP. Finally, we get the direction 
of yc by taking the cross-product of xc and zc. Take note 
that UP is roughly, but not necessarily, orthogonal to AT.
Transforming from World Space to 
Camera Space 
 Now, the world space is represented by 
standard orthonormal bases (e1, e2, e3), 
where e1=(1, 0, 0), e2=(0, 1, 0) and e3=(0, 0, 1), 
with origin at O=(0, 0, 0). The camera space 
has orthonormal bases (xc, yc, zc) with origin 
at EYE=(ex, ey, ez). 
 It is much more convenience to express all 
the coordinates in the camera space. This is 
done via view transform.
 The view transform consists of two 
operations: a translation (for moving EYE to 
the origin), followed by a rotation (to axis the 
axes):
The View Matrix 
 We can combine the two operations into one 
single View Matrix:
Model-View Transform 
 In Computer Graphics, moving the objects 
relative to a fixed camera (Model transform), 
and moving the camera relative to a fixed 
object (View transform) produce the same 
image, and therefore are equivalent. 
 OpenGL, therefore, manages the Model 
transform and View transform in the same 
manner on a so-called Model-View matrix. 
Projection transformation (in the next 
section) is managed via a Projection matrix.

More Related Content

What's hot

Raster scan system
Raster scan systemRaster scan system
Raster scan systemMohd Arif
 
Overview of the graphics system
Overview of the graphics systemOverview of the graphics system
Overview of the graphics system
Kamal Acharya
 
Introduction to computer graphics part 2
Introduction to computer graphics part 2Introduction to computer graphics part 2
Introduction to computer graphics part 2
Ankit Garg
 
Raster Scan and Raster Scan Displays
Raster Scan and Raster Scan DisplaysRaster Scan and Raster Scan Displays
Raster Scan and Raster Scan DisplaysSaravana Priya
 
Introduction to computer graphics part 1
Introduction to computer graphics part 1Introduction to computer graphics part 1
Introduction to computer graphics part 1
Ankit Garg
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
Ankur Soni
 
Frame buffer
Frame bufferFrame buffer
Frame buffer
Aparna Joshi
 
COMPUTER GRAPHICS
COMPUTER GRAPHICSCOMPUTER GRAPHICS
COMPUTER GRAPHICS
Jagan Raja
 
Overview of Graphics System
Overview of Graphics SystemOverview of Graphics System
Overview of Graphics System
PrathimaBaliga
 
Computer graphics - Nitish Nagar
Computer graphics - Nitish NagarComputer graphics - Nitish Nagar
Computer graphics - Nitish Nagar
Nitish Nagar
 
Graphics display-devicesmod-1
Graphics display-devicesmod-1Graphics display-devicesmod-1
Graphics display-devicesmod-1Praveen Kumar
 
lecture2 computer graphics graphics hardware(Computer graphics tutorials)
 lecture2  computer graphics graphics hardware(Computer graphics tutorials) lecture2  computer graphics graphics hardware(Computer graphics tutorials)
lecture2 computer graphics graphics hardware(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
Computer Graphics Notes
Computer Graphics NotesComputer Graphics Notes
Computer Graphics Notes
Gurpreet singh
 
fundamentals of Computer graphics(Computer graphics tutorials)
 fundamentals of Computer graphics(Computer graphics tutorials) fundamentals of Computer graphics(Computer graphics tutorials)
fundamentals of Computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
Distortion Correction Scheme for Multiresolution Camera Images
Distortion Correction Scheme for Multiresolution Camera ImagesDistortion Correction Scheme for Multiresolution Camera Images
Distortion Correction Scheme for Multiresolution Camera Images
Associate Professor in VSB Coimbatore
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output Primitives
Renita Santhmayora
 
Lecture Summary : Camera Projection
Lecture Summary : Camera Projection Lecture Summary : Camera Projection
Lecture Summary : Camera Projection
홍배 김
 
Raster scan systems with video controller and display processor
Raster scan systems with video controller and display processorRaster scan systems with video controller and display processor
Raster scan systems with video controller and display processor
hemanth kumar
 

What's hot (20)

Raster scan system
Raster scan systemRaster scan system
Raster scan system
 
Overview of the graphics system
Overview of the graphics systemOverview of the graphics system
Overview of the graphics system
 
Unit 1
Unit 1Unit 1
Unit 1
 
Introduction to computer graphics part 2
Introduction to computer graphics part 2Introduction to computer graphics part 2
Introduction to computer graphics part 2
 
Raster Scan and Raster Scan Displays
Raster Scan and Raster Scan DisplaysRaster Scan and Raster Scan Displays
Raster Scan and Raster Scan Displays
 
Introduction to computer graphics part 1
Introduction to computer graphics part 1Introduction to computer graphics part 1
Introduction to computer graphics part 1
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
 
paper
paperpaper
paper
 
Frame buffer
Frame bufferFrame buffer
Frame buffer
 
COMPUTER GRAPHICS
COMPUTER GRAPHICSCOMPUTER GRAPHICS
COMPUTER GRAPHICS
 
Overview of Graphics System
Overview of Graphics SystemOverview of Graphics System
Overview of Graphics System
 
Computer graphics - Nitish Nagar
Computer graphics - Nitish NagarComputer graphics - Nitish Nagar
Computer graphics - Nitish Nagar
 
Graphics display-devicesmod-1
Graphics display-devicesmod-1Graphics display-devicesmod-1
Graphics display-devicesmod-1
 
lecture2 computer graphics graphics hardware(Computer graphics tutorials)
 lecture2  computer graphics graphics hardware(Computer graphics tutorials) lecture2  computer graphics graphics hardware(Computer graphics tutorials)
lecture2 computer graphics graphics hardware(Computer graphics tutorials)
 
Computer Graphics Notes
Computer Graphics NotesComputer Graphics Notes
Computer Graphics Notes
 
fundamentals of Computer graphics(Computer graphics tutorials)
 fundamentals of Computer graphics(Computer graphics tutorials) fundamentals of Computer graphics(Computer graphics tutorials)
fundamentals of Computer graphics(Computer graphics tutorials)
 
Distortion Correction Scheme for Multiresolution Camera Images
Distortion Correction Scheme for Multiresolution Camera ImagesDistortion Correction Scheme for Multiresolution Camera Images
Distortion Correction Scheme for Multiresolution Camera Images
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output Primitives
 
Lecture Summary : Camera Projection
Lecture Summary : Camera Projection Lecture Summary : Camera Projection
Lecture Summary : Camera Projection
 
Raster scan systems with video controller and display processor
Raster scan systems with video controller and display processorRaster scan systems with video controller and display processor
Raster scan systems with video controller and display processor
 

Similar to 3 d graphics with opengl part 1

3 d graphics with opengl part 2
3 d graphics with opengl  part 23 d graphics with opengl  part 2
3 d graphics with opengl part 2
Sardar Alam
 
Computer Graphics Notes 2.pdf
Computer Graphics Notes 2.pdfComputer Graphics Notes 2.pdf
Computer Graphics Notes 2.pdf
AOUNHAIDER7
 
Graphics pipelining
Graphics pipeliningGraphics pipelining
Graphics pipelining
Areena Javed
 
2 transformation computer graphics
2 transformation computer graphics2 transformation computer graphics
2 transformation computer graphics
cairo university
 
Unit-1 basics of computer graphics
Unit-1 basics of computer graphicsUnit-1 basics of computer graphics
Unit-1 basics of computer graphics
Amol Gaikwad
 
Rendering: Vertices, Indices, UVs and Shaders
Rendering: Vertices, Indices, UVs and ShadersRendering: Vertices, Indices, UVs and Shaders
Rendering: Vertices, Indices, UVs and Shaders
David Goemans
 
CS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingCS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and Culling
Mark Kilgard
 
Randomscandisplaysandrasterscandisplays 130930115124-phpapp01
Randomscandisplaysandrasterscandisplays 130930115124-phpapp01Randomscandisplaysandrasterscandisplays 130930115124-phpapp01
Randomscandisplaysandrasterscandisplays 130930115124-phpapp01
mahammed rashid
 
Random scan displays and raster scan displays
Random scan displays and raster scan displaysRandom scan displays and raster scan displays
Random scan displays and raster scan displays
Somya Bagai
 
Chapter-3.pdf
Chapter-3.pdfChapter-3.pdf
3D Math Primer: CocoaConf Chicago
3D Math Primer: CocoaConf Chicago3D Math Primer: CocoaConf Chicago
3D Math Primer: CocoaConf Chicago
Janie Clayton
 
Introduction with graphics
Introduction with graphicsIntroduction with graphics
Introduction with graphicsmsouravmishra
 
Display technology
Display technologyDisplay technology
Computer Graphics - Introduction and CRT Devices
Computer Graphics - Introduction and CRT DevicesComputer Graphics - Introduction and CRT Devices
Computer Graphics - Introduction and CRT Devices
Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D
 
A concept of graphics
A concept of graphicsA concept of graphics
A concept of graphics
msouravmishra
 
CG_ch1.pptx
CG_ch1.pptxCG_ch1.pptx
CG_ch1.pptx
NirajG3
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
Diksha Trivedi
 

Similar to 3 d graphics with opengl part 1 (20)

3 d graphics with opengl part 2
3 d graphics with opengl  part 23 d graphics with opengl  part 2
3 d graphics with opengl part 2
 
Computer Graphics Notes 2.pdf
Computer Graphics Notes 2.pdfComputer Graphics Notes 2.pdf
Computer Graphics Notes 2.pdf
 
Graphics pipelining
Graphics pipeliningGraphics pipelining
Graphics pipelining
 
2 transformation computer graphics
2 transformation computer graphics2 transformation computer graphics
2 transformation computer graphics
 
Unit-1 basics of computer graphics
Unit-1 basics of computer graphicsUnit-1 basics of computer graphics
Unit-1 basics of computer graphics
 
A0280105
A0280105A0280105
A0280105
 
Rendering: Vertices, Indices, UVs and Shaders
Rendering: Vertices, Indices, UVs and ShadersRendering: Vertices, Indices, UVs and Shaders
Rendering: Vertices, Indices, UVs and Shaders
 
CS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingCS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and Culling
 
Unit i
Unit  iUnit  i
Unit i
 
Randomscandisplaysandrasterscandisplays 130930115124-phpapp01
Randomscandisplaysandrasterscandisplays 130930115124-phpapp01Randomscandisplaysandrasterscandisplays 130930115124-phpapp01
Randomscandisplaysandrasterscandisplays 130930115124-phpapp01
 
Random scan displays and raster scan displays
Random scan displays and raster scan displaysRandom scan displays and raster scan displays
Random scan displays and raster scan displays
 
Windows and viewport
Windows and viewportWindows and viewport
Windows and viewport
 
Chapter-3.pdf
Chapter-3.pdfChapter-3.pdf
Chapter-3.pdf
 
3D Math Primer: CocoaConf Chicago
3D Math Primer: CocoaConf Chicago3D Math Primer: CocoaConf Chicago
3D Math Primer: CocoaConf Chicago
 
Introduction with graphics
Introduction with graphicsIntroduction with graphics
Introduction with graphics
 
Display technology
Display technologyDisplay technology
Display technology
 
Computer Graphics - Introduction and CRT Devices
Computer Graphics - Introduction and CRT DevicesComputer Graphics - Introduction and CRT Devices
Computer Graphics - Introduction and CRT Devices
 
A concept of graphics
A concept of graphicsA concept of graphics
A concept of graphics
 
CG_ch1.pptx
CG_ch1.pptxCG_ch1.pptx
CG_ch1.pptx
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 

More from Sardar Alam

Undoing of mental illness -- seek help
Undoing of mental illness -- seek helpUndoing of mental illness -- seek help
Undoing of mental illness -- seek help
Sardar Alam
 
introduction to python
introduction to pythonintroduction to python
introduction to python
Sardar Alam
 
Operator Overloading
Operator Overloading  Operator Overloading
Operator Overloading
Sardar Alam
 
skin disease classification
skin disease classificationskin disease classification
skin disease classification
Sardar Alam
 
filters for noise in image processing
filters for noise in image processingfilters for noise in image processing
filters for noise in image processing
Sardar Alam
 
Noise Models
Noise ModelsNoise Models
Noise Models
Sardar Alam
 
Noise Models
Noise ModelsNoise Models
Noise Models
Sardar Alam
 
Introduction to machine learningunsupervised learning
Introduction to machine learningunsupervised learningIntroduction to machine learningunsupervised learning
Introduction to machine learningunsupervised learning
Sardar Alam
 
Opengl texturing
Opengl texturingOpengl texturing
Opengl texturing
Sardar Alam
 
Mathematics fundamentals
Mathematics fundamentalsMathematics fundamentals
Mathematics fundamentals
Sardar Alam
 
3 d graphics basics
3 d graphics basics3 d graphics basics
3 d graphics basics
Sardar Alam
 
2 d transformations
2 d transformations2 d transformations
2 d transformations
Sardar Alam
 
Gui
GuiGui
Inheritance
InheritanceInheritance
Inheritance
Sardar Alam
 
Arrays string handling java packages
Arrays string handling java packagesArrays string handling java packages
Arrays string handling java packages
Sardar Alam
 
Java basics
Java basicsJava basics
Java basics
Sardar Alam
 

More from Sardar Alam (16)

Undoing of mental illness -- seek help
Undoing of mental illness -- seek helpUndoing of mental illness -- seek help
Undoing of mental illness -- seek help
 
introduction to python
introduction to pythonintroduction to python
introduction to python
 
Operator Overloading
Operator Overloading  Operator Overloading
Operator Overloading
 
skin disease classification
skin disease classificationskin disease classification
skin disease classification
 
filters for noise in image processing
filters for noise in image processingfilters for noise in image processing
filters for noise in image processing
 
Noise Models
Noise ModelsNoise Models
Noise Models
 
Noise Models
Noise ModelsNoise Models
Noise Models
 
Introduction to machine learningunsupervised learning
Introduction to machine learningunsupervised learningIntroduction to machine learningunsupervised learning
Introduction to machine learningunsupervised learning
 
Opengl texturing
Opengl texturingOpengl texturing
Opengl texturing
 
Mathematics fundamentals
Mathematics fundamentalsMathematics fundamentals
Mathematics fundamentals
 
3 d graphics basics
3 d graphics basics3 d graphics basics
3 d graphics basics
 
2 d transformations
2 d transformations2 d transformations
2 d transformations
 
Gui
GuiGui
Gui
 
Inheritance
InheritanceInheritance
Inheritance
 
Arrays string handling java packages
Arrays string handling java packagesArrays string handling java packages
Arrays string handling java packages
 
Java basics
Java basicsJava basics
Java basics
 

Recently uploaded

Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
KrzysztofKkol1
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
XfilesPro
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
Jelle | Nordend
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
NaapbooksPrivateLimi
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
MayankTawar1
 

Recently uploaded (20)

Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
 

3 d graphics with opengl part 1

  • 1.
  • 3. GPU  GPU computing is the use of a GPU (graphics processing unit) together with a CPU to accelerate general-purpose scientific and engineering applications.  Pioneered five years ago by NVIDIA, GPU computing has quickly become an industry standard.  CPU + GPU is a powerful combination because CPUs consist of a few cores optimized for serial processing, while GPUs consist of thousands of smaller, more efficient cores designed for parallel performance.  Serial portions of the code run on the CPU while parallel portions run on the GPU.
  • 4. GPU
  • 5. THE CUDA  The CUDA parallel computing platform provides a few simple C and C++ extensions  Its GeForce 256 GPU is capable of billions of calculations per second, can process a minimum of 10 million polygons per second, and has over 22 million transistors, compared to the 9 million found on the Pentium III.
  • 6. Pixels and Frame  All modern displays are raster-based. A raster is a 2D rectangular grid of pixels (or picture elements).  A pixel has two properties: a color and a position.  Color is expressed in RGB (Red-Green-Blue) components - typically 8 bits per component or 24 bits per pixel (or true color).  The position is expressed in terms of (x, y) coordinates. The origin (0, 0) is located at the top-left corner, with x-axis pointing right and y-axis pointing down.  This is different from the conventional 2D Cartesian coordinates, where y-axis is pointing upwards.
  • 7.  The number of color-bits per pixel is called the depth (or precision) of the display.  The number of rows by columns of the rectangular grid is called the resolution of the display, which can range from 640x480 (VGA), 800x600 (SVGA), 1024x768 (XGA) to 1920x1080 (FHD), or even higher.
  • 8. Frame Buffer and Refresh Rate  The color values of the pixels are stored in a special part of graphics memory called frame buffer.  The GPU writes the color value into the frame buffer.  The display reads the color values from the frame buffer row-by-row, from left-to-right, top-to-bottom, and puts each of the values onto the screen.  This is known as raster-scan.  The display refreshes its screen several dozen times per second, typically 60Hz for LCD monitors and higher for CRT tubes. This is known as the refresh rate.  A complete screen image is called a frame.
  • 9. Double Buffering and VSync  While the display is reading from the frame buffer to display the current frame, we might be updating its contents for the next frame (not necessarily in raster-scan manner).  This would result in the so-called tearing, in which the screen shows parts of the old frame and parts of the new frame.  This could be resolved by using so-called double buffering.  Instead of using a single frame buffer, modern GPU uses two of them: a front buffer and a back buffer.  The display reads from the front buffer, while we can write the next frame to the back buffer. When we finish, we signal to GPU to swap the front and back buffer (known as buffer swap or page flip).
  • 10.  Double buffering alone does not solve the entire problem, as the buffer swap might occur at an inappropriate time, for example, while the display is in the middle of displaying the old frame.  This is resolved via the so-called vertical synchronization (or VSync) at the end of the raster-scan.  When we signal to the GPU to do a buffer swap, the GPU will wait till the next VSync to perform the actual swap, after the entire current frame is displayed.
  • 11.  The most important point is: When the VSync buffer-swap is enabled, you cannot refresh the display faster than the refresh rate of the display!!!  For the LCD/LED displays, the refresh rate is typically locked at 60Hz or 60 frames per second, or 16.7 milliseconds for each frame.
  • 12. 3D Graphics Rendering Pipeline  A pipeline, in computing terminology, refers to a series of processing stages in which the output from one stage is fed as the input of the next stage, similar to a factory assembly line or water/oil pipe.  With massive parallelism, pipeline can greatly improve the overall throughput.  In computer graphics, rendering is the process of producing image on the display from model description.
  • 13.  The 3D graphics rendering pipeline consists of the following main stages
  • 14. Stage 1  Vertex Processing: Process and transform individual vertices. A vertex has attributes: position, color, vertex Normal
  • 15. Vertices  A vertex, in computer graphics, has these attributes: 1. Position in 3D space V=(x, y, z): typically expressed in floating point numbers. 2. Color: expressed in RGB (Red-Green-Blue) or RGBA (Red-Green-Blue-Alpha) components.
  • 16. Vertices continue… Texture we often wrap a 2D image to an object to make it seen realistic. A vertex could have a 2D texture coordinates (s, t), which provides a reference point to a 2D texture image.
  • 17. Vertex-Normal Vertex-Normal N=(nx, ny, nz): the normal vector is perpendicular to the surface. Normals are used to differentiate the front- and back-face, and for other processing such as lighting. Right-hand rule (or counter-clockwise) is used in OpenGL. The normal is pointing outwards, indicating the outer surface (or front-face).
  • 18.  In modern GPUs, the vertex processing stage and fragment processing stage are programmable.  You can write programs, known as vertex shader and fragment shader to perform your custom transform for vertices and fragments.  The shader programs are written in C-like high level languages such as GLSL (OpenGL Shading Language),  HLSL (High-Level Shading Language for Microsoft Direct3D),  or Cg (C for Graphics by NVIDIA).
  • 19. Vertex Processing ….. In-depth  Coordinates Transformation  The process used to produce a 3D scene on the display in Computer Graphics is like taking a photograph with a camera.  It involves four transformations: next slide…..
  • 20. 1. Arrange the objects (or models, or avatar) in the world (Model Transformation orWorld transformation). 2. Position and orientate the camera (View transformation). 3. Select a camera lens (wide angle, normal or telescopic), adjust the focus length and zoom factor to set the camera's field of view (Projection transformation). 4. Print the photo on a selected area of the paper (Viewport transformation) - in rasterization stage A transform converts a vertex V from one space (or coordinate system) to another space V'. In computer graphics, transform is carried by multiplying the vector with a transformation matrix, i.e., V' = M V.
  • 21. Model Transform (or Local Transform, or World Transform)  Each object (or model or avatar) in a 3D scene is typically drawn in its own coordinate system, known as its model space (or local space, or object space).
  • 22. Model Transform (or Local Transform, or World Transform) cont…  As we assemble the objects, we need to transform the vertices from their local spaces to the world space, which is common to all the objects. This is known as the world transform.  The world transform consists of a series of scaling (scale the object to match the dimensions of the world), rotation (align the axes), and translation (move the origin).
  • 23.  In OpenGL, a vertex V at (x, y, z) is represented as a 3x1 column vector:  Other systems, such as Direct3D, use a row vector to represent a vertex.
  • 24. Scaling  3D scaling can be represented in a 3x3 matrix:  where αx, αy and αz represent the scaling factors in x, y and z direction, respectively.  If all the factors are the same, it is called uniform scaling.
  • 25. Scaling count..  We can obtain the transformed result V' of vertex V via matrix multiplication, as follows:
  • 26. Rotation  3D rotation operates about an axis of rotation (2D rotation operates about a center of rotation). 3D Rotations about the x, y and z axes for an angle θ (measured in counter-clockwise manner) can be represented in the following 3x3 matrices: The rotational angles about x, y and z axes, denoted as θx, θy and θz, are known as Euler angles, which can be used to specify any arbitrary orientation of an object. The combined transform is called Euler transform.
  • 27. Translation  Translation does not belong to linear transform, but can be modeled via a vector addition, as follows:
  • 28.  Fortunately, we can represent translation using a 4x4 matrices and obtain the transformed result via matrix multiplication, if the vertices are represented in the so-called 4- component homogenous coordinates (x, y, z, 1), with an additional forth w-component of 1.  The significance of the w-component later in projection transform.  In general, if the w-component is not equal to 1, then (x, y, z, w) corresponds to Cartesian coordinates of (x/w, y/w, z/w). If w=0, it represents a vector, instead of a point (or vertex).
  • 29.  Using the 4-component homogenous coordinates, translation can be represented in a 4x4 matrix, as follows:
  • 30.  The transformed vertex V' can again be computed via matrix multiplication:
  • 32. Transformation of Vertex-Normal  Recall that a vector has a vertex-normal, in addition to (x, y, z) position and color.  Suppose that M is a transform matrix, it can be applied to vertex-normal only if the transforms does not include non-uniform scaling.  Otherwise, the transformed normal will not be orthogonal to the surface. For non-uniform scaling, we could use (M-1)T as the transform matrix, which ensure that the transformed normal remains orthogonal.
  • 33. View Transform  After the world transform, all the objects are assembled into the world space. We shall now place the camera to capture the view.
  • 34. Positioning the Camera  In 3D graphics, we position the camera onto the world space by specifying three view parameters: EYE, AT and UP, in world space.  The point EYE (ex, ey, ez) defines the location of the camera.
  • 35. Positioning the Camera  The vector AT (ax, ay, az) denotes the direction where the camera is aiming at, usually at the center of the world or an object.
  • 36. Positioning the Camera  The vector UP (ux, uy, uz) denotes the upward orientation of the camera roughly. UP is typically coincided with the y-axis of the world space.  UP is roughly orthogonal to AT, but not necessary. As UP and AT define a plane, we can construct an orthogonal vector to AT in the camera space.
  • 37.  In OpenGL, we can use the GLU function gluLookAt() to position the camera:  The default settings of gluLookAt() is: That is, the camera is positioned at the origin (0, 0, 0), aimed into the screen (negative z-axis), and faced upwards (positive y-axis). To use the default settings, you have to place the objects at negative z-values.
  • 38. Computing the Camera Coordinates  From EYE, AT and UP, we first form the coordinate (xc, yc, zc) for the camera, relative to the world space. We fix zc to be the opposite of AT, i.e., AT is pointing at the - zc. We can obtain the direction of xc by taking the cross-product of AT and UP. Finally, we get the direction of yc by taking the cross-product of xc and zc. Take note that UP is roughly, but not necessarily, orthogonal to AT.
  • 39. Transforming from World Space to Camera Space  Now, the world space is represented by standard orthonormal bases (e1, e2, e3), where e1=(1, 0, 0), e2=(0, 1, 0) and e3=(0, 0, 1), with origin at O=(0, 0, 0). The camera space has orthonormal bases (xc, yc, zc) with origin at EYE=(ex, ey, ez).  It is much more convenience to express all the coordinates in the camera space. This is done via view transform.
  • 40.  The view transform consists of two operations: a translation (for moving EYE to the origin), followed by a rotation (to axis the axes):
  • 41. The View Matrix  We can combine the two operations into one single View Matrix:
  • 42. Model-View Transform  In Computer Graphics, moving the objects relative to a fixed camera (Model transform), and moving the camera relative to a fixed object (View transform) produce the same image, and therefore are equivalent.  OpenGL, therefore, manages the Model transform and View transform in the same manner on a so-called Model-View matrix. Projection transformation (in the next section) is managed via a Projection matrix.