Orchid Rendering
May 13th, 2008 Posted in Wip | No Comments »shadow shows us some new pictures of his Demoniak3D project about the modelling and rendering of an orchid. Just jump HERE (in french).

shadow shows us some new pictures of his Demoniak3D project about the modelling and rendering of an orchid. Just jump HERE (in french).

LuaFileSystem is a small lib for LUA that makes it possible to manage OS’s directories and files (Windows, Linux, etc.). LuaFileSystem is a part of Demoniak3D’core since version 1.23.0. To use it, just call the lfs object in your Lua script. Coupled with Lua’s io lib, you can now code all file-management routines you wish! I’ve prepared a small demo that shows you how to use LuaFileSystem with Demoniak3D as well as a links compilation:

DEMO:
- Demoniak3D LuaFileSystem Demo
LINKS:
- LuaFileSystem Reference
- LuaFileSystem Example: Directory iterator
Yes it’s possible and it’s very easy to handle several keys in the same time in LUA. The following small demo allows you to press simultaneously on the X, C, V, B, N and M keys. The corresponding character is displayed.
DOWNLOAD:
- Demoniak3D Demo
It’s possible to specify the order in which HUDs will be displayed by tuning HUD’s z position and enabling depth test. The following code snippet show us how to display a red HUD over a white one (although the red HUD has been specified first in the XML script). Just pay attention to the z range: -1.0 to +1.0.

<hud name="Red_Hud" render="TRUE" >
<position x="-30.0" y="-20.0" z="0.7" />
<size width="100" height="100" />
<vertex_color index="0"
r="1.0" g="0.0" b="0.0" a="1.0" />
<vertex_color index="1"
r="1.0" g="0.0" b="0.0" a="1.0" />
<vertex_color index="2"
r="1.0" g="0.0" b="0.0" a="1.0" />
<vertex_color index="3"
r="1.0" g="0.0" b="0.0" a="1.0" />
</hud>
<hud name="White_Hud" render="TRUE" >
<position x="-50.0" y="0.0" z="0.8" />
<size width="100" height="100" />
</hud>
<script name="init_scene" run_mode="INIT" >
<raw_data><![CDATA[
HYP_Object.SetDepthBufferState("White_Hud", 1);
HYP_Object.SetDepthBufferState("Red_Hud", 1);
HYP_Object.SetPosition("Red_Hud", -30, -20, 0.9);
]]></raw_data>
</script>
Of course, this is also valid if the HUDs are LUA-dynamically created.
DOWNLOAD:
- DEMONIAK3D-HUD-Z-ORDER-DEMO.zip
Demoniak3D 1.23.0 is available. This version fixes the watermark bug in the player that comes with the PRO version.
In the news side, Demoniak3D 1.23.0 adds the support of LuaFileSystem that makes it possible to manage the directories of Windows file system.
Useful to scan a full directory (with its sub directories) in order to read some data files. Some new LUA functions have been added to the VBQuad management.
For more detail, here is the full changelog:

