Updated documentation.
[sixth-3d.git] / doc / index.html
1 <!doctype html>
2 <html lang="en">
3 <head>
4 <title>Sixth 3D - 3D engine</title>
5 <!-- 2018-01-04 Thu 00:12 -->
6 <meta charset="utf-8">
7 <meta name="viewport" content="width=device-width, initial-scale=1">
8 <meta name="generator" content="Org-mode">
9 <meta name="author" content="Svjatoslav Agejenko">
10 <link href="https://bootswatch.com/4/darkly/bootstrap.min.css" rel="stylesheet">
11 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
12 <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js"></script>"
13 <style type="text/css">
14 footer {background-color: #111 !important;}
15 pre {background-color: #111; color: #ccc;}
16 </style>
17 <style type="text/css">
18 /* org mode styles on top of twbs */
19
20 html {
21     position: relative;
22     min-height: 100%;
23 }
24
25 body {
26     font-size: 18px;
27     margin-bottom: 105px;
28 }
29
30 footer {
31     position: absolute;
32     bottom: 0;
33     width: 100%;
34     height: 101px;
35     background-color: #f5f5f5;
36 }
37
38 footer > div {
39     padding: 10px;
40 }
41
42 footer p {
43     margin: 0 0 5px;
44     text-align: center;
45     font-size: 16px;
46 }
47
48 #table-of-contents {
49     margin-top: 20px;
50     margin-bottom: 20px;
51 }
52
53 blockquote p {
54     font-size: 18px;
55 }
56
57 pre {
58     font-size: 16px;
59 }
60
61 .footpara {
62     display: inline-block;
63 }
64
65 figcaption {
66   font-size: 16px;
67   color: #666;
68   font-style: italic;
69   padding-bottom: 15px;
70 }
71
72 /* from twbs docs */
73
74 .bs-docs-sidebar.affix {
75     position: static;
76 }
77 @media (min-width: 768px) {
78     .bs-docs-sidebar {
79         padding-left: 20px;
80     }
81 }
82
83 /* All levels of nav */
84 .bs-docs-sidebar .nav > li > a {
85     display: block;
86     padding: 4px 20px;
87     font-size: 14px;
88     font-weight: 500;
89     color: #999;
90 }
91 .bs-docs-sidebar .nav > li > a:hover,
92 .bs-docs-sidebar .nav > li > a:focus {
93     padding-left: 19px;
94     color: #A1283B;
95     text-decoration: none;
96     background-color: transparent;
97     border-left: 1px solid #A1283B;
98 }
99 .bs-docs-sidebar .nav > .active > a,
100 .bs-docs-sidebar .nav > .active:hover > a,
101 .bs-docs-sidebar .nav > .active:focus > a {
102     padding-left: 18px;
103     font-weight: bold;
104     color: #A1283B;
105     background-color: transparent;
106     border-left: 2px solid #A1283B;
107 }
108
109 /* Nav: second level (shown on .active) */
110 .bs-docs-sidebar .nav .nav {
111     display: none; /* Hide by default, but at >768px, show it */
112     padding-bottom: 10px;
113 }
114 .bs-docs-sidebar .nav .nav > li > a {
115     padding-top: 1px;
116     padding-bottom: 1px;
117     padding-left: 30px;
118     font-size: 12px;
119     font-weight: normal;
120 }
121 .bs-docs-sidebar .nav .nav > li > a:hover,
122 .bs-docs-sidebar .nav .nav > li > a:focus {
123     padding-left: 29px;
124 }
125 .bs-docs-sidebar .nav .nav > .active > a,
126 .bs-docs-sidebar .nav .nav > .active:hover > a,
127 .bs-docs-sidebar .nav .nav > .active:focus > a {
128     padding-left: 28px;
129     font-weight: 500;
130 }
131
132 /* Nav: third level (shown on .active) */
133 .bs-docs-sidebar .nav .nav .nav {
134     padding-bottom: 10px;
135 }
136 .bs-docs-sidebar .nav .nav .nav > li > a {
137     padding-top: 1px;
138     padding-bottom: 1px;
139     padding-left: 40px;
140     font-size: 12px;
141     font-weight: normal;
142 }
143 .bs-docs-sidebar .nav .nav .nav > li > a:hover,
144 .bs-docs-sidebar .nav .nav .nav > li > a:focus {
145     padding-left: 39px;
146 }
147 .bs-docs-sidebar .nav .nav .nav > .active > a,
148 .bs-docs-sidebar .nav .nav .nav > .active:hover > a,
149 .bs-docs-sidebar .nav .nav .nav > .active:focus > a {
150     padding-left: 38px;
151     font-weight: 500;
152 }
153
154 /* Show and affix the side nav when space allows it */
155 @media (min-width: 992px) {
156     .bs-docs-sidebar .nav > .active > ul {
157         display: block;
158     }
159     /* Widen the fixed sidebar */
160     .bs-docs-sidebar.affix,
161     .bs-docs-sidebar.affix-bottom {
162         width: 213px;
163     }
164     .bs-docs-sidebar.affix {
165         position: fixed; /* Undo the static from mobile first approach */
166         top: 20px;
167     }
168     .bs-docs-sidebar.affix-bottom {
169         position: absolute; /* Undo the static from mobile first approach */
170     }
171     .bs-docs-sidebar.affix .bs-docs-sidenav,.bs-docs-sidebar.affix-bottom .bs-docs-sidenav {
172         margin-top: 0;
173         margin-bottom: 0
174     }
175 }
176 @media (min-width: 1200px) {
177     /* Widen the fixed sidebar again */
178     .bs-docs-sidebar.affix-bottom,
179     .bs-docs-sidebar.affix {
180         width: 263px;
181     }
182 }
183 </style>
184 <script type="text/javascript">
185 $(function() {
186     'use strict';
187
188     $('.bs-docs-sidebar li').first().addClass('active');
189
190     $(document.body).scrollspy({target: '.bs-docs-sidebar'});
191
192     $('.bs-docs-sidebar').affix();
193 });
194 </script>
195 </head>
196 <body>
197 <div id="content" class="container">
198 <div class="row"><div class="col-md-9"><h1 class="title">Sixth 3D - 3D engine</h1>
199 <hr >
200 <ul class="org-ul">
201 <li>This is a subproject of <a href="http://www2.svjatoslav.eu/gitbrowse/sixth/doc/index.html">Sixth</a>
202 </li>
203
204 <li><a href="http://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=snapshot;h=HEAD;sf=tgz">download latest snapshot</a>
205 </li>
206
207 <li>This program is free software; you can redistribute it and/or modify it under
208 the terms of version 3 of the <a href="https://www.gnu.org/licenses/lgpl.html">GNU Lesser General Public License</a> or later as
209 published by the Free Software Foundation.
210 </li>
211
212 <li>Program author:
213 <ul class="org-ul">
214 <li>Svjatoslav Agejenko
215 </li>
216 <li>Homepage: <a href="http://svjatoslav.eu">http://svjatoslav.eu</a>
217 </li>
218 <li>Email: <a href="mailto://svjatoslav@svjatoslav.eu">mailto://svjatoslav@svjatoslav.eu</a>
219 </li>
220 </ul>
221 </li>
222
223 <li><a href="http://www.svjatoslav.eu/programs.jsp">other applications hosted at svjatoslav.eu</a>
224 </li>
225 </ul>
226
227 <div id="outline-container-sec-1" class="outline-2">
228 <h2 id="sec-1"><span class="section-number-2">1</span> Project description</h2>
229 <div class="outline-text-2" id="text-1">
230 <ul class="org-ul">
231 <li>See: <a href="http://www2.svjatoslav.eu/gitbrowse/sixth-3d-demos/doc/index.html">demos of current 3D engine capabilities</a>
232 </li>
233 </ul>
234
235 <p>
236 <a href="#sec-1-1">In software</a>, <a href="#sec-1-2">pure Java</a> realtime 3D rendering engine. With the final
237 goal of becoming a platform for buildng 3D user interfaces and
238 interactive data visualization for <a href="http://www2.svjatoslav.eu/gitbrowse/sixth/doc/index.html">project Sixth</a>.
239 </p>
240
241 <p>
242 Sixth 3D can be also used as standalone <a href="#sec-3">3D engine in your project</a>.
243 </p>
244 </div>
245
246 <div id="outline-container-sec-1-1" class="outline-3">
247 <h3 id="sec-1-1"><a id="ID-d03013e5-931b-40ca-bc4b-e4b3f23b9a4e" name="ID-d03013e5-931b-40ca-bc4b-e4b3f23b9a4e"></a><span class="section-number-3">1.1</span> Justification for software rendering</h3>
248 <div class="outline-text-3" id="text-1-1">
249 <p>
250 3D rendering is done in software, 100% pure Java on CPU. At least for
251 now. Modern CPU cores count keeps growing and therefore rendering by
252 CPU is not as expensive as it used to be for the old single core
253 systems.
254 </p>
255
256 <p>
257 CPU rendering performance is already good enough to implement usable
258 3D UI at sufficient detail level, resolution and frame rate.
259 </p>
260
261 <p>
262 Also CPU rendering allows to freely test different rendering and
263 optimization algorithms and retains complete control of every rendered
264 pixel.
265 </p>
266 </div>
267 </div>
268 <div id="outline-container-sec-1-2" class="outline-3">
269 <h3 id="sec-1-2"><a id="ID-a11f7150-1b25-4ca4-a3c3-8c8bd1352bd4" name="ID-a11f7150-1b25-4ca4-a3c3-8c8bd1352bd4"></a><span class="section-number-3">1.2</span> Justification for Java</h3>
270 <div class="outline-text-3" id="text-1-2">
271 <ul class="org-ul">
272 <li>It is easy to refactor and experiment with.
273 </li>
274
275 <li>Easy portability and installation. No need to deal with platform
276 specific dependencies.
277 </li>
278
279 <li>It scales well to handle great complexity.
280 <ul class="org-ul">
281 <li>Allows to implement clever performance optimizations (instead of
282 going for GPU offered brute-force rendering approach).
283 </li>
284 </ul>
285 </li>
286
287 <li>No limitations imposed by:
288 <ul class="org-ul">
289 <li>requirement for decent GPU
290 </li>
291 <li>GPU missing features
292 </li>
293 <li>GPU missing/incomplete/buggy drivers
294 </li>
295 <li>OpenGL specification
296 </li>
297 </ul>
298 </li>
299
300 <li>It is fast enough thanks to:
301 <ul class="org-ul">
302 <li>Java virtual machine just-in-time compiler.
303 </li>
304 <li>Growing CPU cores count.
305 </li>
306 </ul>
307 </li>
308
309 <li>As a result it is easy to run on various hardware platforms and
310 operating systems.
311 </li>
312 </ul>
313 </div>
314 </div>
315 </div>
316
317 <div id="outline-container-sec-2" class="outline-2">
318 <h2 id="sec-2"><span class="section-number-2">2</span> <span class="label label-primary TODO">TODO</span> API documentation</h2>
319 <div class="outline-text-2" id="text-2">
320 <p>
321 Documentation currently missing for the lack of time.
322 </p>
323
324 <p>
325 So far best resource is to download and explore source code for:
326 </p>
327 <ul class="org-ul">
328 <li>3D engine (<a href="http://www3.svjatoslav.eu/projects/sixth-3d/graphs/">generated code graphs</a> (generated using <a href="http://www3.svjatoslav.eu/projects/javainspect/">JavaInspect</a>))
329 </li>
330 <li>For API usage examples, see <a href="http://www2.svjatoslav.eu/gitbrowse/sixth-3d-demos/doc/index.html">demos</a>.
331 </li>
332 </ul>
333 </div>
334 </div>
335 <div id="outline-container-sec-3" class="outline-2">
336 <h2 id="sec-3"><a id="ID-08f71987-90af-40dc-bb65-bac87db9e652" name="ID-08f71987-90af-40dc-bb65-bac87db9e652"></a><span class="section-number-2">3</span> Instructions to embed Sixth-3D in your project</h2>
337 <div class="outline-text-2" id="text-3">
338 <p>
339 Maven *pom.xml* file snippet:
340 </p>
341 <div class="org-src-container">
342
343 <pre class="src src-xml">&lt;<span style="color: #A6E22E;">dependencies</span>&gt;
344     ...
345     &lt;<span style="color: #A6E22E;">dependency</span>&gt;
346         &lt;<span style="color: #A6E22E;">groupId</span>&gt;eu.svjatoslav&lt;/<span style="color: #A6E22E;">groupId</span>&gt;
347         &lt;<span style="color: #A6E22E;">artifactId</span>&gt;sixth-3d&lt;/<span style="color: #A6E22E;">artifactId</span>&gt;
348         &lt;<span style="color: #A6E22E;">version</span>&gt;1.1&lt;/<span style="color: #A6E22E;">version</span>&gt;
349     &lt;/<span style="color: #A6E22E;">dependency</span>&gt;
350     ...
351 &lt;/<span style="color: #A6E22E;">dependencies</span>&gt;
352
353 &lt;<span style="color: #A6E22E;">repositories</span>&gt;
354     ...
355     &lt;<span style="color: #A6E22E;">repository</span>&gt;
356         &lt;<span style="color: #A6E22E;">id</span>&gt;svjatoslav.eu&lt;/<span style="color: #A6E22E;">id</span>&gt;
357         &lt;<span style="color: #A6E22E;">name</span>&gt;Svjatoslav repository&lt;/<span style="color: #A6E22E;">name</span>&gt;
358         &lt;<span style="color: #A6E22E;">url</span>&gt;http://www2.svjatoslav.eu/maven/&lt;/<span style="color: #A6E22E;">url</span>&gt;
359     &lt;/<span style="color: #A6E22E;">repository</span>&gt;
360     ...
361 &lt;/<span style="color: #A6E22E;">repositories</span>&gt;
362 </pre>
363 </div>
364
365 <p>
366 For API usage examples, see <a href="http://www2.svjatoslav.eu/gitbrowse/sixth-3d-demos/doc/index.html">demos</a>.
367 </p>
368 </div>
369 </div>
370 <div id="outline-container-sec-4" class="outline-2">
371 <h2 id="sec-4"><span class="section-number-2">4</span> <span class="label label-primary TODO">TODO</span> features to add</h2>
372 <div class="outline-text-2" id="text-4">
373 <ul class="org-ul">
374 <li>Partial region/frame repaint: when only one small object changed on
375 the scene, it would be faster to re-render that specific area.
376 </li>
377
378 <li>Once partial rendering works, in would be easy to add multi-core
379 rendering support. So that each core renders it's own region of the
380 screen.
381 </li>
382
383 <li>Antialiazing. Would improve text readability. If antialiazing is too
384 expensive for every frame, it could be used only for last frame
385 before animations become still and waiting for user input starts.
386 </li>
387
388 <li>Render only visible polygons.
389 <ul class="org-ul">
390 <li>This would significantly reduce RAM &lt;-&gt; CPU traffic.
391 </li>
392
393 <li>General algorithm description:
394 <ul class="org-ul">
395 <li>For each horizontal scanline:
396 <ul class="org-ul">
397 <li>sort polygon edges from left to right
398 </li>
399 <li>while iterating and drawing pixels over screen X axis (left to
400 right) track next appearing/disappearing polygons.
401 <ul class="org-ul">
402 <li>For each polygon edge update Z sorted active polygons list.
403 </li>
404 <li>Only draw pixel from the top-most polygon.
405 <ul class="org-ul">
406 <li>Only if polygon area is transparent/half-transparent add
407 colors from the polygons below.
408 </li>
409 </ul>
410 </li>
411 </ul>
412 </li>
413 </ul>
414 </li>
415 </ul>
416 </li>
417
418 <li>As a bonus, this would allow to track which polygons are really
419 visible in the final scene for each frame.
420
421 <ul class="org-ul">
422 <li>Such information allows further optimizations:
423
424 <ul class="org-ul">
425 <li>Dynamic geometry simplification:
426 <ul class="org-ul">
427 <li>Dynamically detect and replace invisible objects from the
428 scene with simplified bounding box.
429 </li>
430
431 <li>Dynamically replace boudnig box with actual object once it
432 becomes visible.
433 </li>
434 </ul>
435 </li>
436
437 <li>Dynamically unload unused textures from RAM.
438 </li>
439 </ul>
440 </li>
441 </ul>
442 </li>
443 </ul>
444 </li>
445 </ul>
446 </div>
447 </div>
448 </div><div class="col-md-3"><nav id="table-of-contents">
449 <div id="text-table-of-contents" class="bs-docs-sidebar">
450 <ul class="nav">
451 <li><a href="#sec-1">1. Project description</a>
452 <ul class="nav">
453 <li><a href="#sec-1-1">1.1. Justification for software rendering</a></li>
454 <li><a href="#sec-1-2">1.2. Justification for Java</a></li>
455 </ul>
456 </li>
457 <li><a href="#sec-2">2. API documentation</a></li>
458 <li><a href="#sec-3">3. Instructions to embed Sixth-3D in your project</a></li>
459 <li><a href="#sec-4">4. features to add</a></li>
460 </ul>
461 </div>
462 </nav>
463 </div></div></div>
464 <footer id="postamble" class="">
465 <div><p class="author">Author: Svjatoslav Agejenko</p>
466 <p class="date">Created: 2018-01-04 Thu 00:12</p>
467 <p class="creator"><a href="http://www.gnu.org/software/emacs/">Emacs</a> 25.1.1 (<a href="http://orgmode.org">Org-mode</a> 8.2.10)</p>
468 </div>
469 </footer>
470 </body>
471 </html>