SlideShare a Scribd company logo
CS8092-Computer graphics and
Multimedia
Illumination Models and Color
Models
Introduction 1
Illumination model:
Given a point on a surface, what is the perceived
color and intensity? Known as Lighting Model,
or Shading Model
Surface rendering:
Apply the Illumination model to color all pixels
of the surface.
Introduction 2
Example:
• Illumination model gives color
vertices,
• Surface is displayed via
interpolation of these colors.
Introduction 3
Illumination:
• Physics:
– Material properties, light sources, relative
positions, properties medium
• Psychology:
– Perception, what do we see
– Color!
• Often approximating models
Light sources 1
Light source: object that radiates energy.
Sun, lamp, globe, sky…
Intensity I = (Ired , Igreen , Iblue)
If Ired = Igreen = Iblue : white light
Light sources 2
Simple model: point light source
• position P and intensity I
• Light rays along straight lines
• Good approximation for small
light sources
Surface illumination 2
• Suppose, a light source radiates white light,
consisting of red, green and blue light.
reflection
absorption
If only red light is reflected,
then we see a red surface.
transmission
Surface illumination 3
• Diffuse reflection: Light is uniformly reflected in
all directions
• Specular reflection: Light is stronger reflected in
one direction.
specular reflection
diffuse reflection
Surface illumination 4
• Ambient light: light from the environment. Undirected
light, models reflected light of other objects.
Basic illumination model 1
Basic illumination model:
• Ambient light;
• Point light sources;
• Ambient reflection;
• Diffuse reflection;
• Specular reflection.
Ia
Il , Pof V
ka
kd
ks , ns
ka ,kd ,ks :reflection coefficien ts
k p  (kp,red , kp,green,kp,blue)
Basic illumination model 2
• Ambient light: environment light. Undirected light,
models reflected light of other objects.
Iamb  ka Ia
Color Modols for Computer
Graphics
Artist’s Color
Hue
Saturation
Value
Value
• Luminance
• Dark to Light
• Value range
– High key
– Middle key
– Low key
Hue - Paint Mixing
• Physical mix of
opaque paints
• Primary: RYB
• Secondary: OGV
• Neutral: R + Y + B
Hue - Ink Mixing
• Subtractive mix of
transparent inks
• Primary: CMY
• Secondary: RGB
• ~Black: C + M + Y
• Actually use CMYK
to get true black
Hue - Ink Mixing
Assumption: ink printed on pure white paper
CMY = White – RGB:
C = 1 – R, M = 1 – G, Y = 1 – B
CMYK from CMY (K is black ink):
K = min(C, M, Y)
C = C – K, M = M – K, Y = Y - K
Hue - Light Mixing
• Additive mix of
colored lights
• Primary: RGB
• Secondary: CMY
• White = R + G + B
• Show demonstration
of optical mixing
Saturation
• Purity of color
Perception of Color
In the end, color is a perceptual phenomenon
Color Constancy
Perceived color is
highly context
dependent
Allowing color
recognition with
variable lighting
conditions
Color Constancy
Perceived color is
highly context
dependent
Allowing color
recognition with
variable lighting
conditions
Simultaneous Contrast
Simultaneous Contrast
RGB Color Wheel
• Warm/Cool
• Complements
• Split Complement
• Analogous
• Show RGB Cube
HSV Color Model
RGB cube HSV top view
HSV is a projection of the RGB space
HSV cone
HSV Color Model
Hue, an angular measure (0 … 360)
HSV Color Model
Saturation, a fractional measure (0.0 … 1.0)
HSV Color Model
Value, a fractional measure (0.0 … 1.0)
CIE xyY Color Cone
CIE xyY Typical Display
Gamut
CIE Lu*v* and Lab
Perceptually Uniform Spaces
Lu*v* rescales xyY Lab color opponents
Color Picker
End
35
COMPUTER GRAPHICS
OUTPUT PRIMITIVES
36
2D Graphics Algorithms
• Output Primitives
• Line Drawing Algorithms
• DDA Algorithm
• Midpoint Algorithm
• Bersenhem’s Algorithm
• Circle Drawing Algorithms
• Midpoint Circle Algorithm
• Antialising
• Fill-Area Algorithms
37
Output Primitives
38
Output Primitives
• The basic objects out of which a graphics
display is created are called.
• Describes the geometry of objects and –
typically referred to as geometric
primitives.
• Examples: point, line, text, filled region,
images, quadric surfaces, spline curves
• Each of the output primitives has its own
set of attributes.
Line Drawing Algorithms
100
Line Drawing
• Line drawing is fundamental to computer graphics.
• We must have fast and efficient line drawing functions.
Rasterization Problem: Given only the two end points, how
to compute the intermediate pixels, so that the set of pixels
closely approximate the ideal line.
Line Drawing - Analytical Method
 ay
