Computer Graphics

Welcome back to
Computer Graphics course
 I believe that you have finished
 Lecture 4 : Transforms 2
 Video 2-4
 Lecture 5 : Transforms 1
 Video 1-3
Computer Graphics
 Have you already started HW1? due May 7, 2015.
 Print the results in one page
 Your name/student No./course ID
1st quarter, 2015
 input.txt.000.png - input.txt.012.png
Nara Institute of Science and Technology
April 30, 2015
 *updated*
submit your implementation from http://goo.gl/OF0i0b
Today’s topics
Homework 2
 Next topic preview
 due May 14, 2015.
 homework 2
 Print out the results in one page
 Geometric transform (extend from HW1)
 Your name / Student No. /course ID
 Rendering (Lighting / Shading)
 Check your understanding
 demo.txt.input.txt.000.png - demo.txt.input.txt.012.png
 Submit your source codes from http://goo.gl/ZqP7LK
in my implementation,
 about 30 lines on light.frag.glsl
 Homework 1 support
 12 lines on display.cpp
 10 lines on readfile.cpp
 about 15 lines on Transform.cpp
What’s required in
Homework 2 ?
You can build&render
a scene as you like.
 This requires you
<input file>
size 500 500
camera 2 1 1 0 0 0 0 1 0 45.0
 to read a scene from file
light 0.6 0 0.1 0 1 1 1 1
pushTransform
translate 0 0 -0.5
 ≤ 10 objects with configurable material
# Black Rubber
pushTransform
translate -0.5 0 0
ambient 0.02 0.02 0.02 1 0
diffuse 0.01 0.01 0.01 1
specular 0.4 0.4 0.4 1
shininess 10
teapot 0.15
popTransform
 ≤ 10 lights (point/directional)
 to change viewpoint
# Black Plastic
pushTransform
translate 0 0 0
ambient 0 0 0 1
diffuse 0.01 0.01 0.01 1
specular 0.5 0.5 0.5 1
shininess 32
teapot 0.15
popTransform
 Rotation (as in HW1) / translation / scale
 to render the objects according to their material
 Implement the above using OpenGL!
 Start early! It takes 𝑂 𝑛2 hours!
# Silver
pushTransform
translate 0.5 0 0
ambient 0.19225 0.19225 0.19225 1
Perl
Copper
Rubber
Ruby
Bronze
Plastic
Gold
Brass
Silver
diffuse 0.50754 0.50754 0.50754 1
specular 0.508273 0.508273 0.508273 1
shininess 51.2
teapot 0.15
popTransform
popTransform
pushTransform
translate 0 0 0
# Copper
pushTransform
translate -0.5 0 0
ambient 0.19125 0.0735 0.0225 1
diffuse 0.7038 0.27048 0.0828 1
specular 0.256777 0.137622 0.086014 1
shininess 12.8
teapot 0.15
popTransform
Material parameters in
http://www.nicoptere.net/dump/materials.html
pushTransform
translate 0 0 0
ambient 0.2125 0.1275 0.054 1
diffuse 0.714 0.4284 0.18144 1
specular 0.393548 0.271906 0.166721 1
shininess 25.6
teapot 0.15
popTransform
# Brass
pushTransform
translate 0.5 0 0
ambient 0.329412 0.223529 0.027451 1
diffuse 0.780392 0.568627 0.113725 1
specular 0.992157 0.941176 0.807843 1
shininess 27.8974
teapot 0.15
popTransform
popTransform
pushTransform
translate 0 0 0.5
# Pearl
pushTransform
translate -0.5 0 0
ambient 0.25 0.20725 0.20725 0.922
diffuse 1 0.829 0.829 0.922
specular 0.296648 0.296648 0.296648 0.922
shininess 11.264
teapot 0.15
popTransform
# Ruby
pushTransform
translate 0 0 0
ambient 0.1745 0.01175 0.01175 0.55
diffuse 0.61424 0.04136 0.04136 0.55
specular 0.727811 0.626959 0.626959 0.55
shininess 76.8
teapot 0.15
popTransform
# Polished Gold
pushTransform
translate 0.5 0 0
ambient 0.24725 0.2245 0.0645 1
diffuse 0.34615 0.3143 0.0903 1
specular 0.797357 0.723991 0.208006 1
shininess 83.2
teapot 0.15
popTransform
popTransform
# Bronze
1
Shading - materials
Lighting
Diffuse
拡散反射
Directional light
Point light
Specular
鏡面反射
ambient/emission
環境光・発光
Homework
 Unit 2
 Lecture 6: OpenGL 1
 about 45 min.
 Lecture 7:
