e266b8684a65656d1896fe74fbf67505bf97ab5e
[sixth-3d.git] / doc / index.html
1 <!doctype html>
2 <html lang="en">
3 <head>
4 <title>Sixth 3D - 3D engine</title>
5 <!-- 2019-01-19 Sat 01:46 -->
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/3/darkly/bootstrap.min.css" rel="stylesheet">
11 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
12 <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/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
200 <div id="outline-container-sec-1" class="outline-2">
201 <h2 id="sec-1"><span class="section-number-2">1</span> General</h2>
202 <div class="outline-text-2" id="text-1">
203 <ul class="org-ul">
204 <li>This is a subproject of <a href="https://www3.svjatoslav.eu/projects/sixth/">Sixth</a>
205 </li>
206
207 <li>This program is free software: you can redistribute it and/or modify
208 it under the terms of the <a href="https://www.gnu.org/licenses/lgpl.html">GNU Lesser General Public License</a> as
209 published by the Free Software Foundation, either version 3 of the
210 License, or (at your option) any later version.
211 </li>
212
213 <li>Program author:
214 <ul class="org-ul">
215 <li>Svjatoslav Agejenko
216 </li>
217 <li>Homepage: <a href="https://svjatoslav.eu">https://svjatoslav.eu</a>
218 </li>
219 <li>Email: <a href="mailto://svjatoslav@svjatoslav.eu">mailto://svjatoslav@svjatoslav.eu</a>
220 </li>
221 </ul>
222 </li>
223
224 <li><a href="https://www.svjatoslav.eu/projects/">Other software projects hosted at svjatoslav.eu</a>
225 </li>
226 </ul>
227 </div>
228
229 <div id="outline-container-sec-1-1" class="outline-3">
230 <h3 id="sec-1-1"><span class="section-number-3">1.1</span> Source code</h3>
231 <div class="outline-text-3" id="text-1-1">
232 <ul class="org-ul">
233 <li><a href="https://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=snapshot;h=HEAD;sf=tgz">Download latest snapshot in TAR GZ format</a>
234 </li>
235
236 <li><a href="https://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=summary">Browse Git repository online</a>
237 </li>
238
239 <li>Clone Git repository using command:
240 <pre class="example">
241 git clone https://www2.svjatoslav.eu/git/sixth-3d.git
242
243 </pre>
244 </li>
245
246 <li>See <a href="https://www3.svjatoslav.eu/projects/sixth-3d/apidocs/">JavaDoc</a>.
247 </li>
248 </ul>
249 </div>
250 </div>
251 </div>
252
253 <div id="outline-container-sec-2" class="outline-2">
254 <h2 id="sec-2"><span class="section-number-2">2</span> Project description</h2>
255 <div class="outline-text-2" id="text-2">
256 <ul class="org-ul">
257 <li>See: <a href="https://www3.svjatoslav.eu/projects/sixth-3d-demos/">demos of current 3D engine capabilities</a>
258 </li>
259 </ul>
260
261 <p>
262 <a href="#sec-2-1">In software</a>, <a href="#sec-2-2">pure Java</a> realtime 3D rendering engine. With the final
263 goal of becoming a platform for buildng 3D user interfaces and
264 interactive data visualization for <a href="https://www3.svjatoslav.eu/projects/sixth/">project Sixth</a>.
265 </p>
266
267 <p>
268 Sixth 3D can be also used as standalone <a href="#sec-4">3D engine in your project</a>.
269 </p>
270 </div>
271
272 <div id="outline-container-sec-2-1" class="outline-3">
273 <h3 id="sec-2-1"><a id="ID-d03013e5-931b-40ca-bc4b-e4b3f23b9a4e" name="ID-d03013e5-931b-40ca-bc4b-e4b3f23b9a4e"></a><span class="section-number-3">2.1</span> Justification for software rendering</h3>
274 <div class="outline-text-3" id="text-2-1">
275 <p>
276 3D rendering is done in software, 100% pure Java on CPU. At least for
277 now. Modern CPU cores count keeps growing and therefore rendering by
278 CPU is not as expensive as it used to be for the old single core
279 systems.
280 </p>
281
282 <p>
283 CPU rendering performance is already good enough to implement usable
284 3D UI at sufficient detail level, resolution and frame rate.
285 </p>
286
287 <p>
288 Also CPU rendering allows to freely test different rendering and
289 optimization algorithms and retains complete control of every rendered
290 pixel.
291 </p>
292 </div>
293 </div>
294 <div id="outline-container-sec-2-2" class="outline-3">
295 <h3 id="sec-2-2"><a id="ID-a11f7150-1b25-4ca4-a3c3-8c8bd1352bd4" name="ID-a11f7150-1b25-4ca4-a3c3-8c8bd1352bd4"></a><span class="section-number-3">2.2</span> Justification for Java</h3>
296 <div class="outline-text-3" id="text-2-2">
297 <ul class="org-ul">
298 <li>It is easy to refactor and experiment with.
299 </li>
300
301 <li>Easy portability and installation. No need to deal with platform
302 specific dependencies.
303 </li>
304
305 <li>It scales well to handle great complexity.
306 <ul class="org-ul">
307 <li>Allows to implement clever performance optimizations (instead of
308 going for GPU offered brute-force rendering approach).
309 </li>
310 </ul>
311 </li>
312
313 <li>No limitations imposed by:
314 <ul class="org-ul">
315 <li>requirement for decent GPU
316 </li>
317 <li>GPU missing features
318 </li>
319 <li>GPU missing/incomplete/buggy drivers
320 </li>
321 <li>OpenGL specification
322 </li>
323 </ul>
324 </li>
325
326 <li>It is fast enough thanks to:
327 <ul class="org-ul">
328 <li>Java virtual machine just-in-time compiler.
329 </li>
330 <li>Growing CPU cores count.
331 </li>
332 </ul>
333 </li>
334
335 <li>As a result it is easy to run on various hardware platforms and
336 operating systems.
337 </li>
338 </ul>
339 </div>
340 </div>
341 </div>
342
343 <div id="outline-container-sec-3" class="outline-2">
344 <h2 id="sec-3"><span class="section-number-2">3</span> API documentation</h2>
345 <div class="outline-text-2" id="text-3">
346 <ul class="org-ul">
347 <li>See <a href="https://www3.svjatoslav.eu/projects/sixth-3d/apidocs/">JavaDoc</a>.
348 </li>
349 </ul>
350
351 <p>
352 Note: due to a lack of time, there is still big room for improvement
353 on documentation.
354 </p>
355
356 <p>
357 So far best resource is to download and explore source code for:
358 </p>
359 <ul class="org-ul">
360 <li>3D engine (<a href="https://www3.svjatoslav.eu/projects/sixth-3d/graphs/">generated code graphs</a> (generated using <a href="https://www3.svjatoslav.eu/projects/javainspect/">JavaInspect</a>))
361 </li>
362 <li>For API usage examples, see <a href="https://www3.svjatoslav.eu/projects/sixth-3d-demos/">demos</a>
363 </li>
364 </ul>
365 </div>
366 </div>
367 <div id="outline-container-sec-4" class="outline-2">
368 <h2 id="sec-4"><a id="ID-08f71987-90af-40dc-bb65-bac87db9e652" name="ID-08f71987-90af-40dc-bb65-bac87db9e652"></a><span class="section-number-2">4</span> Instructions to embed Sixth-3D in your project</h2>
369 <div class="outline-text-2" id="text-4">
370 <p>
371 Maven *pom.xml* file snippet:
372 </p>
373 <div class="org-src-container">
374
375 <pre class="src src-xml">&lt;dependencies&gt;
376     ...
377     &lt;dependency&gt;
378         &lt;groupId&gt;eu.svjatoslav&lt;/groupId&gt;
379         &lt;artifactId&gt;sixth-3d&lt;/artifactId&gt;
380         &lt;version&gt;1.1&lt;/version&gt;
381     &lt;/dependency&gt;
382     ...
383 &lt;/dependencies&gt;
384
385 &lt;repositories&gt;
386     ...
387     &lt;repository&gt;
388         &lt;id&gt;svjatoslav.eu&lt;/id&gt;
389         &lt;name&gt;Svjatoslav repository&lt;/name&gt;
390         &lt;url&gt;http://www2.svjatoslav.eu/maven/&lt;/url&gt;
391     &lt;/repository&gt;
392     ...
393 &lt;/repositories&gt;
394 </pre>
395 </div>
396
397 <p>
398 For API usage examples, see <a href="https://www3.svjatoslav.eu/projects/sixth-3d-demos/">demos</a>.
399 </p>
400 </div>
401 </div>
402 <div id="outline-container-sec-5" class="outline-2">
403 <h2 id="sec-5"><span class="section-number-2">5</span> <span class="label label-primary TODO">TODO</span> features to add</h2>
404 <div class="outline-text-2" id="text-5">
405 <ul class="org-ul">
406 <li>Partial region/frame repaint: when only one small object changed on
407 the scene, it would be faster to re-render that specific area.
408 </li>
409
410 <li>Once partial rendering works, in would be easy to add multi-core
411 rendering support. So that each core renders it's own region of the
412 screen.
413 </li>
414
415 <li>Antialiazing. Would improve text readability. If antialiazing is too
416 expensive for every frame, it could be used only for last frame
417 before animations become still and waiting for user input starts.
418 </li>
419
420 <li>Render only visible polygons.
421 <ul class="org-ul">
422 <li>This would significantly reduce RAM &lt;-&gt; CPU traffic.
423 </li>
424
425 <li>General algorithm description:
426 <ul class="org-ul">
427 <li>For each horizontal scanline:
428 <ul class="org-ul">
429 <li>sort polygon edges from left to right
430 </li>
431 <li>while iterating and drawing pixels over screen X axis (left to
432 right) track next appearing/disappearing polygons.
433 <ul class="org-ul">
434 <li>For each polygon edge update Z sorted active polygons list.
435 </li>
436 <li>Only draw pixel from the top-most polygon.
437 <ul class="org-ul">
438 <li>Only if polygon area is transparent/half-transparent add
439 colors from the polygons below.
440 </li>
441 </ul>
442 </li>
443 </ul>
444 </li>
445 </ul>
446 </li>
447 </ul>
448 </li>
449
450 <li>As a bonus, this would allow to track which polygons are really
451 visible in the final scene for each frame.
452
453 <ul class="org-ul">
454 <li>Such information allows further optimizations:
455
456 <ul class="org-ul">
457 <li>Dynamic geometry simplification:
458 <ul class="org-ul">
459 <li>Dynamically detect and replace invisible objects from the
460 scene with simplified bounding box.
461 </li>
462
463 <li>Dynamically replace boudnig box with actual object once it
464 becomes visible.
465 </li>
466 </ul>
467 </li>
468
469 <li>Dynamically unload unused textures from RAM.
470 </li>
471 </ul>
472 </li>
473 </ul>
474 </li>
475 </ul>
476 </li>
477 </ul>
478 </div>
479 </div>
480 </div><div class="col-md-3"><nav id="table-of-contents">
481 <div id="text-table-of-contents" class="bs-docs-sidebar">
482 <ul class="nav">
483 <li><a href="#sec-1">1. General</a>
484 <ul class="nav">
485 <li><a href="#sec-1-1">1.1. Source code</a></li>
486 </ul>
487 </li>
488 <li><a href="#sec-2">2. Project description</a>
489 <ul class="nav">
490 <li><a href="#sec-2-1">2.1. Justification for software rendering</a></li>
491 <li><a href="#sec-2-2">2.2. Justification for Java</a></li>
492 </ul>
493 </li>
494 <li><a href="#sec-3">3. API documentation</a></li>
495 <li><a href="#sec-4">4. Instructions to embed Sixth-3D in your project</a></li>
496 <li><a href="#sec-5">5. features to add</a></li>
497 </ul>
498 </div>
499 </nav>
500 </div></div></div>
501 <footer id="postamble" class="">
502 <div><p class="author">Author: Svjatoslav Agejenko</p>
503 <p class="date">Created: 2019-01-19 Sat 01:46</p>
504 <p class="creator"><a href="http://www.gnu.org/software/emacs/">Emacs</a> 26.1 (<a href="http://orgmode.org">Org-mode</a> 9.1.9)</p>
505 </div>
506 </footer>
507 </body>
508 </html>