Links:
- Download Page
The PRO version of Demoniak3D is nodelocked, i.e. it is locked to the computer. Then you can’t distribute Demoniak3D.exe file. In return, a Demoniak3D scene player comes with the PRO version (Demoniak3D_Player.exe). This player is only capable to read a scene in a binary format. That binary format is created by Demoniak3D PRO (CTRL+E). Pressing CTRL+E will make Demoniak3D
to create a file called demo.h3d in the demo’s folder. This file holds all the scene description (XML, LUA and GLSL) in binary format. Demo’s source code is now hidden and protected. To release the demo, just follow the procedure described in this entry (How to release a demo with the FREE version) with the following small differences:
- the executable file to be copied and renamed is now Demoniak3D_Player.exe.
- the demo’s main file is now demo.h3d (of course, you can rename this file). The name of this file has to be put in the auto_load attribute of startup_params node.
Et voilà, the release of a demo with the PRO version is not very difficult (from a Demoniak3D developper standpoint…).
You can create with the FREE version of Demoniak3D a demo that is lauchable directly with a bouble-click on an executable file. But the end-user will always have access to demo’s source codes
(xml, glsl and lua files). Only the commercial version (PRO) of Demoniak3D makes it possible to protect demo’s source codes.
Once the demo coded and operational, just create a folder where you will copy your demo (xml, lua, glsl and media files). Then copy in that folder Demoniak3D.exe executable with its DLL and plugins (*.o3p). All plugins are not mandatory: if the demo, for instance, loads 3DS files only, vous can delete all others 3D loaders plugins (OBJ, etc.). Same thing for the particle_system_plugins folder: if you don’t use particle at all, the whole folder car be deleted. Now that the demo’s folder is ok, you need to do the following tasks:
- edit demoniak3d-config.xml file and change auto_load attribute of startup node. auto_load holds the name of the demo file: in our case it’s the main XML file, the one that contains the
root node demoniak3d.
- set to 0 check_version attribute. That will be disabled online check for new versions of Demoniak3D.
- rename Demoniak3D.exe: for example with myKool3DDemo.exe.
- archive all the demo in a nice zip file and put it in download somewhere in the Net.
The end user has only to unzip the demo and double-click on myKool3DDemo.exe to launch the demo.
Demoniak3D 1.22.0 is available. This version fixes the bug of the HYP_Input.SetMousePos() function (see WhishList forum) and adds an experimental support of the MRTs (Mutltiple Render Tagets) via the HYP_Scene.SetMultipleRenderTargets() function (see MRT thread).
MRTs are accessible through GLSL shaders. I will process the rest of the feature requests in the next releases.

Links:
- Download
The french portal of 3d computer graphics, www.tdt3d.com, has opened a new forum devoted to Demoniak3D. This forum is here: TDT3D - Demoniak3D Forum. You will be able to post your questions and talk about Demoniak3D in french or english as you want. Thanks to Benoît, the guru behind tdt3d website!
DemAux (shortcut for DEMoniak3d AUXiliary library) is a LUA library that offers additional functionalities to Demoniak3D LUA host-API. For this first version 0.1.0, DemAux integrates a 3d vectors handling module (math_vec3.lua), some basic mathematics functions (such as a random number generator with inferior and superior limits) and a scene objects handling module (object.lua). This library will grow with the time with the adding of new high level functionalities (such as spline creation — bezier and catmull-rom — for motion path based animations). Why such a library my friends? Simply to not make heavy Demoniak3D LUA API. The LUA API offers all low level functions you can’t create without an access to Demoniak3D internals (like setting the position of an object with HYP_Object.SetPosition). But all other functions that don’t require an access to Demoniak3D internals, can be coded and added
in DemAux by using LUA core functions and LUA host-API (such as DEM_MoveObjectAlongAxis function - object.lua file).
If you have coded a small piece of code that you find useful for Demoniak3D community, please feel free to contact me (jegx AT ozone3d DOT net) and I will be glad to add your work with all your credits into DemAux.
Links:
- DemAux Homepage
The creation of the Wish List / Feature Requests forum has been beneficial for Demoniak3D since most of changes of this new version comes from ideas posted in that forum. Thanks to all contributors!

Links:
- Download
Changelog:
Good news for MAX 10 users. Seems the Wak exporter for MAX 9 works also with MAX 10 (still 32-bit). I’m waiting for other feedbacks…
The Wak plugin for 3D Studio MAX 9 is available in 32-bit version only. Thanks to Benoît for his test.
Just for refreshing your memory, Wak is an 3D models exporter for 3D Studio MAX. The exported format can be directly loaded with Demoniak3D like any *.3DS or *.OBJ file.
Wak’s homepage: www.ozone3d.net/wak/
Steph3D offers us a little function to center back the pivot of a mesh. Actually, in some cases, the local axis (or pivot or tripod) of a mesh are not centered on it but are shifted. This is a problem for executing, for instance, selft-rotations of a mesh.
function AutoCentre(mesh_id) local x, y, z = HYP_Object.GetBoundingVolumeAbsoluteCenter( mesh_id ); HYP_Mesh.SetPivotPosition(mesh_id, x, y, z ); end
The useful links list has been updated with 4 news links:
1 - GLSL - language basis and GLSL - Additional notions.
Both pages explain the basis of GLSL in a simple way with many details. But these pages are in french…
2 - www.pitjamajusto.com: pitjamajusto.com provides free music in mp3 format, under a Creative Commons license. That means you can freely
download, listen to, copy, distribute (making CD’s to your friends or sharing in a peer-to-peer network) our music as long as you give credits to the authors.
3 - Intiation to Demoniak3D @ media-pixel.net: media-pixel.net offers an initiation to Demoniak3D in french
with a skateboard-based scene. The tutorial is well written and detailed. A good resource to start with Demoniak3D.
From now, posts will be available in two languages: french and english. This cool feature is done by this nice Wordpress plugin: jLanguage. Each post written in french and english will display two icons in the top-right part of the post to switch language.
I’ve added a new forum for your wish list concerning Demoniak3D. Whether you have an idea, whether you notice a missing LUA function, whether you need a new tutorial or code sample, then don’t hesitate to spam this forum. I don’t guarantee to realize all your dreams but I’ll try to do my best for.
The forum: Demoniak3D Wish List
Demoniak3D possède un petit bug dans la gestion des normals des meshs en XML. Lorsque l’on utilise l’attribut average_normals=”TRUE”
et que l’on fait du bump mapping, le vecteur tangent nécessaire au bump mapping dans le vertex shader n’est pas mis à jour correctement. Il en resulte
des zones où le rendu est faux (pôle de la sphere):

