Demoniak3D in a Nutshell
By Jérôme 'JeGX' GUINOT and Samir 'SoundCheck' FITOURI
feedback [at] ozone3d [dot] net
Initial draft: August 20, 2005
Update: October 21, 2005
Translated from french by Samir Fitouri
1 - What is Demoniak3D ?
Demoniak3D is a highly interactive 3D software for rapidly prototyping and designing real-time 3D applications. It is based
on a simple functioning principle: a virtual machine which runs a 3D scene’s descriptive code. This code, present in a file named source
code, follows the DSDL syntax (
Demoniak3D Scene Description Language).
The true aim of Demoniak3D is simple:
put real time 3D technology (graphics and physics) in everybody's hands in a very friendly user manner.
Demoniak3D is a demo-system which permits rapid development of a prototype or a demo (in whichever sense you prefer: demonstration software
or demoscene in the demomakers’ terminology).
Demoniak3D allows one to create real-time 3D presentations and demos with an incredible rapidity. The interactivity implementation in
sophisticated 3D scenes including complex 3D models, with textures and lighting effects, was until now only possible with the use of high
class programming languages such as C++, to mention the most used one in the graphics and video games field. As with other programs,
but which do not do real-time 3D, it works with a very easy script which one may edit with a simple text editor.
Démo LavaZone par SatyRDemoniak3D uses a subtle dosage of latest in techniques:
XML, LUA scripting and the best known shading language named
the
vertex and pixel shader or
GLSL (GLSL for
OpenGL Shading Language) since the Demoniak3D real-time 3D rendering
is based on OpenGL. The combination of XML, LUA and GLSL forms the HSDL script. It is here that the force of HSDL scripting lies:
there is no new syntax to learn, XML, LUA and GLSL already being known, tested and easily accessible (although as far as GLSL is
concerned...).
The HSDL script, very intuitive, requires a short training period (a few minutes!) to understand its functioning, which is nothing in
comparison with the fastidious apprenticeship necessary to master a programming language such as C++.
Thus Demoniak3D allows one to avoid the complexity of graphic programming by offering a simple programming interface, without however
curbing the quality of the 3D rendering: all the richest functions are entirely taken advantage of by Demoniak3D in order to make them
available to all users.
Demoniak3D can be resumed as follows: high level user functions to access the low level functions of the subjacent graphic
system (3D engine, 3D controller, OpenGL).
One of the numerous examples which accompany Demoniak3DMastering a programming language, no matter which one, requires a lot of practice. In virtue of this, Demoniak3D is relatively
well furbished: close to a hundred
code samples, tens of fully documented and illustrated tutorials covering all the important
concepts of Demoniak3D and a few more voluminous projects mixing all the basic techniques.
Demoniak3D is principally destined to all those who wish to discover the fantastic world of real-time 3D programming. If the idea of
opening a text editor such as notepad to modify a few values freezes your blood, then change route! Demoniak3D is a tool for a developer, or
in classical syntax, a coder. But it is not necessary to be a hardened developer, having millions of coded lines behind him. It is
only necessary to want to code and to let the magic of Demoniak3D act: in a few hours you will already obtain results which will impress
the 3D gurus.
2 - What is real-time 3D ?
The real-time 3D concept means that the user can interact with the 3D environment which he has created, the computer
having the responsibility of calculating and instantly (thus the term “real-time”) visualizing (rendering) the result of the actions
which the user takes. These actions, such as various movements (with the help of the mouse, or with some keyboard keys), changes
in camera orientation, lighting changes etc, are directly interpreted and calculated at the rate of a number of images per second
to generate a fluid sequence.
In the 3D world in question, it is thus possible to place oneself anywhere in this environment, to observe from a number of different
points of view, to "prospect behind" a particular object, etc.
One of the fundamental objectives of 3D computer graphics is the creation of animation. Animation is no more than a series of images.
These images are shown one after the other in a sequential manner.
But then, what is the difference between an AVI type animation which has been produced with ray-tracing software (like those that
accompany modeling software) and real-time animation? Nothing more than a little detail of capital importance: the time it takes
to generate an image...
When real-time catches up with ray-tracing...In the case of ray-tracing software (or more generally in the case of a non interactive rendering “engine”), the time for
calculating an image may vary from a few seconds to hours and even days for the more complex scenes. In the case of real-time 3D,
the time for calculating an image is calculated in fractions of seconds. Moreover, it is in real-time 3D (video games foremost) that
a measuring unit appeared which imposed its dictatorship without mercy: the FPS.
The FPS (Frames Per Second or number of images per second) allows one to measure the calculating speed of an animation with extreme
simplicity. A value of 60 FPS is very common. This value signifies that the time to generate an image is of 1/60 = 0.166 seconds or
16 ms. This is far from the hours or days as in the case of ray-tracing.
More precisely, one speaks of real-time when the calculation and rendering time is imperceptible to the eye.
3 - Does Demoniak3D use a 3D engine ?
Of course! Demoniak3D is an application using a latest generation 3D engine (at least at the time of editing – because in the
3D field, time is accelerated to an extent which would rejoice Einstein!) as the neuralgic element: oZone3D. This engine permits the
user to use the latest advanced graphic effect technologies.
But before going further, a bit more precision concerning the 3D engine. The term engine, currently used in programming, simply
signifies a group of functions which permit one to achieve a task. In our case, our task is to build and render real-time 3D scenes.
You have surely heard of (without necessarily having taken notice): the
Doom 3 engine or the
Unreal Engine, both figuring
among the most expensive commercial engines, or in the free register, the excellent
Ogre3D (great work from all the Ogre3D Team ;) ).
oZone3D is a real-time 3D engine written in C++. An engine of this type is relatively difficult to access for the neophyte.
Effectively one should know how to use C/C++, the programming system (Windows, Linux) and one must have enough courage to plunge into
the understanding of the engine in order to be able to use it. On the other hand, once these barriers overcome, all of these applications
are potentially possible, from the simple little 3D object viewer to the most complex video game.
Demoniak3D may be seen as an interface between the
engine and the user (or developer). The creation of real-time 3D scenes
with Demoniak3D remains a programming exercise but this exercise is really simplified. For example, less than ten or so code lines
in HSDL syntax permit one to create one’s first 3D scene.
Because Demoniak3D is a high level interface of the oZone3D engine, all the 3D concepts used in Demoniak3D are those of oZone3D.
For more information concerning the oZone3D engine: www.ozone3d.net/ozone3d.php.
4 - Do I need a 3D graphics controller ?
Technically, it is not necessary.
Demoniak3D uses the
OpenGL rendering, and one can therefore create basic 3D using the OpenGL
rendering software. However, it is extremely slow and the number of graphic effects is very limited (no multitexture, no pixel vertex
shaders, no bump mapping, to name the principle ones).
Honestly, in order to appreciate the fantastic real-time rendering projects that one can create with Demoniak3D, you need a graphic card
with OpenGL support. It has become practically impossible nowadays to purchase a PC type computer without a 3D controller. These
graphics controllers using ATI chips (Rage Pro, Radeon) and nVidia chips (all the GeForces) are perfectly adapted for real-time
3D with Demoniak3D. For a few tens of euros one may find controllers based on GeForce 5200 which are perfectly suited for approaching 3D.
Now for those who wish to work intensively with vertex and pixel shaders, it is strongly recommended to be equipped with a high class
3D card such as GeForce 6800 GT or better still 7800 GT/GTX.
For more details on the importance of the graphic card and its use, see the tutorial on
graphics cards.
5 - OpenGL - Direct3D ?
OpenGL and
Direct3D are graphics rendering libraries which are the most used in the development of 3D (and 2D!) graphics
applications. These 2 libraries have roughly the same functions and integrate all the latest progress made in 3D.
The oZone3D engine uses what one calls plugins, that is to say software modules that are loadable and downloadable at will from the
computer’s memory, to run these 3D rendering libraries. Demoniak3D is furnished with an OpenGL rendering plugin. This implies that
your graphic card must be correctly configured in order to profit from this. Effectively, it is not enough to just connect a new 3D
controller to the computer to be able to use it; it must also feature the adequate drivers (generally the latest ones) which will
permit Demoniak3D to use the OpenGL functions offered with the controller. But do not be afraid: the installation of graphic drivers is
trivial: usually just launch an executable file which manages everything. The latest graphic drivers for controllers equipped with
ATI or nVidia chipsets are delivered with Demoniak3D. These graphic drivers can be downloaded
from:
oZone3D Graphics Drivers Page.
6 - Do I need to have advanced mathematical knowledge to code with Demoniak3D ?
The reply is immediate and it is
NO! The only notion that one needs to have is that of a position in 3D space using
the X, Y and Z coordinates to place an object in the 3D scene reference frame:
You just need to know that the Z axe is oriented (in the positive sense) in such a way that it comes out from the screen and points
towards you. That is what is called a right hand reference frame (RH for Right Hand). It is the natural Demoniak3D reference frame.
The coordinate points X=0, Y=0 et Z=0, also noted <0,0,0> are situated in the centre, at the intersection of the 3 axis. It is
however evident that a smattering of specialized trigonometry and geometry is helpful in understanding the mathematical bases of 3D and
to appreciate what Demoniak3D has to offer; but for elementary use, no particular mathematical knowledge is required. As soon as one
exceeds elementary use, then math becomes necessary: LUA scripting to apply transformations to 3D objects, physical management or even
the vertex and pixel shaders, a highly mathematical domain!
7 - Functioning Principles
Below is the scheme of the global organisation of Demoniak3D:
Input data
To begin with Demoniak3D takes the description of the 3D scene at time t=0. The scene’s description may be presented in 2 ways:
- an XML file: this type of file has a standard syntax, understood by any user, very simple to use: a simple text editor (the Windows
Notepad for example) is sufficient to describe the scene.
- A binary file: this file represents a bytecode generated by Demoniak3D from a XML file. The bytecode allows the distribution of a
prototype (or a demo) without authorizing its modification. This mode, associated with the conversion of 3D data into a proprietary
format, permits total protection of one’s creations..
The evolution of the scene for t>0 depends either on the initial conditions, described in the XML file or in the bytecode, or on external
modifiers such as scripts (LUA), the mouse or the keyboard (hotkeys).
Demoniak3D permits an easy use of classic medias:
- images and textures (*.jpg, *.tga, *.bmp, *.png, *.psd, ...)
- audio (*.wav, *.mp3, *.xm, *.it, ...)
- videos (*.avi)
- 3D models (*.3ds, *.ase, *.txt, *.o3mdl, *.obj, *.fbx)
Output data
Demoniak3D proposes several types of output:
- The principal output which is the interactive real-time 3D scene
- Screen capture in the form of images (screenshots). For each frame (rendered image of the 3D scene), an image may be saved onto the
hard disk. This permits one, for example, to make an AVI setup from a sequence of images.
- Scripts generation for offline rendering engines. As for the images, Demoniak3D can create a script per frame. The offline rendering
engines (such as POVray or Yafray) generate a photo-realistic image from this script.