Setting up an environment inside ludiloom is not that hard. The platform provides a set of tools that make the task of building a game environment easy and fun! In this tutorial we show the generic steps required to create an outdoor environment and change the sky, lights, fog and shadows. We started with a basic terrain. Check out How To Edit The Terrain.
Contents |
Sky
There are three sky methods that can be used and combined to create the skies: Sky Box, Sky Dome and Sky Plane. This is configured in the Environment Sky Editor. To open this editor, click Tools >> Environment Sky Editor from the ludiloom main menu (press ESC).
Find more information about said editor here. Every functionality available in this graphical editor has a corresponding scripting function in the ludiloom API, and you can find them here.
Sky Box
You can define the surroundings of your arena as if it was inside a box. With the right set of images, the effect is pretty amazing while consuming little resources. It's the first sky method in the Environment Sky Editor. To start, check the box Enable Sky Box:
This editor shows six squares, each one representing an inside face of the box. Click on one of those squares, the Library Explorer will appear so you can choose a texture for that face. If you subscribe the Media Library Default Media Library you will find two sky box image sets, one for a desert and another for a snowy environment. Search for the word "sky" in the Library Explorer like this:
In this picture, we are drag-and-dropping textures to the box, which is a much faster way to define the box.
The top image is the Media Item sky_desert_2_4. Then from left to right, sky_desert_2_3, sky_desert_2_0, sky_desert_2_1 and sky_desert_2_2. The image in the bottom is sky_desert_2_5.
In the end, you should end with something like this:
Sky Dome
The sky dome puts the arena inside a half sphere. You can configure a material with a texture to cover the dome. Since the dome is round, the texture will be deformed, so you should stick to textures that take this factor into account, and that are also repeatable.
Open the Material List and press New Material From Template. Select the texture sky_desert_2_4 like this:
Select that material and configure it:
Sky Plane
The Sky Plane is an infinite plane always above the arena. You can configure a material to it. In this tutorial, we will use the sky plane to draw clouds moving in the sky. First, let's create the material.
Open the Material List and press New From Blank Template.
In the Material Editor, click on the (+) button in the technique list to create a new texture unit named sky:
In the technique list click on the pass and make the following changes:
- Deactivate the Depth Write.
- Change the blend type to Transparent Alpha.
In the technique list click on the texture unit sky and make the following changes:
- Select the texture transparent_clouds.
- Activate Scroll X and select Sawtooth.
- Set the Freq/s to 0.1 and Amp to 1.
In the end, you can combine the clouds with the sky box:
Or with the sky dome:
Light
In this tutorial, we are creating an outdoor environment. Now we will introduce a sun light. Create a light in the Arena, by right-clicking in the Arena object in the tree >> new >> Light:
You will see the Light Editor. Set this light's name to sun. Change the direction to (1,-1,1), so we can see the shadows projected (later in this tutorial).
To create and change lights through scripting, check the ludiloom API here.
Probably the light didn't make much difference in your scene. That is because the ambient light is too strong and every object in the game environment is already being completely illuminated. We have to make some adjustments in the Environment Light Editor. To open this editor, click Tools >> Environment Light Editor from the ludiloom main menu (press ESC).
If you reduce the Ambient Light a bit, for instance (91,91,91), some shadows will start to appear on the terrain, as you can see in the next image:
Fog
The fog tool can add much to the game environment. You can simulate the morning mist, smog, thick darkness, desert dust, etc.. You can change the colour of the fog and the type of fog: linear or exponential. These and other options are best understood by messing with the sliders on the Environment Light Editor than by explaining in text, so knock your self out! Also, you can find more detail about this editor here.
Here is an example of fog:
By changing the fog's colour, you can create different effects. This is thick darkness:
The exponential fog may provide better visuals in the distance:
You can change the distance of the sky box, sky dome and sky plane. That is something you probably will want to adjust when you create the fog because sometimes the fog hides the sky completely or makes the corner of the sky box noticeable.
Shadows
The last part in the Environment Light Editor is the shadow editor. There are three shadow techniques you can choose from: Stencil, Texture and Depth Mapping. In an outside environment, probably the best option is to use texture shadows.
You have to adjust the different options to obtain the best performance and quality possible. You can see the frame rate by pressing alt + F1. When using texture shadows, it's very important to set the Draw Distance to a value as low as possible. We added some elements from the Media Library Ogre Media Library to the scene and this is the result:




















