Rendering: Monte Carlo Integration II
Bernhard Kerbl
Research Division of Computer Graphics Institute of Visual Computing & Human-Centered Technology TU Wien, Austria
With slides based on material by Jaakko Lehtinen, used with permission
Rendering: Monte Carlo Integration II Bernhard Kerbl Research - - PowerPoint PPT Presentation
Rendering: Monte Carlo Integration II Bernhard Kerbl Research Division of Computer Graphics Institute of Visual Computing & Human-Centered Technology TU Wien, Austria With slides based on material by Jaakko Lehtinen, used with
With slides based on material by Jaakko Lehtinen, used with permission
Rendering โ Monte Carlo Integration I 2
Rendering โ Monte Carlo Integration II 3
2 2 r = 1
Rendering โ Monte Carlo Integration II 4
Rendering โ Monte Carlo Integration II 5
Rendering โ Monte Carlo Integration II 6
Rendering โ Monte Carlo Integration II 7
Rendering โ Monte Carlo Integration II 8
Rendering โ Monte Carlo Integration II 9
Rendering โ Monte Carlo Integration II 10
Rendering โ Monte Carlo Integration II 11
void sampleUnitDisk() { std::default_random_engine r_rand_eng(0xdecaf); std::default_random_engine theta_rand_eng(0xcaffe); std::uniform_real_distribution<double> uniform_dist(0.0, 1.0); for (int i = 0; i < NUM_SAMPLES; i++) { auto r = uniform_dist(r_rand_eng); auto theta = uniform_dist(theta_rand_eng) * 2 * M_PI; auto x = r * sin(theta); auto y = r * cos(theta); samples2D[i] = std::make_pair(x, y); } }
0,5 1
0,5 1 Rendering โ Monte Carlo Integration II 12
Rendering โ Monte Carlo Integration II 13
Rendering โ Monte Carlo Integration II 14
0,5 1
0,5 1
0,5 1
0,5 1
Rendering โ Monte Carlo Integration II 15
Rendering โ Monte Carlo Integration II 16
Rendering โ Monte Carlo Integration II 17
๐(๐ , ๐)
Rendering โ Monte Carlo Integration II 18
Rendering โ Monte Carlo Integration II 19
๐๐ก๐๐๐: ๐๐
๐ ๐ฆ
๐๐ง = ๐๐ ๐ฆ ๐๐ฆ ๐๐ง
Rendering โ Monte Carlo Integration II 20
Rendering โ Monte Carlo Integration II 21
Rendering โ Monte Carlo Integration II 22
Rendering โ Monte Carlo Integration II 23
Rendering โ Monte Carlo Integration II 24
1 ๐๐1 ๐๐1 ๐๐2 ๐๐1 1 ๐๐1 ๐๐2 ๐๐2 ๐๐2
Rendering โ Monte Carlo Integration II 25
Rendering โ Monte Carlo Integration II 26
Rendering โ Monte Carlo Integration II 27
1 2๐ and ๐ ๐ฆ, ๐ง = ๐(๐ ,๐) ๐
Rendering โ Monte Carlo Integration II 28
num_bins = 20 xlist = np.linspace(-1.0, 1.0, num_bins) ylist = np.linspace(-1.0, 1.0, num_bins) bin_volume = 4 / (num_bins*num_bins) X, Y = np.meshgrid(xlist, ylist) X += 1/num_bins Y += 1/num_bins r = np.sqrt(X*X+Y*Y) uniform_dist = 1/(2 * np.pi) pdf_transform = 1/r Z = uniform_dist * pdf_transform * bin_volume Z[r>1] = 0 fig,ax = plt.subplots(1,1) cp = plt.pcolor(X, Y, Z,cmap='viridis',norm=matplotlib.colors.LogNorm()) fig.colorbar(cp) # Add a colorbar to a plot plt.show()
Rendering โ Monte Carlo Integration II 29
Rendering โ Monte Carlo Integration II 30
Rendering โ Monte Carlo Integration II 31
Rendering โ Monte Carlo Integration II 32
Rendering โ Monte Carlo Integration II 33
Rendering โ Monte Carlo Integration II 34
Rendering โ Monte Carlo Integration II 35
Rendering โ Monte Carlo Integration II 36
Rendering โ Monte Carlo Integration II 37
Rendering โ Monte Carlo Integration II 38
Rendering โ Monte Carlo Integration II 39
Rendering โ Monte Carlo Integration II 40
๐ 2 ืฌ
Rendering โ Monte Carlo Integration II 41
Rendering โ Monte Carlo Integration II 42
ฮ๐ ฮ๐
Rendering โ Monte Carlo Integration II 43
Rendering โ Monte Carlo Integration II 44
Rendering โ Monte Carlo Integration II 45
Rendering โ Monte Carlo Integration II 46
Rendering โ Monte Carlo Integration II 47
Rendering โ Monte Carlo Integration II 48
Rendering โ Monte Carlo Integration II 49
Rendering โ Monte Carlo Integration II 50
Rendering โ Monte Carlo Integration II 51
Rendering โ Monte Carlo Integration II 52
๐
Rendering โ Monte Carlo Integration II 53
Rendering โ Monte Carlo Integration II 54 100 samples per pixel, hemisphere sampling 100 samples per pixel, light source sampling
Rendering โ Monte Carlo Integration II 55
Rendering โ Monte Carlo Integration II 56
Rendering โ Monte Carlo Integration II 57
๐=1 ๐ ๐๐(๐ฆ, ๐)
Rendering โ Monte Carlo Integration II 58
๐ฆ ๐
Rendering โ Monte Carlo Integration II 59
๐=1 ๐ ๐๐(๐ฆ, ๐)
Rendering โ Monte Carlo Integration II 60
Rendering โ Monte Carlo Integration II 61
Rendering โ Monte Carlo Integration II 62
เถฑ
๐๐ง
เถฑ
๐๐ฆ
๐๐(๐ฆ, ๐ค) ๐๐๐ฆ ๐๐๐ง ๐ค1 ๐ค2 ๐ฆ1 ๐ฆ2 ๐
โ1(๐๐)
Rendering โ Monte Carlo Integration II 63
Nothing else necessary: offsets in x and y are uniformly distributed, they are independent, the domain size of each pixel is 1x1=1 and so we donโt have to change the integration at all.
Rendering โ Monte Carlo Integration II 64
Rendering โ Monte Carlo Integration II 65
Default RNG 2,3 Halton Sequence
Jheald, Wikipedia, Halton Sequence โ โOwn workโ
Rendering โ Monte Carlo Integration II 66
Default RNG 2,3 Halton Sequence
Jheald, Wikipedia, Halton Sequence โ โOwn workโ
Rendering โ Monte Carlo Integration II 67
29,31 Halton Sequence 29,31 Halton Scrambled
Rendering โ Monte Carlo Integration II 68
Rendering โ Monte Carlo Integration II 69