ambiera home ambiera home

irrEdit Tutorial - Getting started

This tutorial has been written and kindly made available for us by Daryl Lee.


Getting Started with IrrEdit

Never used a world editor before? Neither had I! This tutorial started life as notes taken by a wanderer through the new world of 3D map editing. Follow along and we'll learn together.

Quick tour

The first thing to do after downloading and installing IrrEdit is to fire it up and see what you have. You have a menu bar, a couple of toolbars to make things efficient for you, and then an assortment of windows. We'll walk through the windows one at a time.

Viewports

The big window in the middle of the screen is the perspective viewport. It's where you see your virtual world from a point of view inside the world. The first time you run IrrEdit, there will be a box (crate, if you prefer) inside a sky box. Now take a quick peek at the window to the upper left, the Scene graph. Guess what? A "testCube" and a "startup skybox." Relieved? I was.

You can add more viewports. It's often helpful to view your world in what my high school drafting instructor called "orthogonal views." He called them that because that's what they are. So pop up to the View menu and click Add Viewport-->Top. This will give you a small window looking down on the box. For my tastes, it's kind of annoying to see it floating around like that, so I docked the view by sliding the window over the toolbar area and it docked into place just beneath. Repeating the process with left and front views gave me this:

.

Notice that the viewports are named, so you don't have to remember which one is where.

Another option is to not have all the orthogonal views open at once, and just switch the main viewport among Perspective, Top, Front, and Left. The first four buttons on the lower toolbar do just that for you. Try it.

SceneGraph Explorer

Without going into huge detail as to what a "scene graph" is, just understand this as a structured view of all of the graphical components in your scene. The key thing is that clicking on an item in the SceneGraph Explorer selects the item in the viewports and draws a light green border around it. This can be very handy. Also handy is the fact that double-clicking on the object in the explorer centers the current viewport on the object, making it easy to find in a potentially crowded scene.

Properties

The Properties window, just below the SceneGraph Explorer, gives all the gory details for the selected node in the scene. To see this, select "testCube" and "startup skybox" and see the properties change.

Light Mapping

This window gives details on the lighting used in the scene. It's beyond the scope of this tutorial to go into detail; I only wanted to mention it so you'd know I hadn't overlooked it.

Message Log

Now notice the window in the lower left corner. The first line will tell you what version you have; I have 0.6. The second line tells you what version of IrrLicht Engine is used. IrrLicht is the 3D rendering engine that you are probably interested in using once you have your game or other app designed. Finally, there are some startup scripts listed.

Textures

Just to the right of this is a textures sampler. There are a few defaults, but adding new ones is trivial. Click the texture window's "add" button and browse to IRREDIT/textures/fx/sprites and select redparticle.bmp. At the right end of your textures sampler, you'll see this:

Also notice that you got a note in the Message Log window that you succeeded at that.

Window management

Notice that all of these windows have close buttons. You can close all but the main viewport. If you want them back, or just some of them, use the View menu and click whichever of the "Show ..." items matches the window you want. Small caveat: the Message Log window is called the Output Window on this menu. Even quicker than the Menu is the series of toolbuttons just to the right of the Save toolbutton. Float your mouse over them to see which windows the buttons are associated with.

Basic Operations

So now that you've had the cook's tour, let's see if we can change the world, shall we?

Modifying existing objects

Since IrrEdit started us off with a testCube and a startup skybox, let's see what we can do with them. That might shed some light on what we can do with things we add later.

Textures

Let's start by changing textures. Select testCube in SceneGraph Explorer, and in the Properties window select the Materials tab and scroll down to Texture1. Select the pathname in the right hand column, delete it, and press Enter. Voila! No texture!. Now lets add something in its place.

Just pick a texture you think might be interesting (the second one, default_billboard.png, suits my needs) and double-click it. There--you have a new texture on your testCube. You can see that in Properties by the thumbnail image and by scrolling down to Texture1 and noting the new path in the property.

One texture not enough? There is room for four. Just select the texture of interest in the lower right, click on the thumbnail slot you want it in, and then notice the TextureN property, where N is the number of the slot you selected.

Shape manipulation

So maybe a cube isn't for you. Maybe you'd like more of a shoebox shape. Make sure the testCube is selected, and then click the toolbar button that looks like a cube with arrows coming out of the faces. That's the Scaling tool. Scaling handles will appear in the viewport, and you can drag them to change the shape of your box. What could be easier?

Entity location

Pretty quickly, you'll discover that when entities are added to your scene, they are added at the origin. We'd like to add another entity now, but the two of them would be in the same place (never mind what your high school physics teacher told you about two objects in the same place at the same time!). So lets move the box out of the way to make room for a sphere. Click the toolbar button that looks like a plus sign made out of arrows. The handles change and allow you to move the box anywhere.

Entity orientation

Finally, click the toolbar button that is an arrow bent into a circle. Select the cube, and axis indicators will appear. To rotate the cube around one of the axes, click and drag (try to drag) the axis in a direction perpendicular (orthogonal, if you prefer) to itself. This well cause the cube to rotate about that axis. If you know the precise angles you want, you can edit the Rotation property, where the unit of measure for angles is degrees.

Add an entity

IrrEdit has implemented several different types of entities you can add. They are all added pretty much the same way, so let's just add a sphere and then just mention the others.

After you've moved the testCube away from the origin, click the sphere toolbutton (you can find it by floating your mouse above the toolbuttons and reading the tooltip). You'll get a sphere at the origin without a name. Before you do anything else, name it! Click in the name property field and enter a name, something slightly cleverer than MyFirstSphere, like I did. When you press Enter, the new name will replace "(sphere)" in the SceneGraph Explorer.

Seeing the results

So you think you should be able to see your results in the game engine itself, eh? The easiest way to do that is to co-opt Example 15, which is the LoadIrrFile demo. Copy the entire textures folder from IrrEdit to the Example 15 folder in IrrLicht. (I may learn enough soon to have a better way of loading the textures!) Change the name of the file in the call to LoadScene so that it points to your saved scene, and you can view your scene by moving the mouse around. But before you do that, take a lesson from me. The original Example 15 did not provide an escape path. The mouse is captured and cannot move to the window close button, and no keyboard input is processed.

To give you a clean escape path, just make two simple changes (assuming you're in Windows; if not, YMMV).

1. Add

#include <windows.h>
to the top of the program where the other #includes are listed.

2. Change the while loop to

while(device->run() && !GetAsyncKeyState(VK_LBUTTON))

Now pressing the mouse button stops the "game" easily.