1 #+TITLE: Sixth 3D - 3D engine
3 * (document settings) :noexport:
4 ** use dark style for TWBS-HTML exporter
5 #+HTML_HEAD: <link href="https://bootswatch.com/3/darkly/bootstrap.min.css" rel="stylesheet">
6 #+HTML_HEAD: <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
7 #+HTML_HEAD: <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js"></script>
8 #+HTML_HEAD: <style type="text/css">
9 #+HTML_HEAD: footer {background-color: #111 !important;}
10 #+HTML_HEAD: pre {background-color: #111; color: #ccc;}
14 - This program is free software: released under Creative Commons Zero
19 - Homepage: https://svjatoslav.eu
20 - Email: mailto://svjatoslav@svjatoslav.eu
22 - [[https://www.svjatoslav.eu/projects/][Other software projects hosted at svjatoslav.eu]]
25 - [[https://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=snapshot;h=HEAD;sf=tgz][Download latest snapshot in TAR GZ format]]
27 - [[https://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=summary][Browse Git repository online]]
29 - Clone Git repository using command:
30 : git clone https://www3.svjatoslav.eu/git/sixth-3d.git
32 - See [[https://www3.svjatoslav.eu/projects/sixth-3d/apidocs/][JavaDoc]].
35 + See: [[https://www3.svjatoslav.eu/projects/sixth-3d-demos/][demos of current 3D engine capabilities]]
37 [[id:d03013e5-931b-40ca-bc4b-e4b3f23b9a4e][In software]], [[id:a11f7150-1b25-4ca4-a3c3-8c8bd1352bd4][pure Java]] realtime 3D rendering engine. With the final
38 goal of becoming a platform for buildng 3D user interfaces and
39 interactive data visualization for [[https://www3.svjatoslav.eu/projects/sixth/][project Sixth]].
41 Sixth 3D can be also used as standalone [[id:08f71987-90af-40dc-bb65-bac87db9e652][3D engine in your project]].
43 ** Justification for software rendering
45 :ID: d03013e5-931b-40ca-bc4b-e4b3f23b9a4e
47 3D rendering is done in software, 100% pure Java on CPU. At least for
48 now. Modern CPU cores count keeps growing and therefore rendering by
49 CPU is not as expensive as it used to be for the old single core
52 CPU rendering performance is already good enough to implement usable
53 3D UI at sufficient detail level, resolution and frame rate.
55 Also CPU rendering allows to freely test different rendering and
56 optimization algorithms and retains complete control of every rendered
58 ** Justification for Java
60 :ID: a11f7150-1b25-4ca4-a3c3-8c8bd1352bd4
62 - It is easy to refactor and experiment with.
64 - Easy portability and installation. No need to deal with platform
65 specific dependencies.
67 - It scales well to handle great complexity.
68 - Allows to implement clever performance optimizations (instead of
69 going for GPU offered brute-force rendering approach).
71 - No limitations imposed by:
72 - requirement for decent GPU
73 - GPU missing features
74 - GPU missing/incomplete/buggy drivers
75 - OpenGL specification
77 - It is fast enough thanks to:
78 - Java virtual machine just-in-time compiler.
79 - Growing CPU cores count.
81 - As a result it is easy to run on various hardware platforms and
85 - See [[https://www3.svjatoslav.eu/projects/sixth-3d/apidocs/][JavaDoc]].
87 Note: due to a lack of time, there is still big room for improvement
90 So far best resource is to download and explore source code for:
91 + 3D engine ([[https://www3.svjatoslav.eu/projects/sixth-3d/graphs/][generated code graphs]] (generated using [[https://www3.svjatoslav.eu/projects/javainspect/][JavaInspect]]))
92 + For API usage examples, see [[https://www3.svjatoslav.eu/projects/sixth-3d-demos/][demos]]
93 * Instructions to embed Sixth-3D in your project
95 :ID: 08f71987-90af-40dc-bb65-bac87db9e652
97 Maven *pom.xml* file snippet:
102 <groupId>eu.svjatoslav</groupId>
103 <artifactId>sixth-3d</artifactId>
104 <version>1.2</version>
112 <id>svjatoslav.eu</id>
113 <name>Svjatoslav repository</name>
114 <url>http://www3.svjatoslav.eu/maven/</url>
120 For API usage examples, see [[https://www3.svjatoslav.eu/projects/sixth-3d-demos/][demos]].
121 * TODO features to add
122 + read this as example, and apply improvements/fixes where applicable:
123 http://blog.rogach.org/2015/08/how-to-create-your-own-simple-3d-render.html
125 + Improve triangulation. Read: https://ianthehenry.com/posts/delaunay/
127 + Partial region/frame repaint: when only one small object changed on
128 the scene, it would be faster to re-render that specific area.
130 + Once partial rendering works, in would be easy to add multi-core
131 rendering support. So that each core renders it's own region of the
134 + Antialiazing. Would improve text readability. If antialiazing is too
135 expensive for every frame, it could be used only for last frame
136 before animations become still and waiting for user input starts.
137 ** Render only visible polygons
138 + This would significantly reduce RAM <-> CPU traffic.
140 + General algorithm description:
141 + For each horizontal scanline:
142 + sort polygon edges from left to right
143 + while iterating and drawing pixels over screen X axis (left to
144 right) track next appearing/disappearing polygons.
145 + For each polygon edge update Z sorted active polygons list.
146 + Only draw pixel from the top-most polygon.
147 + Only if polygon area is transparent/half-transparent add
148 colors from the polygons below.
150 + As a bonus, this would allow to track which polygons are really
151 visible in the final scene for each frame.
153 + Such information allows further optimizations:
155 + Dynamic geometry simplification:
156 + Dynamically detect and replace invisible objects from the
157 scene with simplified bounding box.
159 + Dynamically replace boudnig box with actual object once it
162 + Dynamically unload unused textures from RAM.