-
Notifications
You must be signed in to change notification settings - Fork 2
/
tutorials.html
321 lines (314 loc) · 17.7 KB
/
tutorials.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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>Intel OSPRay Tutorials</title>
<link rel="stylesheet" type="text/css" media="screen" href="stylesheet.css">
<style type="text/css">
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { color: #008000; } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { color: #008000; font-weight: bold; } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
div.sourceCode { overflow-x: initial; }
</style>
</head>
<body>
<div id="header">
<div id="header-github">
<a id="forkme-banner" href="https://github.com/ospray/OSPRay">View on GitHub</a>
</div>
<div id="header-title">
Intel<sup>®</sup> OSPRay
</div>
<div id="header-navbar">
<ul>
<li><a href="index.html">Overview</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="documentation.html">Documentation</a></li>
<li id="selected"><a href="tutorials.html">Tutorials</a></li>
<li><a href="gallery.html">Gallery</a></li>
<li><a href="https://github.com/ospray/OSPRay/issues">Bugs/Issues</a></li>
<li><a href="related_projects.html">Related Projects</a></li>
</ul>
</div>
<div id="header-spacing"></div>
</div>
<div id="content-wrap">
<div id="content">
<h1 id="tutorials">Tutorials</h1>
<h2 id="osptutorial">ospTutorial</h2>
<p>A minimal working example demonstrating how to use OSPRay can be
found at <a
href="https://github.com/ospray/ospray/blob/master/apps/ospTutorial/ospTutorial.c"><code>apps/tutorials/ospTutorial.c</code></a><a
href="#fn1" class="footnote-ref" id="fnref1"
role="doc-noteref"><sup>1</sup></a>.</p>
<p>An example of building <code>ospTutorial.c</code> with CMake can be
found in <a
href="https://github.com/ospray/ospray/tree/master/apps/ospTutorial/ospTutorialFindospray"><code>apps/tutorials/ospTutorialFindospray/</code></a>.</p>
<p>To build the tutorial on Linux, build it in a build directory
with</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">gcc</span> <span class="at">-std</span><span class="op">=</span>c99 ../apps/ospTutorial/ospTutorial.c <span class="dt">\</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a>-I ../ospray/include <span class="at">-L</span> . <span class="at">-lospray</span> <span class="at">-Wl,-rpath,.</span> <span class="at">-o</span> ospTutorial</span></code></pre></div>
<p>On Windows build it can be build manually in a
“build_directory\$Configuration” directory with</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cl</span> ..<span class="dt">\.</span>.<span class="dt">\a</span>pps<span class="dt">\o</span>spTutorial<span class="dt">\o</span>spTutorial.c <span class="at">-I</span> ..<span class="dt">\.</span>.<span class="dt">\o</span>spray<span class="dt">\i</span>nclude <span class="at">-I</span> ..<span class="dt">\.</span>. ospray.lib</span></code></pre></div>
<p>Running <code>ospTutorial</code> will create two images of two
triangles, rendered with the Scientific Visualization renderer with full
Ambient Occlusion. The first image <code>firstFrame.ppm</code> shows the
result after one call to <code>ospRenderFrame</code> – jagged edges and
noise in the shadow can be seen. Calling <code>ospRenderFrame</code>
multiple times enables progressive refinement, resulting in antialiased
edges and converged shadows, shown after ten frames in the second image
<code>accumulatedFrames.ppm</code>.</p>
<figure>
<img src="images/tutorial_firstframe.png" alt="First frame." />
<figcaption aria-hidden="true">First frame.</figcaption>
</figure>
<figure>
<img src="images/tutorial_accumulatedframe.png"
alt="After accumulating ten frames." />
<figcaption aria-hidden="true">After accumulating ten
frames.</figcaption>
</figure>
<h2 id="ospexamples">ospExamples</h2>
<p>Apart from tutorials, <code>OSPRay</code> comes with a C++ app called
<a
href="https://github.com/ospray/ospray/tree/master/apps/ospExamples"><code>ospExamples</code></a>
which is an elaborate easy-to-use tutorial, with a single interface to
try various <code>OSPRay</code> features. It is aimed at providing users
with multiple simple scenes composed of basic geometry types, lights,
volumes etc. to get started with OSPRay quickly.</p>
<p><code>ospExamples</code> app runs a <code>GLFWOSPRayWindow</code>
instance that manages instances of the camera, framebuffer, renderer and
other OSPRay objects necessary to render an interactive scene. The scene
is rendered on a <code>GLFW</code> window with an <code>imgui</code> GUI
controls panel for the user to manipulate the scene at runtime.</p>
<p>The application is located in <a
href="https://github.com/ospray/ospray/tree/master/apps/ospExamples"><code>apps/ospExamples/</code></a>
directory and can be built with CMake. It can be run from the build
directory via:</p>
<pre><code>./ospExamples <command-line-parameter></code></pre>
<p>The command line parameter is optional however.</p>
<figure>
<img src="images/ospExamples.png" style="width:90.0%"
alt="ospExamples application with default boxes scene." />
<figcaption aria-hidden="true"><code>ospExamples</code> application with
default <code>boxes</code> scene.</figcaption>
</figure>
<h3 id="scenes">Scenes</h3>
<p>Different scenes can be selected from the <code>scenes</code>
dropdown and each scene corresponds to an instance of a special
<code>detail::Builder</code> struct. Example builders are located in <a
href="https://github.com/ospray/ospray/tree/master/apps/common/ospray_testing/builders"><code>apps/common/ospray_testing/builders/</code></a>.
These builders provide a usage guide for the OSPRay scene hierarchy and
OSPRay API in the form of <code>cpp</code> wrappers. They instantiate
and manage objects for the specific scene like
<code>cpp::Geometry</code>, <code>cpp::Volume</code>,
<code>cpp::Light</code> etc.</p>
<p>The <code>detail::Builder</code> base struct is mostly responsible
for setting up OSPRay <code>world</code> and objects common in all
scenes (for example lighting and ground plane), which can be
conveniently overridden in the derived builders.</p>
<h3 id="renderer">Renderer</h3>
<p>This app comes with four <a
href="documentation.html#renderers">renderer</a> options:
<code>scivis</code>, <code>pathtracer</code>, <code>ao</code> and
<code>debug</code>. The app provides some common rendering controls like
<code>pixelSamples</code> and other more specific to the renderer type
like <code>aoSamples</code> for the <code>scivis</code> and
<code>ao</code> renderer or <code>maxPathLength</code> for the
<code>pathtracer</code>.</p>
<p>The sun-sky lighting can be used in a sample scene by enabling the
<code>renderSunSky</code> option of the <code>pathtracer</code>
renderer. It allows the user to change <code>turbidity</code> and
<code>sunDirection</code>.</p>
<figure>
<img src="images/renderSunSky.png" style="width:90.0%"
alt="Rendering an evening sky with the renderSunSky option." />
<figcaption aria-hidden="true">Rendering an evening sky with the
<code>renderSunSky</code> option.</figcaption>
</figure>
<h2 id="ospmpidistribtutorial">ospMPIDistribTutorial</h2>
<p>A minimal working example demonstrating how to use OSPRay for
rendering distributed data can be found at <a
href="https://github.com/ospray/ospray/blob/master/modules/mpi/tutorials/ospMPIDistribTutorial.c"><code>modules/mpi/tutorials/ospMPIDistribTutorial.c</code></a><a
href="#fn2" class="footnote-ref" id="fnref2"
role="doc-noteref"><sup>2</sup></a>.</p>
<p>The compilation process via CMake is the similar to <a
href="https://github.com/ospray/ospray/tree/master/apps/ospTutorial/ospTutorialFindospray"><code>apps/tutorials/ospTutorialFindospray/</code></a>,
with the addition of finding and linking MPI.</p>
<p>To build the tutorial on Linux, build it in a build directory
with</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">mpicc</span> <span class="at">-std</span><span class="op">=</span>c99 ../modules/mpi/tutorials/ospMPIDistribTutorial.c <span class="dt">\</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a>-I ../ospray/include <span class="at">-L</span> . <span class="at">-lospray</span> <span class="at">-Wl,-rpath,.</span> <span class="at">-o</span> ospMPIDistribTutorial</span></code></pre></div>
<p>On Windows build it can be build manually in a
“build_directory\$Configuration” directory with</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cl</span> ..<span class="dt">\.</span>.<span class="dt">\m</span>odules<span class="dt">\m</span>pi<span class="dt">\t</span>utorials<span class="dt">\o</span>spMPIDistribTutorial.c <span class="at">-I</span> ..<span class="dt">\.</span>.<span class="dt">\o</span>spray<span class="dt">\i</span>nclude <span class="at">-I</span> ..<span class="dt">\.</span>. ospray.lib</span></code></pre></div>
<p>The MPI module does not need to be linked explicitly, as it is loaded
as a module at runtime.</p>
<figure>
<img src="images/ospMPIDistribTutorial_firstFrame.jpg"
style="width:60.0%"
alt="The first frame output by the ospMPIDistribTutorial or C++ tutorial with 4 ranks." />
<figcaption aria-hidden="true">The first frame output by the
<code>ospMPIDistribTutorial</code> or C++ tutorial with 4
ranks.</figcaption>
</figure>
<figure>
<img src="images/ospMPIDistribTutorial_accumulatedFrame.jpg"
style="width:60.0%"
alt="The accumulated frame output by the ospMPIDistribTutorial or C++ tutorial with 4 ranks." />
<figcaption aria-hidden="true">The accumulated frame output by the
<code>ospMPIDistribTutorial</code> or C++ tutorial with 4
ranks.</figcaption>
</figure>
<h2
id="ospmpidistribtutorialspheres-and-ospmpidistribtutorialvolume">ospMPIDistribTutorialSpheres
and ospMPIDistribTutorialVolume</h2>
<p>The spheres and volume distributed tutorials are built as part of the
MPI tutorials when building OSPRay with the MPI module and tutorials
enabled. These tutorials demonstrate using OSPRay to render distributed
data sets where each rank owns some subregion of the data, and
displaying the output in an interactive window. The domain is
distributed in a grid among the processes, each of which will generate a
subset of the data corresponding to its subdomain.</p>
<p>In <code>ospMPIDistribTutorialSpheres</code>, each process generates
a set of spheres within its assigned domain. The spheres are colored
from dark to light blue, where lighter colors correspond to higher
ranks.</p>
<figure>
<img src="images/ospMPIDistribTutorialSpheres.jpg" style="width:60.0%"
alt="Running ospMPIDistribTutorialSpheres on 4 ranks." />
<figcaption aria-hidden="true">Running
<code>ospMPIDistribTutorialSpheres</code> on 4 ranks.</figcaption>
</figure>
<p>In <code>ospMPIDistribTutorialVolume</code>, each process generates a
subbrick of volume data, which is colored by its rank.</p>
<figure>
<img src="images/ospMPIDistribTutorialVolume.jpg" style="width:60.0%"
alt="Running ospMPIDistribTutorialVolume on 4 ranks." />
<figcaption aria-hidden="true">Running
<code>ospMPIDistribTutorialVolume</code> on 4 ranks.</figcaption>
</figure>
<h2
id="ospmpidistribtutorialpartialrepl">ospMPIDistribTutorialPartialRepl</h2>
<p>The partially replicated MPI tutorial demonstrates how to use
OSPRay’s distributed rendering capabilities to render data sets that are
partially replicated among the processes. Each pair of ranks generates
the same volume brick, allowing them to subdivide the rendering workload
between themselves. For example, when run with two ranks, each will
generate the same brick and be responsible for rendering half of the
image tiles it projects to. When run with four ranks, the pairs of ranks
0,1 and 2,3 will generate the same data and divide the rendering
workload for that data among themselves.</p>
<p>The image work subdivision happens automatically, based on which
ranks specify the same bounding box for their data, as demonstrated in
the tutorial.</p>
<p>The partially replicated distribution is useful to support
load-balanced rendering of data sets that are too large to be fully
replicated among the processes, but are small enough to be partially
replicated among them.</p>
<h2
id="ospmpidistribtutorialreplicated">ospMPIDistribTutorialReplicated</h2>
<p>The replicated MPI tutorial demonstrates how OSPRay’s distributed
rendering capabilities can be used to render data sets that are fully
replicated among the ranks with advanced illumination effects. In this
case, although the processes are run MPI parallel, each rank specifies
the exact same data. OSPRay’s MPI parallel renderer will detect that the
data is replicated in this case and use the same image-parallel
rendering algorithms employed in the MPI offload rendering configuration
to render the data. This image-parallel rendering algorithm supports all
rendering configurations that are used in local rendering, e.g., path
tracing, to provide high-quality images.</p>
<p>The replicated MPI tutorial supports the same scenes and parameters
as the <a href="tutorials.html#ospexamples"><code>ospExamples</code></a>
app described above.</p>
<p>This mode can be useful when high-quality rendering is desired and it
is possible to copy the entire data set on to each rank, or to
accelerate loading of a large model by leveraging a parallel file
system.</p>
<section id="footnotes" class="footnotes footnotes-end-of-document"
role="doc-endnotes">
<hr />
<ol>
<li id="fn1"><p>A C++ version that uses the C++ convenience wrappers of
OSPRay’s C99 API via <a
href="https://github.com/ospray/ospray/blob/master/ospray/include/ospray/ospray_cpp.h"><code>include/ospray/ospray_cpp.h</code></a>
is available at <a
href="https://github.com/ospray/ospray/blob/master/apps/ospTutorial/ospTutorial.cpp"><code>apps/tutorials/ospTutorial.cpp</code></a>.<a
href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn2"><p>A C++ version that uses the C++ convenience wrappers of
OSPRay’s C99 API via <a
href="https://github.com/ospray/ospray/blob/master/ospray/include/ospray/ospray_cpp.h"><code>include/ospray/ospray_cpp.h</code></a>
is available at <a
href="https://github.com/ospray/ospray/blob/master/modules/mpi/tutorials/ospMPIDistribTutorial.cpp"><code>modules/mpi/tutorials/ospMPIDistribTutorial.cpp</code></a>.<a
href="#fnref2" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
</ol>
</section>
</div>
</div>
<div id="footer">
© 2013 Intel Corporation <a href="legal.html">Disclaimer and Legal Information</a>
<a href="https://www.intel.com/privacy">Privacy</a>
</div>
</body>
</html>