<html lang="en">
<head>
<title>Sixth 3D - 3D engine</title>
-<!-- 2017-03-06 Mon 10:18 -->
+<!-- 2017-06-13 Tue 08:56 -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="Org-mode">
<h2 id="sec-1"><span class="section-number-2">1</span> Project description</h2>
<div class="outline-text-2" id="text-1">
<p>
-In software, pure Java realtime 3D rendering engine. With the final goal of
-becoming a platform for buildng 3D user interfaces.
+In-software, pure Java realtime 3D rendering engine. With the final
+goal of becoming a platform for buildng 3D user interfaces and
+interactive data visualization.
</p>
<ul class="org-ul">
System is implemented in Java because:
</p>
<ul class="org-ul">
+<li>It is easy to refactor and experiment with.
+</li>
+
<li>It scales well to handle great complexity.
+<ul class="org-ul">
+<li>Allows to implement clever performance optimizations (instead of
+going for GPU offered brute-force rendering approach).
</li>
-<li>It is easy to refactor and experiment with.
+</ul>
+</li>
+
+<li>No limitations imposed by:
+<ul class="org-ul">
+<li>requirement for decent GPU
+</li>
+<li>GPU missing features
</li>
-<li>It is fast enough thanks to Java virtual machine just-in-time compiler.
+<li>GPU missing/incomplete/buggy drivers
+</li>
+<li>OpenGL specification
+</li>
+</ul>
+</li>
+
+<li>It is fast enough thanks to:
+<ul class="org-ul">
+<li>Java virtual machine just-in-time compiler.
+</li>
+<li>Growing CPU cores count.
+</li>
+</ul>
</li>
-<li>Easy to run on various hardware platforms and operating systems.
+
+<li>As a result it is easy to run on various hardware platforms and
+operating systems.
</li>
</ul>
<p>
-3D rendering is done in software, 100% pure Java on CPU. At least for now.
-Modern CPU cores count keeps growing and therefore rendering by CPU is not as
-expensive as it used to be for the old single core systems.
+3D rendering is done in software, 100% pure Java on CPU. At least for
+now. Modern CPU cores count keeps growing and therefore rendering by
+CPU is not as expensive as it used to be for the old single core
+systems.
</p>
<p>
-CPU rendering performance is already good enough to implement usable 3D UI at
-sufficient detail level, resolution and frame rate.
+CPU rendering performance is already good enough to implement usable
+3D UI at sufficient detail level, resolution and frame rate.
</p>
<p>
-Pure Java also means easy portability and installation. No need to deal with
-platform specific dependencies.
+Pure Java also means easy portability and installation. No need to
+deal with platform specific dependencies.
</p>
<p>
-Also CPU rendering allows to easily test different rendering algorithms and
-retains complete control of every rendered pixel.
+Also CPU rendering allows to easily test different rendering
+algorithms and retains complete control of every rendered pixel.
</p>
</div>
</div>
+
<div id="outline-container-sec-2" class="outline-2">
-<h2 id="sec-2"><span class="section-number-2">2</span> Software development</h2>
+<h2 id="sec-2"><span class="section-number-2">2</span> Instructions to embed Sixth-3D in your project</h2>
<div class="outline-text-2" id="text-2">
-</div><div id="outline-container-sec-2-1" class="outline-3">
-<h3 id="sec-2-1"><span class="section-number-3">2.1</span> <span class="label label-primary TODO">TODO</span> </h3>
-<div class="outline-text-3" id="text-2-1">
-<ul class="org-ul">
-<li>partial (region) frame repaint
-</li>
-<li>antialiazing
-</li>
-</ul>
-</div>
-</div>
-<div id="outline-container-sec-2-2" class="outline-3">
-<h3 id="sec-2-2"><span class="section-number-3">2.2</span> Instructions to embed Sixth-3D in your project</h3>
-<div class="outline-text-3" id="text-2-2">
<p>
Maven *pom.xml* file snippet:
</p>
</p>
</div>
</div>
+<div id="outline-container-sec-3" class="outline-2">
+<h2 id="sec-3"><span class="section-number-2">3</span> <span class="label label-primary TODO">TODO</span> features to add</h2>
+<div class="outline-text-2" id="text-3">
+<ul class="org-ul">
+<li>Partial region/frame repaint: when only one small object changed on
+the scene, it would be faster to re-render that specific area.
+</li>
+
+<li>Once partial rendering works, in would be easy to add multi-core
+rendering support. So that each core renders it's own region of the
+screen.
+</li>
+
+<li>Antialiazing. Would improve text readability. If antialiazing is too
+expensive for every frame, it could be used only for last frame
+before animations become still and waiting for user input starts.
+</li>
+
+<li>Render only visible polygons.
+<ul class="org-ul">
+<li>This would significantly reduce RAM <-> CPU traffic.
+</li>
+
+<li>General algorithm description:
+<ul class="org-ul">
+<li>For each horizontal scanline:
+<ul class="org-ul">
+<li>sort polygon edges from left to right
+</li>
+<li>while iterating and drawing pixels over screen X axis (left to
+right) track next appearing/disappearing polygons.
+<ul class="org-ul">
+<li>For each polygon edge update Z sorted active polygons list.
+</li>
+<li>Only draw pixel from the top-most polygon.
+<ul class="org-ul">
+<li>Only if polygon area is transparent/half-transparent add
+colors from the polygons below.
+</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+
+<li>As a bonus, this would allow to track which polygons are really
+visible in the final scene for each frame.
+
+<ul class="org-ul">
+<li>Such information allows further optimizations:
+
+<ul class="org-ul">
+<li>Dynamic geometry simplification:
+<ul class="org-ul">
+<li>Dynamically detect and replace invisible objects from the
+scene with simplified bounding box.
+</li>
+
+<li>Dynamically replace boudnig box with actual object once it
+becomes visible.
+</li>
+</ul>
+</li>
+
+<li>Dynamically unload unused textures from RAM.
+</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</div>
</div>
</div><div class="col-md-3"><nav id="table-of-contents">
<div id="text-table-of-contents" class="bs-docs-sidebar">
<ul class="nav">
<li><a href="#sec-1">1. Project description</a></li>
-<li><a href="#sec-2">2. Software development</a>
-<ul class="nav">
-<li><a href="#sec-2-1">2.1. </a></li>
-<li><a href="#sec-2-2">2.2. Instructions to embed Sixth-3D in your project</a></li>
-</ul>
-</li>
+<li><a href="#sec-2">2. Instructions to embed Sixth-3D in your project</a></li>
+<li><a href="#sec-3">3. features to add</a></li>
</ul>
</div>
</nav>
</div></div></div>
<footer id="postamble" class="">
<div><p class="author">Author: Svjatoslav Agejenko</p>
-<p class="date">Created: 2017-03-06 Mon 10:18</p>
-<p class="creator"><a href="http://www.gnu.org/software/emacs/">Emacs</a> 24.4.1 (<a href="http://orgmode.org">Org-mode</a> 8.2.10)</p>
+<p class="date">Created: 2017-06-13 Tue 08:56</p>
+<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>
</div>
</footer>
</body>
#+HTML_HEAD: </style>
* Project description
-In software, pure Java realtime 3D rendering engine. With the final goal of
-becoming a platform for buildng 3D user interfaces.
+In-software, pure Java realtime 3D rendering engine. With the final
+goal of becoming a platform for buildng 3D user interfaces and
+interactive data visualization.
+ See: [[http://www2.svjatoslav.eu/gitbrowse/sixth-3d-demos/doc/index.html][demos of current 3D engine capabilities]]
System is implemented in Java because:
-- It scales well to handle great complexity.
- It is easy to refactor and experiment with.
-- It is fast enough thanks to Java virtual machine just-in-time compiler.
-- Easy to run on various hardware platforms and operating systems.
-3D rendering is done in software, 100% pure Java on CPU. At least for now.
-Modern CPU cores count keeps growing and therefore rendering by CPU is not as
-expensive as it used to be for the old single core systems.
+- It scales well to handle great complexity.
+ - Allows to implement clever performance optimizations (instead of
+ going for GPU offered brute-force rendering approach).
+
+- No limitations imposed by:
+ - requirement for decent GPU
+ - GPU missing features
+ - GPU missing/incomplete/buggy drivers
+ - OpenGL specification
+
+- It is fast enough thanks to:
+ - Java virtual machine just-in-time compiler.
+ - Growing CPU cores count.
-CPU rendering performance is already good enough to implement usable 3D UI at
-sufficient detail level, resolution and frame rate.
+- As a result it is easy to run on various hardware platforms and
+ operating systems.
-Pure Java also means easy portability and installation. No need to deal with
-platform specific dependencies.
+3D rendering is done in software, 100% pure Java on CPU. At least for
+now. Modern CPU cores count keeps growing and therefore rendering by
+CPU is not as expensive as it used to be for the old single core
+systems.
-Also CPU rendering allows to easily test different rendering algorithms and
-retains complete control of every rendered pixel.
+CPU rendering performance is already good enough to implement usable
+3D UI at sufficient detail level, resolution and frame rate.
-* Software development
-** TODO
-+ partial (region) frame repaint
-+ antialiazing
-** Instructions to embed Sixth-3D in your project
+Pure Java also means easy portability and installation. No need to
+deal with platform specific dependencies.
+
+Also CPU rendering allows to easily test different rendering
+algorithms and retains complete control of every rendered pixel.
+
+
+* Instructions to embed Sixth-3D in your project
Maven *pom.xml* file snippet:
#+BEGIN_SRC xml
<dependencies>
#+END_SRC
See [[file:codeGraph/index.html][generated code graph]] using [[http://www2.svjatoslav.eu/gitbrowse/javainspect/doc/index.html][this tool]].
+* TODO features to add
++ Partial region/frame repaint: when only one small object changed on
+ the scene, it would be faster to re-render that specific area.
+
++ Once partial rendering works, in would be easy to add multi-core
+ rendering support. So that each core renders it's own region of the
+ screen.
+
++ Antialiazing. Would improve text readability. If antialiazing is too
+ expensive for every frame, it could be used only for last frame
+ before animations become still and waiting for user input starts.
+
++ Render only visible polygons.
+ + This would significantly reduce RAM <-> CPU traffic.
+
+ + General algorithm description:
+ + For each horizontal scanline:
+ + sort polygon edges from left to right
+ + while iterating and drawing pixels over screen X axis (left to
+ right) track next appearing/disappearing polygons.
+ + For each polygon edge update Z sorted active polygons list.
+ + Only draw pixel from the top-most polygon.
+ + Only if polygon area is transparent/half-transparent add
+ colors from the polygons below.
+
+ + As a bonus, this would allow to track which polygons are really
+ visible in the final scene for each frame.
+
+ + Such information allows further optimizations:
+
+ + Dynamic geometry simplification:
+ + Dynamically detect and replace invisible objects from the
+ scene with simplified bounding box.
+
+ + Dynamically replace boudnig box with actual object once it
+ becomes visible.
+
+ + Dynamically unload unused textures from RAM.