m 
by
bx  ax
c  ay  max
y
x
ax bx
y=mx+c
A(ax,ay)
B(bx,by)
Compute one point based on the previous point:
(x0, y0)…….…………..(xk, yk) (xk+1, yk+1) …….
I have got a pixel on the line (Current Pixel).
How do I get the next pixel on the line?
Next pixel on next column
(when slope is small)
Next pixel on next row
(when slope is large)
Incremental Algorithms
Current
Pixel
(xk, yk)
To find (xk+1, yk+!):
xk+1 = xk+1
yk+1 = ?
(5,2)
(6,1)
(6,2)
(6,3)
• Assumes that the next pixel to be set is on the next column of
pixels (Incrementing the value of x !)
• Not valid if slope of the line is large.
Incrementing along x
Digital DifferentialAnalyzerAlgorithm is an incremental
algorithm.
Assumption: Slope is less than 1 (Increment along x).
Current Pixel = (xk, yk).
(xk, yk) lies on the given line.
Next pixel is on next column.
Next point (xk+1, yk+1) on the line
yk = m.xk + c
xk+1 = xk+1
yk+1 = m.xk+1 + c
= m (xk+1) +c
= yk + m
Given a point (xk, yk) on a line, the next point is given by
xk+1 = xk+1
yk+1 = yk + m
Line Drawing - DDA
xk+1 = xk+1
yk+1 = Either yk or yk+1
Midpoint algorithm is an incremental algorithm
Midpoint Algorithm
Assumption:
Slope < 1
Current
Pixel
46
Circle Drawing Algorithms
47
Midpoint Circle Drawing
Algorithm
• To determine the closest pixel position to the
specified circle path at each step.
• For given radius r and screen center position (xc,
yc), calculate pixel positions around a circle path
centered at the coodinate origin (0,0).
• Then, move each calculated position (x, y) to its
proper screen position by adding xc to x andyc
to y.
• Along the circle section from x=0 to x=y in the
first quadrant, the gradient varies from 0 to -1.
Midpoint Circle Drawing Algorithm
 8 segments of octants for a circle:
48
Midpoint Circle Drawing Algorithm
 Circle function: fcircle (x,y) = x2 + y2 –r2
