Professional Documents
Culture Documents
186.101
Károly Zsolnai-Fehér
Assignments – 40%
Playful practical assignments with ray tracing
programs, and later with LuxRender
Simple mathematical problems you’ll find
very interesting
5
Assignments
Assignments – 40%
Playful practical assignments with ray tracing
programs, and later with LuxRender
Simple mathematical problems you’ll find very
interesting
6
Assignments
Assignments – 40%
Playful practical assignments with ray tracing programs, and later
with LuxRender
Simple mathematical problems you’ll find very interesting
7
Reading material
http://pbrt.org/ 8
What you shouldn’t expect of this course
9
What you shouldn’t expect of this course
10
What you shouldn’t expect of this course
11
What you shouldn’t expect of this course
12
What you shouldn’t expect of this course
13
What you should expect of this course
14
What you should expect of this course
15
What you should expect of this course
16
What you should expect of this course
17
What you should expect of this course
18
What you should expect of this course
19
What you should expect of this course
20
Quick radiometry recap
21
Quick radiometry recap
22
Quick radiometry recap
23
Quick radiometry recap
25
Quick radiometry recap
26
Quick radiometry recap
27
Quick radiometry recap
28
Quick radiometry recap
30
Quick radiometry recap
31
Quick radiometry recap
32
Quick radiometry recap
(angle in more dimensions is called solid angle, for which the unit is not degrees but
steradians)
33
Quick radiometry recap
(angle in more dimensions is called solid angle, for which the unit is not degrees but
steradians)
34
Quick radiometry recap
(angle in more dimensions is called solid angle, for which the unit is not degrees but
steradians)
35
The most fundamental question
36
The most fundamental question
38
The most fundamental question
39
The scalar product
Definition:
40
Terminology
41
Terminology
42
Terminology
43
Terminology
44
Terminology
45
Terminology
46
Terminology
V should start from the same point as the other vectors to make
computations possible, so in the regular notation, we just flip it.
47
Terminology
Like this.
48
Terminology
Like this.
49
Light attenuation
50
Light attenuation
51
Light attenuation
52
Light attenuation
53
Light attenuation
54
Light attenuation
55
Light attenuation
56
Light attenuation
57
Light attenuation
58
Light attenuation
59
Light attenuation
60
Light attenuation
61
Light attenuation
None.
62
Light attenuation
None.
We can neatly model light attenuation with the use of the scalar product.
63
Materials
64
Materials
Answer:
Different materials reflect incoming light to
different directions and absorb different amounts
of it.
65
Materials
66
Materials
67
Materials
68
Materials
Formally:
69
BRDF
70
BRDF?
71
Materials
72
Materials
73
BTDF
74
BSDF, BxDF
75
BSDF, BxDF
76
BRDF properties
1. Helmholtz-reciprocity
– The direction of the ray of light can be reversed,
77
BRDF properties
1. Helmholtz-reciprocity
– The direction of the ray of light can be reversed,
– Formally:
78
BRDF properties
1. Helmholtz-reciprocity
– The direction of the ray of light can be reversed,
– Formally:
2. Positivity
– It is an impossibility for an exit direction to have negative
probability. This is to make mathematicians happy.
79
BRDF properties
1. Helmholtz-reciprocity
– The direction of the ray of light can be reversed,
– Formally:
2. Positivity
– It is an impossibility for an exit direction to have negative
probability. This is to make mathematicians happy.
– Formally:
80
BRDF properties
3. Energy conservation
– This is the most important property:
81
BRDF properties
3. Energy conservation
– This is the most important property:
– Formally:
82
BRDF properties
3. Energy conservation
– This is the most important property:
– Formally:
85
The Rendering equation
86
The Rendering equation
Formally:
87
The Rendering equation
Formally:
88
The Rendering equation
89
The Rendering equation
90
The Rendering equation
91
The Rendering equation
92
The Rendering equation
93
The Rendering equation
94
The Rendering equation
95
The Rendering equation
Difficulties:
-The exitant radiance of a point x depends on the
incoming radiance of every other point, which also
depend on x,
96
The Rendering equation
Difficulties:
-The exitant radiance of a point x depends on the
incoming radiance of every other point, which also
depend on x,
97
The Rendering equation
Difficulties:
-The exitant radiance of a point x depends on the
incoming radiance of every other point, which also
depend on x,
98
The Rendering equation
Difficulties:
-The exitant radiance of a point x depends on the
incoming radiance of every other point, which also
depend on x,
99
The Rendering equation
Difficulties:
-The exitant radiance of a point x depends on the
incoming radiance of every other point, which also
depend on x,
101
The Rendering equation
102
The Rendering equation
108
BRDF types
109
BRDF types
110
BRDF types
111
BRDF types
113
BRDF types
114
BRDF types
115
BRDF types
116
BRDF types
117
BRDF types
119
BRDF types
120
BRDF types
121
BRDF types
122
BRDF types
123
BRDF types
124
BRDF types
125
BRDF types
126
BRDF types (diffuse)
127
BRDF types (diffuse)
128
BRDF types (diffuse)
129
BRDF types (diffuse)
130
Would this region look the same if I moved my head in
BRDF types (diffuse)
reality?
131
Would this region look the same if I moved my head in
BRDF types (diffuse)
reality?
Diffuse BRDF:
132
Would this region look the same if I moved my head in
BRDF types (diffuse)
reality?
Diffuse BRDF:
Don’t just look what is in the equation, but what isn’t there.
133
Would this region look the same if I moved my head in
BRDF types (diffuse)
reality?
Diffuse BRDF:
Don’t just look what is in the equation, but what isn’t there.
And that’s the view direction (V).
134
Would this region look the same if I moved my head in
BRDF types (diffuse)
reality?
Diffuse BRDF:
136
Would this region look the same if I moved my head in
BRDF types (diffuse)
reality?
Specular BRDF:
137
Would this region look the same if I moved my head in
BRDF types (diffuse)
reality?
Specular BRDF:
138
Would this region look the same if I moved my head in
BRDF types (diffuse)
reality?
Specular BRDF:
139
Would this region look the same if I moved my head in
BRDF types (diffuse)
reality?
Specular BRDF:
140
Would this region look the same if I moved my head in
BRDF types (diffuse)
reality?
Specular BRDF:
141
Would this region look the same if I moved my head in
BRDF types (diffuse)
reality?
Specular BRDF:
142
Would this region look the same if I moved my head in
BRDF types (diffuse)
reality?
Specular BRDF:
143
Would this region look the same if I moved my head in
BRDF types (diffuse)
reality?
It would be different!
Specular BRDF:
144
Would this region look the same if I moved my head in
BRDF types (diffuse)
reality?
It would be different!
Specular BRDF:
145
Isn’t this beautifully simple?
BRDF types (diffuse)
146
BRDF types (diffuse)
147
BRDF types (diffuse)
148
The illumination equation
This is the simplification of the rendering equation:
149
The illumination equation
This is the simplification of the rendering equation:
150
The illumination equation
This is the simplification of the rendering equation:
151
The illumination equation
This is the simplification of the rendering equation:
152
The illumination equation
This is the simplification of the rendering equation:
What’s missing?
153
The illumination equation
This is the simplification of the rendering equation:
What’s missing?
154
The algorithm
158
The illumination equation
Reflection
Refraction
159
160
The Fresnel equation (simplified)
Schlick’s approximation:
161
The Fresnel equation (simplified)
Schlick’s approximation:
162
The Fresnel equation (simplified)
Schlick’s approximation:
163
The Fresnel equation (simplified)
Schlick’s approximation:
164
The Fresnel equation (simplified)
Schlick’s approximation:
165
The Fresnel equation (simplified)
Schlick’s approximation:
166
The Fresnel equation (simplified)
Schlick’s approximation:
167
The Fresnel equation (simplified)
Schlick’s approximation:
(T as transmission)
168
The Fresnel equation (simplified)
Schlick’s approximation:
169
The Fresnel equation (simplified)
Schlick’s approximation:
170
The Fresnel equation (simplified)
Schlick’s approximation:
171
The Fresnel equation (simplified)
Schlick’s approximation:
172
The Fresnel equation (simplified)
Schlick’s approximation:
173
The Fresnel equation (simplified)
Air-glass interaction
174
The Fresnel equation (simplified)
Air-glass interaction
175
The Fresnel equation (simplified)
Air-glass interaction
176
The Fresnel equation (simplified)
Air-glass interaction
178
The Fresnel equation (simplified)
What do we expect?
180
The Fresnel equation (simplified)
What do we expect?
181
The Fresnel equation (simplified)
What do we expect?
182
The Fresnel equation (simplified)
183
The Fresnel equation (simplified)
184
The Fresnel equation (simplified)
185
The Fresnel equation (simplified)
186
The Fresnel equation (simplified)
187
The Fresnel equation (simplified)
188
The Fresnel equation (simplified)
Let’s do another experiment – vacuum-vacuum interaction:
189
The Fresnel equation (simplified)
Let’s do another experiment – vacuum-vacuum interaction:
190
The Fresnel equation (simplified)
Let’s do another experiment – vacuum-vacuum interaction:
191
The Fresnel equation (simplified)
Let’s do another experiment – vacuum-vacuum interaction.
Expectations:
192
The Fresnel equation (simplified)
Let’s do another experiment – vacuum-vacuum interaction.
Expectations:
193
The Fresnel equation (simplified)
Let’s do another experiment – vacuum-vacuum interaction.
Expectations:
194
The Fresnel equation (simplified)
Let’s do another experiment – vacuum-vacuum interaction.
Expectations:
195
The Fresnel equation (simplified)
196
The Fresnel equation (simplified)
197
The Fresnel equation (simplified)
198
The Fresnel equation (simplified)
199
The Fresnel equation (simplified)
The Schlick-approximation is used to efficiently
calculate vacuum-medium type of interactions.
200
The Fresnel equation (simplified)
The Schlick-approximation is used to efficiently
calculate vacuum-medium type of interactions.
201
The Fresnel equation (simplified)
The Schlick-approximation is used to efficiently
calculate vacuum-medium type of interactions.
202
The Fresnel equation
203
The Fresnel equation
204
The Fresnel equation
Identity:
205
The Fresnel equation
Identity:
206
The Fresnel equation
Identity:
207
The Fresnel equation
Identity:
208
Snell’s law
In what angle are refracted rays continuing their path?
209
Snell’s law
In what angle are refracted rays continuing their path?
210
Snell’s law
In what angle are refracted rays continuing their path?
211
Snell’s law
In what angle are refracted rays continuing their path?
212
Snell’s law
In what angle are refracted rays continuing their path?
213
Snell’s law
In what angle are refracted rays continuing their path?
214
Snell’s law
In what angle are refracted rays continuing their path?
215
Snell’s law
219
Snell’s law
220
Snell’s law
221
Snell’s law
In what angle are refracted rays continuing their path?
Snell’s law:
This is the original notation, where
the different numbers mean
different media.
Expectations?
222
Snell’s law
In what angle are refracted rays continuing their path?
Snell’s law:
This is the original notation, where
the different numbers mean
different media.
Expectations:
- the light is refracted inwards, therefore must hold.
224
Snell’s law
In what angle are refracted rays continuing their path?
Snell’s law:
This is the original notation, where
the different numbers mean
different media.
Expectations:
- the light is refracted inwards, therefore must hold.
Let’s see!
225
Snell’s law
Let’s pick refraction indices instead of velocities for convenience.
227
Snell’s law
Let’s pick refraction indices instead of velocities for convenience.
228
Snell’s law
Let’s pick refraction indices instead of velocities for convenience.
229
Snell’s law
Let’s pick refraction indices instead of velocities for convenience.
230
Snell’s law
Let’s pick refraction indices instead of velocities for convenience.
231
Snell’s law
Let’s pick refraction indices instead of velocities for convenience.
232
Snell’s law
Let’s pick refraction indices instead of velocities for convenience.
233
Snell’s law
Let’s pick refraction indices instead of velocities for convenience.
234
Snell’s law
Let’s pick refraction indices instead of velocities for convenience.
235
Snell’s law
Expectations:
- the light is refracted inwards, therefore must hold.
236
Snell’s law
Expectations:
- the light is refracted inwards, therefore must hold.
237
Snell’s law
Expectations:
- the light is refracted inwards, therefore must hold.
Physics works!
238
Where will the yellow ray be refracted?
Snell’s law
To the241right!
Total internal reflection
242
Total internal reflection
Total internal
243
reflection.
Total internal reflection
244
Total internal reflection
Air-glass interaction
245
Total internal reflection
Air-glass interaction
246
Total internal reflection
Air-glass interaction
247
Total internal reflection
Air-glass interaction
248
Total internal reflection
Air-glass interaction
249
Total internal reflection
250
Total internal reflection
Air-glass interaction
251
Total internal reflection
Air-glass interaction
252
Total internal reflection
Air-glass interaction
253
Total internal reflection
Air-glass interaction
254
Total internal reflection
255
Total internal reflection
257
Total internal reflection
Air-glass interaction
258
Total internal reflection
Air-glass interaction
259
The representation of a ray
260
The representation of a ray
261
The representation of a ray
262
The representation of a ray
263
The representation of a ray
264
The representation of a ray
265
The representation of a ray
266
The representation of a ray
267
The representation of a ray
Implicit equations look like this:
Example: 2D circle with center (a,b) and radius r:
268
The representation of a ray
Implicit equations look like this:
Example: 2D circle with center (a,b) and radius r:
269
The representation of a ray
Implicit equations look like this:
Example: 2D circle with center (a,b) and radius r:
270
Ray-sphere intersection
Let’s see how to compute where a ray hits a sphere .
Expectation:
271
Ray-sphere intersection
Let’s see how to compute where a ray hits a sphere.
Expectation:
2 hitpoints
272
Ray-sphere intersection
Let’s see how to compute where a ray hits a sphere .
Expectation:
2 hitpoints
1 hitpoint
273
Ray-sphere intersection
Let’s see how to compute where a ray hits a sphere .
Expectation:
2 hitpoints
1 hitpoint
no hits
274
Ray-sphere intersection
Let’s see how to compute where a ray hits a sphere .
Expectation:
2 hitpoints
So the solution for this
intersection scenario should
be able to produce 2
1 hitpoint solutions, 1 solution, or no
solutions at all.
no hits
275
Ray-sphere intersection
Sphere equation:
276
Ray-sphere intersection
Sphere equation:
Ray equation:
277
Ray-sphere intersection
Sphere equation:
Ray equation:
278
Ray-sphere intersection
Sphere equation:
Ray equation:
279
Ray-sphere intersection
Sphere equation:
Ray equation:
280
Ray-sphere intersection
281
Ray-sphere intersection
282
Ray-sphere intersection
283
Ray-sphere intersection
284
Ray-sphere intersection
285
Ray-sphere intersection
Two solutions:
286
Ray-sphere intersection
Two solutions:
Two solutions if OK
287
Ray-sphere intersection
Two solutions:
Two solutions if OK
One solution if OK
288
Ray-sphere intersection
Two solutions:
Two solutions if OK
One solution if OK
No (real) solution if OK
289
Ray-sphere intersection
However, if we have 2 solutions, t can also be a negative value.
290
Ray-sphere intersection
However, if we have 2 solutions, t can also be a negative value.
291
Ray-sphere intersection
However, if we have 2 solutions, t can also be a negative value.
Here t means the distance that the ray has traveled (you can
think of it as „time” traveled in the direction d), therefore the
ray is inside a sphere and one of the intersection points is
behind the origin of the ray.
293
Surface normals
For an implicit equation , the surface normal is given as
the gradient of the function: .
Definition:
294
Surface normals
For an implicit equation , the surface normal is given as
the gradient of the function: .
Example:
Elliptic paraboloid
Definition:
295
Surface normals
For an implicit equation , the surface normal is given as
the gradient of the function: .
Example:
Elliptic paraboloid
Definition:
296
Surface normals
For an implicit equation , the surface normal is given as
the gradient of the function: .
Example:
Elliptic paraboloid
Definition:
297
Surface normals
For an implicit equation , the surface normal is given as
the gradient of the function: .
Example:
Elliptic paraboloid
Definition:
298
Intersection routine
Intersect the ray with all objects in the scene. So what is the
first object that the ray hits?
299
Intersection routine
Intersect the ray with all objects in the scene. So what is the
first object that the ray hits?
300
Intersection routine
Intersect the ray with all objects in the scene. So what is the
first object that the ray hits?
301
Intersection routine
Intersect the ray with all objects in the scene. So what is the
first object that the ray hits?
302
Intersection routine
303
Intersection routine
304
Intersection routine
Can we take ?
305
Intersection routine
Can we take ?
306
Intersection routine
Can we take ?
307
A bit of beauty
308
A bit of beauty
309
Shadow computation
310
Shadow computation
311
Shadow computation
Umbra
312
Shadow computation
Obstructed/occluded connection
Unobstructed/unoccluded connection
Umbra
313
Shadow computation
Obstructed/occluded connection
Unobstructed/unoccluded connection
Umbra
314
Shadow computation
Obstructed/occluded connection
Unobstructed/unoccluded connection
Umbra
315
Shadow computation
Obstructed/occluded connection
Unobstructed/unoccluded connection
Umbra
316
Shadow computation
Obstructed/occluded connection
Unobstructed/unoccluded connection
Umbra
317
Shadow computation
Obstructed/occluded connection
Unobstructed/unoccluded connection
Umbra
318
Shadow computation
Obstructed/occluded connection
Unobstructed/unoccluded connection
Umbra
319
Shadow computation
Obstructed/occluded connection
Unobstructed/unoccluded connection
Umbra
320
Shadow computation
Obstructed/occluded connection
Unobstructed/unoccluded connection
Umbra
321
Shadow computation
Obstructed/occluded connection
Unobstructed/unoccluded connection
Umbra
322
Shadow computation
Obstructed/occluded connection
Unobstructed/unoccluded connection
323
Shadow computation
Obstructed/occluded connection
Unobstructed/unoccluded connection
324
Shadow computation
Obstructed/occluded connection
Unobstructed/unoccluded connection
325
Shadow computation
Obstructed/occluded connection
Unobstructed/unoccluded connection
326
Shadow computation
Obstructed/occluded connection
Unobstructed/unoccluded connection
328
Shadow computation
329
Shadow computation
330
Shadow computation
331
Shadow computation
332
Shadow computation
333
Shadow computation
334
Shadow computation
335
Shadow computation
336
Shadow computation
337
Shadow computation
338
Shadow computation
Shadow computation
Shadow computation
A recursive ray tracer only takes the direct effect of the light
sources into account (we call this direct illumination).
Shadow computation
A recursive ray tracer only takes the direct effect of the light
sources into account (we call this direct illumination).
346
Camera models
Pinhole camera
347
Camera models
Perspective camera
The starting point of the rays are fixed in the eye of the
viewer, and they are connected to a plane.
348
Camera models
Perspective camera
Parameters:
Plane width,
Plane height,
Field of view,
Aspect ratio
The starting point of the rays are fixed in the eye of the
viewer, and they are connected to a plane.
349
Camera models
Perspective camera
350
Camera models
Perspective camera construction
351
Camera models
Perspective camera construction
352
Camera models
Perspective camera construction
353
Camera models
Perspective camera construction
354
Camera models
Perspective camera construction
Forget the fov for a bit and let’s play with it:
355
Camera models
Perspective camera construction
Forget the fov for a bit and let’s play with it:
356
Camera models
Perspective camera construction
Forget the fov for a bit and let’s play with it:
This is the bottom left.
357
Camera models
Perspective camera construction
Forget the fov for a bit and let’s play with it:
This is the bottom left.
358
Camera models
Perspective camera construction
Forget the fov for a bit and let’s play with it:
This is the bottom left.
This is the upper right.
359
Camera models
Forget the fov for a bit and let’s play with it:
This is the bottom left.
This is upper bottom right.
Now consider the fov as a scaling factor:
360
Camera models
Forget the fov for a bit and let’s play with it:
This is the bottom left.
This is upper bottom right.
Now consider the fov as a scaling factor:
361
Camera models
Forget the fov for a bit and let’s play with it:
This is the bottom left.
This is upper bottom right.
Now consider the fov as a scaling factor:
362
Camera models
363
Camera models
364
Camera models
Orthographic camera
365
Camera models
Orthographic camera
The camera rays are parallel, and they don’t meet at the eye.
366
Camera models
Orthographic
Perspective camera 367
Perspective
Camera models
370
Recursion
371
Recursion
372
Recursion
373
The Illumination Equation with recursion
374
The Illumination Equation with recursion
375
The Illumination Equation with recursion
376
The Illumination Equation with recursion
377
The Illumination Equation with recursion
378
The Illumination Equation with recursion
379
Heckbert’s notation for light paths
L – light source
D – diffuse light paths
S – specular light paths
E – eye/camera
380
Heckbert’s notation for light paths
L – light source
D – diffuse light paths
S – specular light paths
E – eye/camera
381
Heckbert’s notation for light paths
L – light source
D – diffuse light paths
S – specular light paths
E – eye/camera
382
Heckbert’s notation for light paths
383
Heckbert’s notation for light paths
Practical part
Let’s play a bit with Paul Heckbert’s „business card” ray tracer.
386
Assignment #1
Practical part
- Get http://cg.tuwien.ac.at/~zsolnai/rendering/rendering_assignment1_ray_tracing.zip
- Follow the instructions in the readme.txt file to compile,
- Make images with different DEPTH values in ray.h (1-5),
- What did you experience visually? Why?
- Crank up the DEPTH value (20+). How does it affect the
runtime?
- Analyze the runtime of the algorithm depending on DEPTH.
Does it deteriorate? Why or why not?
Assignment #1
Practical part
- Get http://cg.tuwien.ac.at/~zsolnai/rendering/rendering_assignment1_ray_tracing.zip
- Follow the instructions in the readme.txt file to compile,
- Make images with different DEPTH values in ray.h (1-5),
- What did you experience visually? Why?
- Crank up the DEPTH value (20+). How does it affect the
runtime?
- Analyze the runtime of the algorithm depending on DEPTH.
Does it deteriorate? Why or why not?
390
Assignment #1
Practical part
Make a plot of your measurements. For this you can use any
software you wish (Excel, gnuplot, anything).
Filenames:
- heckbert_runtimes1.txt,
- heckbert_runtimes1.png for the plot,
391
Assignment #1
Draw the following light paths onto the picture:
- LE
- LDE,
- LSE,
- LDDE,
- LDSE,
- LSDE,
Save as light_paths.(png|jpg)
392
Assignment #1
Practical part
Your observations, should go into the observations.txt file.
Example: heckbert_depth3.png
Yes, please convert them from uncompressed ppm to png.
393
Assignment #1
Subject: [rendering_$year_($assignment_number)]_
($your_matrikelnumber),($your_name)
Filename: same with .zip extension
Example:
[Rendering_SS2048_1]_0123456,Thomas Auzinger
394