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 is a subproject of parent project: [[https://www3.svjatoslav.eu/projects/sixth/][Sixth]].
16 - This program is free software: you can redistribute it and/or modify
17 it under the terms of the [[https://www.gnu.org/licenses/lgpl.html][GNU Lesser General Public License]] as
18 published by the Free Software Foundation, either version 3 of the
19 License, or (at your option) any later version.
23 - Homepage: https://svjatoslav.eu
24 - Email: mailto://svjatoslav@svjatoslav.eu
26 - [[https://www.svjatoslav.eu/projects/][Other software projects hosted at svjatoslav.eu]]
29 - [[https://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=snapshot;h=HEAD;sf=tgz][Download latest snapshot in TAR GZ format]]
31 - [[https://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=summary][Browse Git repository online]]
33 - Clone Git repository using command:
34 : git clone https://www2.svjatoslav.eu/git/sixth-3d.git
36 - See [[https://www3.svjatoslav.eu/projects/sixth-3d/apidocs/][JavaDoc]].
39 + See: [[https://www3.svjatoslav.eu/projects/sixth-3d-demos/][demos of current 3D engine capabilities]]
41 [[id:d03013e5-931b-40ca-bc4b-e4b3f23b9a4e][In software]], [[id:a11f7150-1b25-4ca4-a3c3-8c8bd1352bd4][pure Java]] realtime 3D rendering engine. With the final
42 goal of becoming a platform for buildng 3D user interfaces and
43 interactive data visualization for [[https://www3.svjatoslav.eu/projects/sixth/][project Sixth]].
45 Sixth 3D can be also used as standalone [[id:08f71987-90af-40dc-bb65-bac87db9e652][3D engine in your project]].
47 ** Justification for software rendering
49 :ID: d03013e5-931b-40ca-bc4b-e4b3f23b9a4e
51 3D rendering is done in software, 100% pure Java on CPU. At least for
52 now. Modern CPU cores count keeps growing and therefore rendering by
53 CPU is not as expensive as it used to be for the old single core
56 CPU rendering performance is already good enough to implement usable
57 3D UI at sufficient detail level, resolution and frame rate.
59 Also CPU rendering allows to freely test different rendering and
60 optimization algorithms and retains complete control of every rendered
62 ** Justification for Java
64 :ID: a11f7150-1b25-4ca4-a3c3-8c8bd1352bd4
66 - It is easy to refactor and experiment with.
68 - Easy portability and installation. No need to deal with platform
69 specific dependencies.
71 - It scales well to handle great complexity.
72 - Allows to implement clever performance optimizations (instead of
73 going for GPU offered brute-force rendering approach).
75 - No limitations imposed by:
76 - requirement for decent GPU
77 - GPU missing features
78 - GPU missing/incomplete/buggy drivers
79 - OpenGL specification
81 - It is fast enough thanks to:
82 - Java virtual machine just-in-time compiler.
83 - Growing CPU cores count.
85 - As a result it is easy to run on various hardware platforms and
89 - See [[https://www3.svjatoslav.eu/projects/sixth-3d/apidocs/][JavaDoc]].
91 Note: due to a lack of time, there is still big room for improvement
94 So far best resource is to download and explore source code for:
95 + 3D engine ([[https://www3.svjatoslav.eu/projects/sixth-3d/graphs/][generated code graphs]] (generated using [[https://www3.svjatoslav.eu/projects/javainspect/][JavaInspect]]))
96 + For API usage examples, see [[https://www3.svjatoslav.eu/projects/sixth-3d-demos/][demos]]
97 * Instructions to embed Sixth-3D in your project
99 :ID: 08f71987-90af-40dc-bb65-bac87db9e652
101 Maven *pom.xml* file snippet:
106 <groupId>eu.svjatoslav</groupId>
107 <artifactId>sixth-3d</artifactId>
108 <version>1.1</version>
116 <id>svjatoslav.eu</id>
117 <name>Svjatoslav repository</name>
118 <url>http://www2.svjatoslav.eu/maven/</url>
124 For API usage examples, see [[https://www3.svjatoslav.eu/projects/sixth-3d-demos/][demos]].
125 * TODO features to add
126 + read this as example, and apply improvements/fixes where applicable:
127 http://blog.rogach.org/2015/08/how-to-create-your-own-simple-3d-render.html
129 + Partial region/frame repaint: when only one small object changed on
130 the scene, it would be faster to re-render that specific area.
132 + Once partial rendering works, in would be easy to add multi-core
133 rendering support. So that each core renders it's own region of the
136 + Antialiazing. Would improve text readability. If antialiazing is too
137 expensive for every frame, it could be used only for last frame
138 before animations become still and waiting for user input starts.
139 ** Render only visible polygons
140 + This would significantly reduce RAM <-> CPU traffic.
142 + General algorithm description:
143 + For each horizontal scanline:
144 + sort polygon edges from left to right
145 + while iterating and drawing pixels over screen X axis (left to
146 right) track next appearing/disappearing polygons.
147 + For each polygon edge update Z sorted active polygons list.
148 + Only draw pixel from the top-most polygon.
149 + Only if polygon area is transparent/half-transparent add
150 colors from the polygons below.
152 + As a bonus, this would allow to track which polygons are really
153 visible in the final scene for each frame.
155 + Such information allows further optimizations:
157 + Dynamic geometry simplification:
158 + Dynamically detect and replace invisible objects from the
159 scene with simplified bounding box.
161 + Dynamically replace boudnig box with actual object once it
164 + Dynamically unload unused textures from RAM.