forked from mmp/pbr-book-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShapes.html
187 lines (148 loc) · 7.34 KB
/
Shapes.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!doctype html>
<html lang="en">
<head>
<!-- all praise to https://realfavicongenerator.net -->
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="/fonts.css">
<link rel="stylesheet" href="/fontawesome-free-5.15.3-web/css/all.css">
<link rel="stylesheet" href="/bootstrap.min.css">
<script async src="https://cse.google.com/cse.js?cx=003601324460585362024:4xwpwgaitgd"></script>
<script src="/react.min.js"></script>
<script src="/react-dom.min.js"></script>
<script src="/jeri.min.js"></script>
<link rel="preload" href="/exr.worker.js" as="script" crossorigin="anonymous">
<link rel="stylesheet" href="/3ed-2018/pbrstyle.css">
<script src="/3ed-2018/pbrt-display.js"></script>
<title>Shapes</title>
</head>
<body>
<nav class="fixed-top-lg-navbar navbar navbar-expand">
<ul class="nav navbar-nav">
<a class="navbar-brand" href="/3ed-2018/contents.html"><img src="/3ed-2018/pbr.jpg" width=25 height=25></a>
<li class="nav-item"><a class="nav-link" href="contents.html">Physically Based Rendering: </a></li>
<li class="nav-item"><a class="nav-link" href="#">Shapes</a></li>
<span class="navbar-text"> </span>
<li class="nav-item"><a class="nav-link" href="/3ed-2018/Geometry_and_Transformations/Exercises.html">(Previous: Exercises)</a></li>
</ul>
<ul class="nav navbar-nav ml-auto d-none d-md-block">
<li class="nav-item"><div class="gcse-search"></div></li>
</ul>
<ul class="nav navbar-nav d-block d-md-none">
<li class="nav-item"><div class="gcse-search"></div></li>
</ul>
<ul class="nav navbar-nav d-block">
<li class="nav-item"><button class="displaymode" onclick="TogglePBRTDisplayMode()"></button></li>
</ul>
</nav>
<div class="maincontainer">
<div class="container-fluid">
<div class="row">
<div class="col-md-1 col-lg-2 leftcolumn">
</div>
<div class="col-md-10 col-lg-8">
</div> <!-- col-md-10 col-lg-8 -->
<div class="col-md-1 col-lg-2">
</div> <!-- col-md-1 col-lg-2 -->
</div> <!-- row -->
<div class="jumbotron jumbotron-fluid bg-cover-100 opener-image" style="background-image: url('openers/killeroo-control.jpg'); background-position: center;">
</div>
<div class="row">
<div class="col-md-1 col-lg-2 leftcolumn">
</div>
<div class="col-md-10 col-lg-8">
</div> <!-- col-md-10 col-lg-8 -->
<div class="col-md-1 col-lg-2">
</div> <!-- col-md-1 col-lg-2 -->
</div> <!-- row -->
<div class="row">
<div class="col-md-1 col-lg-2 leftcolumn">
<a href="#"><i class="fas fa-link "></i></a>
</div>
<div class="col-md-10 col-lg-8">
<span class="anchor" id="chap:shapes"></span><h1>3 Shapes</h1><p>
</p>
<p> In this chapter, we will present <tt>pbrt</tt>’s abstraction for geometric
primitives such as spheres and triangles. Careful abstraction of geometric
shapes in a ray tracer is a key component of a clean system design, and
shapes are the ideal candidate for an object-oriented approach.
All geometric primitives implement a common interface, and the rest of
the renderer can use this interface without needing any details about the
underlying shape. This makes it possible to separate the geometric and
shading subsystems of <tt>pbrt</tt>.
</p>
<p><tt>pbrt</tt> hides details about primitives behind a two-level abstraction. The
<a href="Shapes/Basic_Shape_Interface.html#Shape"><tt>Shape</tt></a> class provides access to the raw geometric properties of the
primitive, such as its surface area and bounding box, and provides a ray
intersection routine. The <a href="Primitives_and_Intersection_Acceleration/Primitive_Interface_and_Geometric_Primitives.html#Primitive"><tt>Primitive</tt></a> class encapsulates additional
nongeometric information about the primitive, such as its material
properties. The rest of the renderer then deals only with the abstract
<a href="Primitives_and_Intersection_Acceleration/Primitive_Interface_and_Geometric_Primitives.html#Primitive"><tt>Primitive</tt></a> interface. This chapter will focus on the geometry-only
<a href="Shapes/Basic_Shape_Interface.html#Shape"><tt>Shape</tt></a> class; the <a href="Primitives_and_Intersection_Acceleration/Primitive_Interface_and_Geometric_Primitives.html#Primitive"><tt>Primitive</tt></a> interface is a key topic of
Chapter <a href="Primitives_and_Intersection_Acceleration.html#chap:acceleration">4</a>.
</p>
<p>
</p>
<p></p>
</div> <!-- col-md-10 col-lg-8 -->
<div class="col-md-1 col-lg-2">
</div> <!-- col-md-1 col-lg-2 -->
</div> <!-- row -->
</div> <!-- container-fluid -->
</div> <!-- maincontainer -->
<nav class="navbar navbar-expand-md">
<div class="container-fluid-nav">
<!-- <ul class="nav navbar-nav navbar-center"> -->
<span class="navbar-text" style="text-align: center;">
Thanks to Farhan Wali and 34 others for generously supporting <i>Physically
Based Rendering</i> online
through <a href="https://patreon.com/pbrbook">Patreon</a>.
</span>
</div>
</nav>
<nav class="navbar navbar-expand-md">
<span class="navbar-text"><i>Physically Based Rendering: From Theory To Implementation</i>, © 2004-2021 Matt Pharr, Wenzel Jakob, and Greg Humphreys under the <a href="https://creativecommons.org/licenses/by-nc-nd/4.0/">CC BY-NC-ND 4.0</a> license. (<a href="https://github.com/mmp/pbr-book-website/">github</a>)</span>
<div class="container">
<ul class="nav navbar-nav ml-auto">
<li class="nav-item">Next: <a href="Shapes/Basic_Shape_Interface.html">Shapes / Basic Shape Interface</a></li>
</ul>
</div>
</nav>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script>
$(function () {
$('[data-toggle="popover"]').popover()
$('[data-toggle="tooltip"]').tooltip()
})
</script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script>
// https://stackoverflow.com/a/17535094
// The function actually applying the offset
function offsetAnchor() {
if (location.hash.length !== 0) {
window.scrollTo(window.scrollX, window.scrollY - window.innerHeight / 8);
}
}
// Captures click events of all <a> elements with href starting with #
$(document).on('click', 'a[href^="#"]', function(event) {
// Click events are captured before hashchanges. Timeout
// causes offsetAnchor to be called after the page jump.
window.setTimeout(function() {
offsetAnchor();
}, 500);
});
// Set the offset when entering page with hash present in the url
window.setTimeout(offsetAnchor, 1500);
</script>
</body>
</html>