49
> 0, (x,y) outside the circle
< 0, (x,y) inside the circle
= 0, (x,y) is on the circle
boundary
{
fcircle (x,y) =
Midpoint Circle Drawing Algorithm
midpoint
yk-1
Fk < 0
yk+1 = yk
Next pixel = (xk+1, yk)
midpoin
yk-1
yk yk
t
Fk >= 0
yk+1 = yk - 1
Next pixel = (xk+1, yk-1)
50
Midpoint Circle Drawing Algorithm
We know xk+1 = xk+1,
Fk = F(xk+1, yk- ½)
Fk = (xk +1)2 + (yk - ½)2 - r2
Fk+1 = F(xk+1, yk- ½)
Fk+1 = (xk +2)2 + (yk+1 - ½)2 - r2
(2) – (1)
-------- (1)
-------- (2)
Fk+1 = Fk + 2(xk+1) + (y2 – y2 ) - (y
k+1 k
51
k+1 k
– y ) + 1
If Fk < 0,
If Fk >= 0,
Fk+1 = Fk + 2xk+1+1
Fk+1 = Fk + 2xk+1+1 – 2yk+1
52
Midpoint Circle Drawing Algorithm
For the initial point, (x0 , y0) = (0, r)
f0 = fcircle (1, r-½ )
= 1 + (r-½ )2 – r2
= 5 – r
4
≈ 1 – r
Fill Area Algorithms
• Fill-Area algorithms are used to fill the
interior of a polygonal shape.
• Many algorithms perform fill operations
by first identifying the interior points,
given the polygon boundary.
53
Basic Filling Algorithm
The basic filling algorithm is commonly used
in interactive graphics packages, where the
user specifies an interior point of the region to
be filled.
4-connected pixels
54
55
Basic Filling Algorithm
1 Set the user specified point.
2Store the four neighboring pixels in a
stack.
3 Remove a pixel from the stack.
4 If the pixel is not set,
Set the pixel
Push its four neighboring pixels into the stack
5 Go to step 3
6 Repeat till the stack is empty.
Basic Filling Algorithm
• Requires an interior point.
• Involves considerable amount of stack
operations.
• The boundary has to be closed.
• Not suitable for self-intersecting
polygons
56
57
Types of Basic Filling Algorithms
• Boundary Fill Algorithm
• For filling a region with a single boundary
color.
• Condition for setting pixels:
• Color is not the same as border color
• Color is not the same as fill color
• Flood Fill Algorithm
• For filling a region with multiple boundary
colors.
• Condition for setting pixels:
• Color is same as the old interior color

More Related Content

Similar to UNIT-1.pptx

Unit 2
Unit 2Unit 2
Unit 2
ypnrao
 
Primitives
PrimitivesPrimitives
Chapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxChapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptx
Kokebe2
 
Module 1.pptx
Module 1.pptxModule 1.pptx
Module 1.pptx
Mattupallipardhu
 
ECC_basics.ppt
ECC_basics.pptECC_basics.ppt
ECC_basics.ppt
RudraChandanSingh
 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithmsMohammad Sadiq
 
5 DimensionalityReduction.pdf
5 DimensionalityReduction.pdf5 DimensionalityReduction.pdf
5 DimensionalityReduction.pdf
Rahul926331
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1
aravindangc
 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
Mattupallipardhu
 
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohichapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
54MahakBansal
 
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfCD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
RajJain516913
 
14485616.ppt
14485616.ppt14485616.ppt
14485616.ppt
ssuser80439c
 
module 1.pdf
module 1.pdfmodule 1.pdf
module 1.pdf
KimTaehyung188352
 
Introduction to Image Processing with MATLAB
Introduction to Image Processing with MATLABIntroduction to Image Processing with MATLAB
Introduction to Image Processing with MATLAB
Sriram Emarose
 
Lec-4_Rendering-1.pdf
Lec-4_Rendering-1.pdfLec-4_Rendering-1.pdf
Lec-4_Rendering-1.pdf
RuatiBT20CS014
 
Computer graphics notes watermark
Computer graphics notes watermarkComputer graphics notes watermark
Computer graphics notes watermark
RAJKIYA ENGINEERING COLLEGE, BANDA
 
CG-Lecture3.pptx
CG-Lecture3.pptxCG-Lecture3.pptx
CG-Lecture3.pptx
lakshitasarika2014
 
Digital image processing fundamental explanation
Digital image processing fundamental explanationDigital image processing fundamental explanation
Digital image processing fundamental explanation
Tirusew1
 
A Comparative Study of Histogram Equalization Based Image Enhancement Techniq...
A Comparative Study of Histogram Equalization Based Image Enhancement Techniq...A Comparative Study of Histogram Equalization Based Image Enhancement Techniq...
A Comparative Study of Histogram Equalization Based Image Enhancement Techniq...
Shahbaz Alam
 

Similar to UNIT-1.pptx (20)

Unit 2
Unit 2Unit 2
Unit 2
 
Primitives
PrimitivesPrimitives
Primitives
 
Chapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxChapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptx
 
Module 1.pptx
Module 1.pptxModule 1.pptx
Module 1.pptx
 
ECC_basics.ppt
ECC_basics.pptECC_basics.ppt
ECC_basics.ppt
 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithms
 
5 DimensionalityReduction.pdf
5 DimensionalityReduction.pdf5 DimensionalityReduction.pdf
5 DimensionalityReduction.pdf
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1
 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
 
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohichapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
 
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfCD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
 
14485616.ppt
14485616.ppt14485616.ppt
14485616.ppt
 
module 1.pdf
module 1.pdfmodule 1.pdf
module 1.pdf
 
Introduction to Image Processing with MATLAB
Introduction to Image Processing with MATLABIntroduction to Image Processing with MATLAB
Introduction to Image Processing with MATLAB
 
Lec-4_Rendering-1.pdf
Lec-4_Rendering-1.pdfLec-4_Rendering-1.pdf
Lec-4_Rendering-1.pdf
 
Cgm Lab Manual
Cgm Lab ManualCgm Lab Manual
Cgm Lab Manual
 
Computer graphics notes watermark
Computer graphics notes watermarkComputer graphics notes watermark
Computer graphics notes watermark
 
CG-Lecture3.pptx
CG-Lecture3.pptxCG-Lecture3.pptx
CG-Lecture3.pptx
 
Digital image processing fundamental explanation
Digital image processing fundamental explanationDigital image processing fundamental explanation
Digital image processing fundamental explanation
 
A Comparative Study of Histogram Equalization Based Image Enhancement Techniq...
A Comparative Study of Histogram Equalization Based Image Enhancement Techniq...A Comparative Study of Histogram Equalization Based Image Enhancement Techniq...
A Comparative Study of Histogram Equalization Based Image Enhancement Techniq...
 

More from RizwanBasha12

46267037-Data-Structures-PPT.ppt
46267037-Data-Structures-PPT.ppt46267037-Data-Structures-PPT.ppt
46267037-Data-Structures-PPT.ppt
RizwanBasha12
 
KEY MGMT.ppt
KEY MGMT.pptKEY MGMT.ppt
KEY MGMT.ppt
RizwanBasha12
 
PUBLIC KEY & RSA.ppt
PUBLIC KEY & RSA.pptPUBLIC KEY & RSA.ppt
PUBLIC KEY & RSA.ppt
RizwanBasha12
 
DES.ppt
DES.pptDES.ppt
DES.ppt
RizwanBasha12
 
AES.pptx
AES.pptxAES.pptx
AES.pptx
RizwanBasha12
 
CNS new ppt unit 1.pptx
CNS new ppt unit 1.pptxCNS new ppt unit 1.pptx
CNS new ppt unit 1.pptx
RizwanBasha12
 

More from RizwanBasha12 (6)

46267037-Data-Structures-PPT.ppt
46267037-Data-Structures-PPT.ppt46267037-Data-Structures-PPT.ppt
46267037-Data-Structures-PPT.ppt
 
KEY MGMT.ppt
KEY MGMT.pptKEY MGMT.ppt
KEY MGMT.ppt
 
PUBLIC KEY & RSA.ppt
PUBLIC KEY & RSA.pptPUBLIC KEY & RSA.ppt
PUBLIC KEY & RSA.ppt
 
DES.ppt
DES.pptDES.ppt
DES.ppt
 
AES.pptx
AES.pptxAES.pptx
AES.pptx
 
CNS new ppt unit 1.pptx
CNS new ppt unit 1.pptxCNS new ppt unit 1.pptx
CNS new ppt unit 1.pptx
 

Recently uploaded

Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 

Recently uploaded (20)

Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 

UNIT-1.pptx

  • 2. Introduction 1 Illumination model: Given a point on a surface, what is the perceived color and intensity? Known as Lighting Model, or Shading Model Surface rendering: Apply the Illumination model to color all pixels of the surface.
  • 3. Introduction 2 Example: • Illumination model gives color vertices, • Surface is displayed via interpolation of these colors.
  • 4. Introduction 3 Illumination: • Physics: – Material properties, light sources, relative positions, properties medium • Psychology: – Perception, what do we see – Color! • Often approximating models
  • 5. Light sources 1 Light source: object that radiates energy. Sun, lamp, globe, sky… Intensity I = (Ired , Igreen , Iblue) If Ired = Igreen = Iblue : white light
  • 6. Light sources 2 Simple model: point light source • position P and intensity I • Light rays along straight lines • Good approximation for small light sources
  • 7. Surface illumination 2 • Suppose, a light source radiates white light, consisting of red, green and blue light. reflection absorption If only red light is reflected, then we see a red surface. transmission
  • 8. Surface illumination 3 • Diffuse reflection: Light is uniformly reflected in all directions • Specular reflection: Light is stronger reflected in one direction. specular reflection diffuse reflection
  • 9. Surface illumination 4 • Ambient light: light from the environment. Undirected light, models reflected light of other objects.
  • 10. Basic illumination model 1 Basic illumination model: • Ambient light; • Point light sources; • Ambient reflection; • Diffuse reflection; • Specular reflection. Ia Il , Pof V ka kd ks , ns ka ,kd ,ks :reflection coefficien ts k p  (kp,red , kp,green,kp,blue)
  • 11. Basic illumination model 2 • Ambient light: environment light. Undirected light, models reflected light of other objects. Iamb  ka Ia
  • 12. Color Modols for Computer Graphics
  • 14. Value • Luminance • Dark to Light • Value range – High key – Middle key – Low key
  • 15. Hue - Paint Mixing • Physical mix of opaque paints • Primary: RYB • Secondary: OGV • Neutral: R + Y + B
  • 16. Hue - Ink Mixing • Subtractive mix of transparent inks • Primary: CMY • Secondary: RGB • ~Black: C + M + Y • Actually use CMYK to get true black
  • 17. Hue - Ink Mixing Assumption: ink printed on pure white paper CMY = White – RGB: C = 1 – R, M = 1 – G, Y = 1 – B CMYK from CMY (K is black ink): K = min(C, M, Y) C = C – K, M = M – K, Y = Y - K
  • 18. Hue - Light Mixing • Additive mix of colored lights • Primary: RGB • Secondary: CMY • White = R + G + B • Show demonstration of optical mixing
  • 20. Perception of Color In the end, color is a perceptual phenomenon
  • 21. Color Constancy Perceived color is highly context dependent Allowing color recognition with variable lighting conditions
  • 22. Color Constancy Perceived color is highly context dependent Allowing color recognition with variable lighting conditions
  • 25. RGB Color Wheel • Warm/Cool • Complements • Split Complement • Analogous • Show RGB Cube
  • 26. HSV Color Model RGB cube HSV top view HSV is a projection of the RGB space HSV cone
  • 27. HSV Color Model Hue, an angular measure (0 … 360)
  • 28. HSV Color Model Saturation, a fractional measure (0.0 … 1.0)
  • 29. HSV Color Model Value, a fractional measure (0.0 … 1.0)
  • 31. CIE xyY Typical Display Gamut
  • 32. CIE Lu*v* and Lab Perceptually Uniform Spaces Lu*v* rescales xyY Lab color opponents
  • 34. End
  • 36. 36 2D Graphics Algorithms • Output Primitives • Line Drawing Algorithms • DDA Algorithm • Midpoint Algorithm • Bersenhem’s Algorithm • Circle Drawing Algorithms • Midpoint Circle Algorithm • Antialising • Fill-Area Algorithms
  • 38. 38 Output Primitives • The basic objects out of which a graphics display is created are called. • Describes the geometry of objects and – typically referred to as geometric primitives. • Examples: point, line, text, filled region, images, quadric surfaces, spline curves • Each of the output primitives has its own set of attributes.
  • 40. Line Drawing • Line drawing is fundamental to computer graphics. • We must have fast and efficient line drawing functions. Rasterization Problem: Given only the two end points, how to compute the intermediate pixels, so that the set of pixels closely approximate the ideal line.
  • 41. Line Drawing - Analytical Method  ay m  by bx  ax c  ay  max y x ax bx y=mx+c A(ax,ay) B(bx,by)
  • 42. Compute one point based on the previous point: (x0, y0)…….…………..(xk, yk) (xk+1, yk+1) ……. I have got a pixel on the line (Current Pixel). How do I get the next pixel on the line? Next pixel on next column (when slope is small) Next pixel on next row (when slope is large) Incremental Algorithms
  • 43. Current Pixel (xk, yk) To find (xk+1, yk+!): xk+1 = xk+1 yk+1 = ? (5,2) (6,1) (6,2) (6,3) • Assumes that the next pixel to be set is on the next column of pixels (Incrementing the value of x !) • Not valid if slope of the line is large. Incrementing along x
  • 44. Digital DifferentialAnalyzerAlgorithm is an incremental algorithm. Assumption: Slope is less than 1 (Increment along x). Current Pixel = (xk, yk). (xk, yk) lies on the given line. Next pixel is on next column. Next point (xk+1, yk+1) on the line yk = m.xk + c xk+1 = xk+1 yk+1 = m.xk+1 + c = m (xk+1) +c = yk + m Given a point (xk, yk) on a line, the next point is given by xk+1 = xk+1 yk+1 = yk + m Line Drawing - DDA
  • 45. xk+1 = xk+1 yk+1 = Either yk or yk+1 Midpoint algorithm is an incremental algorithm Midpoint Algorithm Assumption: Slope < 1 Current Pixel
  • 47. 47 Midpoint Circle Drawing Algorithm • To determine the closest pixel position to the specified circle path at each step. • For given radius r and screen center position (xc, yc), calculate pixel positions around a circle path centered at the coodinate origin (0,0). • Then, move each calculated position (x, y) to its proper screen position by adding xc to x andyc to y. • Along the circle section from x=0 to x=y in the first quadrant, the gradient varies from 0 to -1.
  • 48. Midpoint Circle Drawing Algorithm  8 segments of octants for a circle: 48
  • 49. Midpoint Circle Drawing Algorithm  Circle function: fcircle (x,y) = x2 + y2 –r2 49 > 0, (x,y) outside the circle < 0, (x,y) inside the circle = 0, (x,y) is on the circle boundary { fcircle (x,y) =
  • 50. Midpoint Circle Drawing Algorithm midpoint yk-1 Fk < 0 yk+1 = yk Next pixel = (xk+1, yk) midpoin yk-1 yk yk t Fk >= 0 yk+1 = yk - 1 Next pixel = (xk+1, yk-1) 50
  • 51. Midpoint Circle Drawing Algorithm We know xk+1 = xk+1, Fk = F(xk+1, yk- ½) Fk = (xk +1)2 + (yk - ½)2 - r2 Fk+1 = F(xk+1, yk- ½) Fk+1 = (xk +2)2 + (yk+1 - ½)2 - r2 (2) – (1) -------- (1) -------- (2) Fk+1 = Fk + 2(xk+1) + (y2 – y2 ) - (y k+1 k 51 k+1 k – y ) + 1 If Fk < 0, If Fk >= 0, Fk+1 = Fk + 2xk+1+1 Fk+1 = Fk + 2xk+1+1 – 2yk+1
  • 52. 52 Midpoint Circle Drawing Algorithm For the initial point, (x0 , y0) = (0, r) f0 = fcircle (1, r-½ ) = 1 + (r-½ )2 – r2 = 5 – r 4 ≈ 1 – r
  • 53. Fill Area Algorithms • Fill-Area algorithms are used to fill the interior of a polygonal shape. • Many algorithms perform fill operations by first identifying the interior points, given the polygon boundary. 53
  • 54. Basic Filling Algorithm The basic filling algorithm is commonly used in interactive graphics packages, where the user specifies an interior point of the region to be filled. 4-connected pixels 54
  • 55. 55 Basic Filling Algorithm 1 Set the user specified point. 2Store the four neighboring pixels in a stack. 3 Remove a pixel from the stack. 4 If the pixel is not set, Set the pixel Push its four neighboring pixels into the stack 5 Go to step 3 6 Repeat till the stack is empty.
  • 56. Basic Filling Algorithm • Requires an interior point. • Involves considerable amount of stack operations. • The boundary has to be closed. • Not suitable for self-intersecting polygons 56
  • 57. 57 Types of Basic Filling Algorithms • Boundary Fill Algorithm • For filling a region with a single boundary color. • Condition for setting pixels: • Color is not the same as border color • Color is not the same as fill color • Flood Fill Algorithm • For filling a region with multiple boundary colors. • Condition for setting pixels: • Color is same as the old interior color