Getting started!
Fundamentals
Irrlicht and Shockwave3d are two different 3d engines in that they had different design goals. Shockwave3d was designed by macromedia/Intel to be a portable and small multimedia- and web playing engine, whereas Irrlicht is more of an all-purpose 3d engine.
This leads to some fundamental differences between the two.
Shockwave3d has an abstract scenegraph engine, meaning that you can switch the renderer of the 3d scene at any given time (usually from hardware supported renderers to the software renderer) and maintaining the state of the models and the world.
With Irrlicht however, the scenegraph is bound to the current renderer, you cannot switch the renderer at runtime. Although Irrlicht does support 2 different software renderers, you must choose which one you want to use before any 3d rendering is actually done.
For Shockwave3d, you choose this in the property inspector, and it defaults to the #directx7_0 hardware renderer. Irrlicht on the other side will default to DirectX 8.0.
Palette model
Shockwave3d is organized around a palette model. This means that elements of the 3d world are all divided up in palettes, and are combined at runtime. There are modelresources (the actual geometry), models, shaders, textures, lights, groups, etc. There is no formal palette model metaphore in Irrlicht, yet things are organized in a similar way in that the ressources are pooled and can be accessed by either number or name, just like in Shockwave3d.
Modelresources
Modelresources are the biggest difference between Shockwave3d and the Irrlicht engine. In Shockwave3d for instance, there are so-called primitives which can be created by scripting. These geometry primitives are cubes, spheres, cylinders, planes and particle systems.
In Irrlicht, only a few primitives are available, and they are not explicitly defined as in Shockwave3d. For instance, to create a cube, you must create a testSceneNode. The cube to be seen is just a visual byproduct of the method which is ought to create a scenegraph node entry and not a cube.
Spheres and cylinders cannot be created by scripting for the time being in the Irrlicht engine. A feature request has been sent in for this.
Planes however can be created and come in different flavors. You can create terrain meshes for instance, or animated water surfaces which wave, or hill meshes.
The Irrlicht engine thus usually relies on geometry being imported from the outside. The engine distincts two different mesh types, static meshes as well as animated meshes.
Animated meshes come with associated animations or are potentially animatable.
In Shockwave3d, the distinction is one level up: a model has either animation objects associated with it or not, but not the mesh (=modelressource) itself. it is the model which is getting animated, not the resource.
Models
In Irrlicht as for Shockwave3d, for a modelresources (or mesh) to be visible in the 3d world, a model must make reference to it. This usually happens by the means of an assigment:
meshresourcetobeused=member(”3d”).modelresource(”myMesh”)
myModel=member(”3d”).newModel(”myNewModel”, meshresourcetobeused)
This creates a new model with the name “myNewModel”, using the mesh or modelresource referenced in the variable meshresourcetobeused, which in return points to the modelresource named “myMesh” in the 3d world.
Fileformats
In Shockwave3d, a 3d scene can be imported using the W3D file format, which has a flexible file structure and allows for granular control while importing and even streaming. It usually describes a whole 3d world coming from a 3d modelling program like 3d Max.
Irrlicht on the other hand has two different groups of files it can import:
- irr-files are XML files describing the elements of a scene,
- and the different mesh format importer allow for the import of meshes and resources.
Irr-files are a new feature of v1.1 of the Irrlicht engine and are XML files describing the media content of a 3d scene. They describe the setup, so to speak, but are not self-contained, contrary to the W3D file format from Shockwave3d. An Irr-file describes the setup of the 3d engine and the models in the world, as well as the files which are describing them and their ressources like textures.
Most of the mesh file formats referenced in an Irr-file may also not be completely self-containing. If you import a 3d max file into Irrlicht for instance, you usually also need to supply and manually import the texture files. The importing for referenced ressources like textures however is usually done automatically, so when you read in a Quake level, all the texture files needed by the model are tried to be imported as well and then applied to the model.
Quake files can come in the pk3-format, which is nothing else than a ZIP file containing all elements. ZIP archives can be added to the Irrlicht world and then be read as if their content was part of the file system. A well maintained archive thus may contain several meshes and files for texturing these meshes.
Irrlicht being a low-polygon 3d engine, the best supported file formats are Milkshake (.ms3d), Quake file formats for levels (.bsp), models (.md2), as well as the DirectX .X format and the 3d Studio file format 3ds.
DirectX X files can be exported from 3d Max for instance, using the X exporter from Microsoft.
Here is a list of the currently supported file formats;
Supported textures file formats:
• Adobe Photoshop (.psd)
• JPEG File Interchange Format (.jpg)
• Portable Network Graphics (.png)
• Truevision Targa (.tga)
• Windows Bitmap (.bmp)
• Zsoft Paintbrush (.pcx)
In addition to the formats listed, you can also specify bitmap cast member references for the specific methods, or lingo image objects.
Supported mesh file formats:
• 3D Studio meshes (.3ds)
• Alias Wavefront Maya (.obj)
• Cartography shop 4 (.csm)
• COLLADA (.xml, .dae)
• DeleD (.dmf)
• FSRad oct (.oct)
• Microsoft DirectX (.x)
• Milkshape (.ms3d)
• My3DTools 3 (.my3D)
• Pulsar LMTools (.lmts)
• Quake 3 levels (.bsp)
• Quake 2 models (.md2)
In addition, there are exporters for popular 3D packages (Blender, 3DSMax, Gile[s], ..) included in the SDK. It is also very easy to extend the engine to read additional 3d formats, so new formats might be added in the future.
Note that some of the fileformats are just static meshes which do not allow for animations. Regarding animations, here is a quote from the Irrlicht website:
“Currently there are two types of character animation implemented:
- Morph target animation: Meshes are linear interpolated from one frame to the next. This is how it is done in the Quake game series, and how the Irrlicht engine does it when importing .md2 files.
- Skeletal animation: A skin is manipulated by animated joints. The Irrlicht Engine will do this when loading .ms3d or .x files. It is easily possible to attach objects to parts of the animated model. It is possible e.g. to attach a weapon to the hand of a model, which will be moved as the hand moves, with only one line of code.
The programmer needs not to know about all this, if he doesn’t want to. All he has to do is to load the files into the engine and let it animate and draw them.”
Special sceneNodes
The Irrlicht engine has some special sceneNode types built-in which have no direct counterpart in Shockwave3d. The most prominent is the Billboard type. A Billboard is a model which is always turned to the camera. The closest relation there is to Shockwave3d are the particles of a particle system in Shockwave3d which are small planes
More about Animations
The Irrlicht engine provides several “default” animations for animating models. These animations are being caused by so-called animator objects which first get created, and then assigned to the scenenode which they should animate. Note that they can animate a *scenenode*, thus this can be a model, light, billboard or a camera.
The names of the animators are pretty self-explanatory:
- CollisionResponseAnimator (see also below “Collision detection”)
- DeleteAnimator
- FlyCircleAnimator
- FlyStraightAnimator
- FollowSplineAnimator
- RotationAnimator
An animator is created as followed for example:
centerVector=vector(0,10,0)
radius=30
speed=0.1
myModel=member(”3d”).model(”myModel”)
animator=member(”3d”).createFlyCircleAnimator(centerVector, radius, speed)
myModel.addAnimator(animator)
As you can see, addAnimator() can stack up several animators onto a scenenode. To delete an animator, do either
myModel(”myModel”).removeAnimator(animator)
to just delete the specific animator, or
myModel(”myModel”).removeAnimators()
to remove all animators from the model.
You can however also go the other way round and first create the animator, and then assign it to the scenenode to be animated:
starttime=member(”3d”).getRealTime()
animator.animateNode(myModel, starttime)
starttime provides the time from which on the model should be animated.
The DeleteNodeAnimator deletes the assigned scenenode from the 3d world after a pre-determined amount of time.
The FollowSplineAnimator is somewhat special, in that it takes a list of 3d vectors for the path of the animation to be pursued. An optional tightness factor controls how close the path described by the vectors is followed:
starttime=member(”3d”).getRealTime()
points=[vector(0,0,0), vector(1,0,0), vector(1,1,0),vector(1,1,1)]
speed=1.0
tightness=0.5
splineAnimator=member(”3d”).createFollowSplineAnimator(starttime, points, speed, tightness)
From the Irrlicht API Documentation:
“The animator modifies the position of the attached scene node to make it follow a hermite spline. The code of the is based on a scene node Matthias Gall sent in. Thanks! I adapted the code just a little bit. Matthias wrote: Uses a subset of hermite splines: either cardinal splines (tightness != 0.5) or catmull-rom-splines (tightness == 0.5) but this is just my understanding of this stuff, I’m not a mathematician, so this might be wrong
”
(to be continued…)


