refactored documentation structure
[sixth-3d.git] / doc / index.org
1 #+TITLE: Sixth 3D - 3D engine
2
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;}
11 #+HTML_HEAD: </style>
12
13 * General
14 - This is a subproject of [[https://www3.svjatoslav.eu/projects/sixth/][Sixth]]
15
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.
20
21 - Program author:
22   - Svjatoslav Agejenko
23   - Homepage: https://svjatoslav.eu
24   - Email: mailto://svjatoslav@svjatoslav.eu
25
26 - [[https://www.svjatoslav.eu/projects/][Other software projects hosted at svjatoslav.eu]]
27
28 ** Source code
29 - [[https://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=snapshot;h=HEAD;sf=tgz][Download latest snapshot in TAR GZ format]]
30
31 - [[https://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=summary][Browse Git repository online]]
32
33 - Clone Git repository using command:
34   : git clone https://www2.svjatoslav.eu/git/sixth-3d.git
35
36 - See [[https://www3.svjatoslav.eu/projects/sixth-3d/apidocs/][JavaDoc]].
37
38 * Project description
39 + See: [[https://www3.svjatoslav.eu/projects/sixth-3d-demos/][demos of current 3D engine capabilities]]
40
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]].
44
45 Sixth 3D can be also used as standalone [[id:08f71987-90af-40dc-bb65-bac87db9e652][3D engine in your project]].
46
47 ** Justification for software rendering
48    :PROPERTIES:
49    :ID:       d03013e5-931b-40ca-bc4b-e4b3f23b9a4e
50    :END:
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
54 systems.
55
56 CPU rendering performance is already good enough to implement usable
57 3D UI at sufficient detail level, resolution and frame rate.
58
59 Also CPU rendering allows to freely test different rendering and
60 optimization algorithms and retains complete control of every rendered
61 pixel.
62 ** Justification for Java
63    :PROPERTIES:
64    :ID:       a11f7150-1b25-4ca4-a3c3-8c8bd1352bd4
65    :END:
66 - It is easy to refactor and experiment with.
67
68 - Easy portability and installation. No need to deal with platform
69   specific dependencies.
70
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).
74
75 - No limitations imposed by:
76   - requirement for decent GPU
77   - GPU missing features
78   - GPU missing/incomplete/buggy drivers
79   - OpenGL specification
80
81 - It is fast enough thanks to:
82   - Java virtual machine just-in-time compiler.
83   - Growing CPU cores count.
84
85 - As a result it is easy to run on various hardware platforms and
86   operating systems.
87
88 * API documentation
89 - See [[https://www3.svjatoslav.eu/projects/sixth-3d/apidocs/][JavaDoc]].
90
91 Note: due to a lack of time, there is still big room for improvement
92 on documentation.
93
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
98   :PROPERTIES:
99   :ID:       08f71987-90af-40dc-bb65-bac87db9e652
100   :END:
101 Maven *pom.xml* file snippet:
102 #+BEGIN_SRC xml
103 <dependencies>
104     ...
105     <dependency>
106         <groupId>eu.svjatoslav</groupId>
107         <artifactId>sixth-3d</artifactId>
108         <version>1.1</version>
109     </dependency>
110     ...
111 </dependencies>
112
113 <repositories>
114     ...
115     <repository>
116         <id>svjatoslav.eu</id>
117         <name>Svjatoslav repository</name>
118         <url>http://www2.svjatoslav.eu/maven/</url>
119     </repository>
120     ...
121 </repositories>
122 #+END_SRC
123
124 For API usage examples, see [[https://www3.svjatoslav.eu/projects/sixth-3d-demos/][demos]].
125 * TODO features to add
126 + Partial region/frame repaint: when only one small object changed on
127   the scene, it would be faster to re-render that specific area.
128
129 + Once partial rendering works, in would be easy to add multi-core
130   rendering support. So that each core renders it's own region of the
131   screen.
132
133 + Antialiazing. Would improve text readability. If antialiazing is too
134   expensive for every frame, it could be used only for last frame
135   before animations become still and waiting for user input starts.
136
137 + Render only visible polygons.
138   + This would significantly reduce RAM <-> CPU traffic.
139
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.
149
150   + As a bonus, this would allow to track which polygons are really
151     visible in the final scene for each frame.
152
153     + Such information allows further optimizations:
154
155       + Dynamic geometry simplification:
156         + Dynamically detect and replace invisible objects from the
157           scene with simplified bounding box.
158
159         + Dynamically replace boudnig box with actual object once it
160           becomes visible.
161
162       + Dynamically unload unused textures from RAM.