En attendant la correction du bug, je vous propose le workaround suivant:
<script name="init" run_mode="EXECUTE_ONCE" >
<raw_data><![CDATA[
HYP_Object.AverageNormals("myMesh");
HYP_Object.ComputeTangentSpace("myMesh");
]]></raw_data>
</script>
En fait il suffit de mettre à jour les vecteurs tangents manuellement après avoir moyenné les normales.
Merci à John Difool pour m’avoir signalé le bug.
Dr Goulu has done an update of his spiral galaxy simulation. Now the simulation uses several vertex-pools to mix together different particle textures.
Homepage - Download: Spiral Galaxy Demo
[F1, F2] and [F3, F4] keys allow to change the parameters the control the creation of the spiral. The parameters of the following image are: eratio=0.875 and etwist=21.800.

Dans ce billet nous allons voir le phénomène de jointure qui apparaît sur certains meshes et comment y remédier. Je reçois souvent des feedbacks par rapport à ce problème qui en réalité n’en est pas un. La jointure (ou seam dans la langue de shakespeare) sur la surface d’un mesh est visible seulement lorsque le mesh est éclairé. Sur l’image suivant, le mesh de gauche possède une belle jointure tandis que celuide droite en est dépourvu.

Le phénomème de jointure prend sa source dans la normal d’un vertex. Le mesh sphère peut être vu comme une feuille de papier que l’on a réussi à plier de manière à former une sphère. L’endroit ou les bords de la feuille se rejoingent forme la jointure. A cet endroit, plusieurs vertices ont la même position mais ont des vecteurs normaux différents:

Sur cette image l’explication devient claire: au niveau de la jointure, on voit que pour chaque vertex il y a deux vecteurs normaux. En réalité il y a pour chaque position deux vertices, chacun avec sa propre normale. Et comme l’éclairage est basé sur la valeur du vecteur normal, la jointure entre les bords du mesh sphère apparaît très nettement.
Maintenant que nous avons vu d’où vient la jointure, regardons comment la supprimer. Cette suppression est activée par défaut dans les logiciels de modélisation mais comme Demoniak3D est avant tout un outil d’apprentissage et d’expérimentation de la 3D temps réel, la jointure n’est pas supprmée par défaut car il est important de comprendre ce que c’est et comment y remédier. Théoriquement, pour supprimer cette jointure, il suffit que les vecteurs normaux situés sur la jointure aient la même valeur. Pratiquement, cette opération porte le nom de Average Normals (ou moyenner les normals) et s’effectue le plus simplement du monde avec l’instruction average_normals dans le noeud mesh:
<mesh name="sphere01" lighting="TRUE" average_normals="TRUE" > </mesh>
Le LUA n’est pas en reste, plus que la fonction AverageNormals() de la librairie HYP_Object permet de faire la même chose:
HYP_Object.AverageNormals( "sphere01" );
Les normales ont été moyennées dans la sphère de droite et ont été laissées tel quel dans la sphère de gauche.
Le code source de cette démo est disponible ici:
[ DEMO Mesh Seam - DOWNLOAD ]