|Read more about this book|
(For more resources on OGRE 3D, see here.)
Q: What is Ogre3D?
A: Creating 3D scenes and worlds is an interesting and challenging problem, but the results are hugely rewarding and the process to get there can be a lot of fun. Ogre 3D helps you create your own scenes and worlds. Ogre 3D is one of the biggest open source 3D render engines and enables its users to create and interact freely with their scenes.
Q: What are the system requirements for Ogre 3D?
A: You need a compiler to compile the applications. Your computer should have a graphic card with 3D capabilities. It would be best if the graphic card supports DirectX 9.0.
Q: From where can I download the Ogre 3D software?
A: Ogre 3D is a cross-platform render engine, so there are a lot of different packages for these different platforms. The following are the steps to download and install Ogre 3D SDK:
- Go to http://www.ogre3d.org/download/sdk
- Download the appropriate package.
- Copy the installer to a directory you would like your OgreSDK to be placed in.
- Double-click on the Installer; this will start a self extractor.
- You should now have a new folder in your directory with a name similar to OgreSDK_vc9_v1-7-1.
- Open this folder. It should look similar to the following screenshot:
Q: Which are the different versions of the Ogre 3D SDK?
A: Ogre supports many different platforms, and because of this, there are a lot of different packages we can download. Ogre 3D has several builds for Windows, one for MacOSX, and one Ubuntu package. There is also a package for MinGW and for the iPhone. If you like, you can download the source code and build Ogre 3D by yourself. If you want to use another operating system, you can look at the Ogre 3D Wiki, which can be found at http://www.ogre3d.org/wiki. The wiki contains detailed tutorials on how to set up your development environment for many different platforms.
Q: What do you mean by a scene graph?
A: A scene graph is one of the most used concepts in graphics programming. Simply put, it’s a way to store information about a scene. A scene graph has a root and is organized like a tree. The important thing about a scene graph is that the transformation is relative to the parent of the node. If we modify the orientation of the parent, the children will also be affected by this change.
Q: What are Spotlights?
A: Spotlights are just like flashlights in their effect. They have a position where they are and a direction in which they illuminate the scene. This direction was the first thing we set after creating the light. The direction simply defines in which direction the spotlight is pointed. The next two parameters we set were the inner and the outer angles of the spotlight. The inner part of the spotlight illuminates the area with the complete power of the light source’s color. The outer part of the cone uses less power to light the illuminated objects. This is done to emulate the effects of a real flashlight.
Q: What is the difference between frame-based and time-based movement?
A: When using frame-based movement, the entity is moved the same distance each frame, by time passed movement, the entity is moved the same distance each second.
Q: What is a window handle and how is it used by our application and the operating system?
A: A window handle is simply a number that is used as an identifier for a certain window. This number is created by the operating system and each window has a unique handle. The input system needs this handle because without it, it couldn’t get the input events. Ogre 3D creates a window for us. So to get the window handle, we need to ask it the following line:
Q: What does a scene manager do?
A: A scene manager does a lot of things, which will be obvious when we take a look at the documentation. There are lots of functions which start with create, destroy, get, set, and has. One important task the scene manager fulfills is the management of objects. This can be scene nodes, entities, lights, or a lot of other object types that Ogre 3D has. The scene manager acts as a factory for these objects and also destroys them. Ogre 3D works with the principle—he who creates an object, also destroys it. Every time we want an entity or scene node deleted, we must use the scene manager; otherwise, Ogre 3D might try to free the same memory later, which might result in an ugly application crash. Besides object management, it manages a scene, like its name suggests. This can include optimizing the scene and calculating positions of each object in the scene for rendering. It also implements efficient culling algorithms.
Q: Which three functions offer the FrameListener interface and at which point is each of these functions called?
A: A FrameListener is based on the observer pattern. We can add a class instance which inherits from the Ogre::FrameListener interface to our Ogre 3D root instance using the addFrameListener() method of Ogre::Root. When this class instance is added, our class gets notified when certain events happen. The following are the three functions that offer the FrameListener interface:
- frameStarted which gets called before the frame is rendered
- frameRenderingQueued which is called after the frame is rendered but before the buffers are swapped and
- frameEnded which is called after the current frame has been rendered and displayed.
Q: What is a particle system?
A: A particle system consists of two to three different constructs—an emitter, a particle, and an affector (optional). The most important of these three is the particle itself, as the name particle system suggests. A particle displays a color or textures using a quad or the point render capability of the graphics cards. When the particle uses a quad, this quad is always rotated to face the camera. Each particle has a set of parameters, including a time to live, direction, and velocity. There are a lot of different parameters, but these three are the most important for the concept of particle systems. The time to live parameter controls the life and death of a particle. Normally, a particle doesn’t live for more than a few seconds before it gets destroyed. This effect can be seen in the demo when we look up at the smoke cone. There will be a point where the smoke vanishes. For these particles, the time to live counter reached zero and they got destroyed.
An emitter creates a predefined number of particles per second and can be seen as the source of the particles. Affectors, on the other hand, don’t create particles but change some of their parameters. An affector could change the direction, velocity, or color of the particles created by the emitter.
Q: Which add-ons are available for Ogre 3D? Where can I get them?
A: The following are some of the add-ons available to Ogre 3D:
Hydrax is an add-on that adds the capability of rendering pretty water scenes to Ogre 3D. With this add-on, water can be added to a scene and a lot of different settings are available, such as setting the depth of the water, adding foam effects, underwater light rays, and so on. The add-on can be found at http://www.ogre3d.org/tikiwiki/Hydrax.
Caelum is another add-on, which introduces sky rendering with day and night cycles to Ogre 3D. It renders the sun and moon correctly using a date and time. It also renders weather effects like snow or rain and a complex cloud simulation to make the sky look as real as possible. The wiki site for this add-on is http://www.ogre3d.org/tikiwiki/Caelum.
- Particle Universe
Another commercial add-on is Particle Universe. Particle Universe adds a new particle system to Ogre 3D, which allows many more different effects than the normal Ogre 3D particle system allows. Also, it comes with a Particle Editor, allowing artists to create particles in a separate application and the programmer can load the created particle script later. This plugin can be found at http://www.ogre3d.org/tikiwiki/Particle+Universe+plugin.
In this article we took a look at some of the most frequently asked questions on Ogre 3D. The article, Common Mistakes : Ogre Wiki, would be helpful for further queries pertaining to Ogre 3D.
- Starting Ogre 3D [Article]
- Installation of Ogre 3D [Article]
- Materials with Ogre 3D [Article]
- The Ogre Scene Graph [Article]
- OGRE 3D 1.7 Beginner’s Guide [Book]