OpenGL Shading
Notice
 Homework 1
due May 7, 2015.
 Print the results
in one page
 Your name
 Student No.
 V1, V2
about 23 min.
 course ID
 input.txt.000.png input.txt.012.png
 Submit your
implementation from
http://goo.gl/OF0i0b
Questions?
 April 30 (Thu)
 Enjoy holidays!
 Today
 May 1 (Fri)
 May 2 – 6
 holidays!
 May 7 (Thu)
 Next class
 HW1 due
 Audit edX!
 Make sure that
you have only
one weekday
until next class.
 Totally, just 1:07:15 for
playing movie.
[notification]
homework 3 will be modified
 Kubo sensei offers you a skeleton code for HW3.
 It must help you a lot!
 𝑂 𝑛3 → 𝑂 𝑛2 ?
 If you want to implement from scratch by yourself,
you can challenge! Please contact me.
 To be announced in (maybe) next lecture.
Please tell us your ID & name
before asking/answering.
2
Today’s topics
Check!
 Next topic preview
Take a short test from
http://goo.gl/aJFD9h
 homework 2
 Geometric transform (extend from HW1)
 Rendering (Lighting / Shading)
 Check your understanding
 Homework 1 support
Z resolution
Questions?
Given that 𝑛𝑒𝑎𝑟 = 10, 𝑓𝑎𝑟 = 500
Assign [0,255] values to
value
1
𝑧
 10 → 0.1 ∶ 0
 500 → 0.002 ∶ 255
500
400
300
z
Please tell us your ID & name
before asking/answering.
200
100
0
0
Notice
z resolution is discrete
Intuitively, it seems better to use
 smaller 𝑛𝑒𝑎𝑟 = 0
 larger 𝑓𝑎𝑟 = ∞
for better coverage
But, It makes terrible result
 Resolution is non-uniform
 𝑛, 𝑓 = 0.1,1000000
value
0
16
32
48
64
80
96
112
128
144
160
176
192
208
224
240
255
1/z
10.000
9.373
8.745
8.118
7.490
6.863
6.235
5.608
4.980
4.353
3.725
3.098
2.471
1.843
1.216
0.588
0.000
z
0.100
0.107
0.114
0.123
0.134
0.146
0.160
0.178
0.201
0.230
0.268
0.323
0.405
0.543
0.823
1.700
1000000
32
64
96 128 160 192 224 255
value
0
16
32
48
64
80
96
112
128
144
160
176
192
208
224
240
255
1/z
z
0.100 10.000
0.094 10.655
0.088 11.402
0.082 12.262
0.075 13.262
0.069 14.439
0.063 15.846
0.057 17.557
0.051 19.682
0.045 22.392
0.039 25.967
0.032 30.902
0.026 38.151
0.020 49.844
0.014 71.871
0.008 128.788
0.002 500.000
Questions?
Please tell us your ID & name
before asking/answering.
3
(Recap)
Homework
 Unit 2
 Lecture 6: OpenGL 1
Today’s topics
 Homework 1
due May 7, 2015.
 about 45 min.
 Lecture 7:
OpenGL Shading
 Print the results
in one page
 Your name
 Student No.
 V1, V2
about 23 min.
 Next topic preview
 homework 2
 Geometric transform (extend from HW1)
 Rendering (Lighting / Shading)
 Check your understanding
 course ID
 input.txt.000.png input.txt.012.png
 Homework 1 support
 Submit your
implementation from
http://goo.gl/OF0i0b
Homework support
 Raise your hand for assistance.
 If you have no problem,
you can audit next lecture (do homework) now.
 Unit 2 - Lecture 6 and 7
 Please use earphone/headphone when you audit
 Homework 1, 2
4