In this tutorial part, I'll show you how to create a complete 3D level composed of both Lumberyard internal assets and imported new ones.
Then, you'll learn how to place both the player and the camera, and how to use several entities, creating prefabs and textures. Finally, you'll be introduced to Lumberyard lighting.
Who Should Read This Tutorial Series?
This tutorial series is primarily aimed at two groups of game developers:
- those who are completely unfamiliar with game engines at all
- those who are familiar with other game engines (such as Unity, Unreal Engine, or Cry Engine), but not with Lumberyard
I assume that you have some knowledge of computer graphics notation, so I won't exhaustively cover all notations.
Create a New 3D Level
Launch Lumberyard and click on New Level. Use the following data in the New Level interface.
- Name: CompleteFirstLevel
- Folder: Levels/ (default value)
- Use terrain: checked!
- Heightmap Resolution: 1024x1024
- Meters Per Texel: 1
Note that all levels are saved by default at: YourLumbaryardInstallationpath\dev\SamplesProject\Levels.
For the terrain texture, use:
- Resolution: 4096x4096
- Terrain Color Multiplier: 3
- High Quality: checked!
In order to game play your level, you must create and place a game camera. Then you need to modify it to enable character control and specify a starting point. Fortunately, Lumberyard provides a prefab object that has a gameplay camera with supporting input controls.
The camera can be found in the Database Editor, under View > Open View Pane.
You can also find the Database Editor in the EditMode Toolbar.
The database view tabs (red rectangle) provides access and configuration for several database types. The editor toolbar (green rectangle) gives you access to tools such as Open, Save, Add, or Remove items from the database. Finally, the FileTree View (blue rectangle) gives you access to the database items available.
In the Database View, open the Prefabs Library and click Load Library.
From the prefabs directory listing, select character_controllers.xml and click OK.
From the Prefab Library file tree view, drag Sphere_Controller into the Perspective Viewport.
Now you should have one robot lying on your level waiting for testing. Note that the location where you place it also determines the start point of the level. Save your level file (File > Save).
If you click on the Gizmo, you can see the complete prefab properties. If you can't see the Gizmo, then you need to click on the H icon in the Perspective Toolbar.
You should note that, by default, you cannot modify any prefab entity property. However, if you select the Gizmo, and then click on Open All under the Rollup Bar > Prefab Parameters, you will now have access to each prefab entity and its properties.
Click on the Camera Controller Rig entity to inspect its Camera Params.
It is now time to test your new game camera. Click on Game > Switch to Game or press Control-G.
Add a Camera
There are several scenarios where you intend to have custom cameras or even static cameras. For that, Lumberyard provides you access to the camera entity. There are two major ways to add a custom camera:
- using the RollupBar
- using the current Perspective viewport configuration
The former uses the entity Camera available at Objects > Misc > Object Type > Camera. You just need to select the Camera entity and then place it in within your Perspective viewport.
The latter uses your current view position so that the new camera will also use that same configuration. Place Perspective viewport in the desired positioning (for example looking at the robot). Right-click in the upper left corner of the Perspective toolbar, and click Create Camera from Current View. The current view from your Perspective viewport is now a fixed camera from that position.
Now, navigate away and notice the new camera entity looking for your last Perspective Viewport configuration.
One way to place objects is by using brushes (RollUp Bar > Objects > Brush). Brushes are normally static objects placed within the 3D scene. They are cheap to render since they don't contain extra properties of an entity or physics properties.
In the Rollup Bar on the right, select Brush in the Objects tab. Under the Browser heading, open Objects > StyleTown > Natural > Terrain and select the object townbloc. Drag it into the Perspective viewport.
From the Brush list, open StyleTown > Architecture > Buildings. Drag the b13_h02 building into the Perspective viewport and place it near one corner of the townbloc.
Now you know how to place brushes in your level.
Importing External Objects
To import external objects, Lumberyard advises you to use the FBX file format. The current importer is still in preview release and some features like materials are missing.
The Lumberyard FBX Importer tool incorporates a scene graph, which is a tree-based layer of data between your .fbx model and Lumberyard. Every time you process a .fbx a new .scenesettings file with the same name is created; this new file stores the asset metadata.
If you change the mesh properties of the model, you don't need to re-import the .fbx file. Lumberyard Asset Processor listens and detects any changes to the .scenesettings file and uses the Resource Compiler to reprocess the .fbx file.
Let us proceed and download one external FBX file. Extract the compressed file you just downloaded and move the Wooden_House.fbx into YourLumbaryardInstallationpath\dev\SamplesProject\.
In Lumberyard Editors, select View > Open View Pane > FBX Importer.
Click the folder icon at the upper right of the tool window.
Select the Wooden_House.fbx file, and click Open.
Change the Name property to Imported_Wooden_House and click Import.
After a few seconds, you should see the success message window.
One last step must be performed before you can use your new asset. Under the RollupBar > Geom Entity, click Reload. Then a new folder should appear. Open it and you should have the imported_wooden_house model available.
Finally, drag the model into the Perspective viewport.
You should now add some brushes by yourself. Your next task is to create a 3D level similar to the following one:
When you finish the level creation, move to the next section. Note that you don't need to create a 3D world exactly like the previous one. The main idea is to add several brushes and interact with them (rotating, translating, and scaling).
Prefabs enable you to create content more quickly using a combination of pre-defined assets. To use previously created Prefabs, open the Database View (View > Open View Pane).
Under the Prefabs Library tab, click on Open. Select the styletown.xml and click OK.
Now open the RollupBar and under Prefab you should now see the imported NeighborhoodBlock Prefab.
Select and drag the three assets (StreetSet_A, Block_A, and StreetLight_A) into the Perspective Viewport. You should have something like the following image.
Lumberyard enables you to generate, edit, and texture a terrain in your level. For that, you must always have in mind three menus:
- Terrain Texture Layers
- Material Editor
- Terrain editor (in RollupBar)
To open the Terrain Texture Layers, you can use the main menu View > Open View Pane > Terrain Texture Layers or the shortcut available in the Editor Toolbar.
Open the Terrain Texture Layers.
The Terrain Texture Layers interface is used to define the materials that will be used to paint your level terrain. There are four main sections within the interface:
- Layer Tasks is used to add, delete, move, and assign the selected material to the selected layer.
- Layer Info contains information regarding the selected layer, such as the size and surface type.
- Layer Texture displays a low-resolution texture containing its color information.
- Layer list contains a list of created layers for terrain painting.
Under the Layer Tasks, add two layers. Name the first one grass and the second dirt.
Open the Material Editor using View > Open View Pane > Material Editor or the shortcut available in the Editor Toolbar.
You will notice that you will have two windows (Terrain Texture Layers and Material Editor) or a single window with a tab separator in the bottom left side.
The Material Editor is composed using the following areas:
- Editor toolbar for applying, deleting, creating, and saving materials
- Material Preview that displays the selected material
- Material folder directory displaying a hierarchical folder structure containing materials which can be chosen
- Properties containing parameters that define the overall material appearance
It is now time to assign two materials to the aforementioned created layers. For the first one, select the material gr_grass_01 located in the directory path: materials > gettingstartedmaterials.
Now change the interface to the Terrain Texture Layers and select the grass layer. Click Assign Material. That action will apply the selected material to the selected layer. Note that the Material path has changed accordingly to material > gettingstartedmaterials->gr_grass_01.
Now, let's add the ground material (gs_ground_01) into the dirt layer. This material is also located within the same folder.
- Select the gr_ground_01 material.
- Change the interface to the Terrain Texture Layers.
- Select the dirt layer.
- Click Assign Materials.
You are now ready to paint the grass and dirt textures onto the terrain.
In the RollUp Bar, select the Terrain tab, and then select the Layer Painter button.
There are several aspects that you should consider when you apply your terrain texture: the Radius and Hardness properties; the Color and Brightness of the texture; the texture itself; and the type of fill (mouse-based or Flood-based). The former will apply the texture using your mouse position, while the latter will apply the texture to the whole ground.
Select the grass texture and modify the Color to a more green tint. Click OK.
With the grass layer selected, click on the Flood button. The terrain is now covered in the grass texture and looks similar to the following one:
You can now paint some dirt into the scene around the perimeter of the street. Select the dirt texture and modify the Color to a brown one. Click OK. Now, using the Perspective viewport, zoom in on your 3D scene and with your left mouse button, click to add the dirt texture.
Modify the Radius and Hardness to reduce the time of applying the texture. When you are finished, you will have a 3D level similar to the following:
You can also modify your terrain height using the Modify terrain tools.
The Modify terrain tool-set features the following options:
- Flatten: Flatten the terrain to the designated height setting
- Smooth: Soften the terrain down to a smoother surface
- Rise/Lower: Raise or lower the terrain based on brush size settings
- Pick Height: Find and set heights based on existing terrain geometry
- Outside Radius: Set how big your brush is when painting
- Inside Radius: Set how round or flat the brush is in relation to the outside radius setting
- Hardness: Soften or harden the outer brush settings
- Height: Set the brush height
- Scale: Strength of the noise effect; higher values produce more noise
- Frequency: How often the effect is applied
Let's use the aforementioned options to create some mountains inside your 3D level. Select the Rise/Lower button. Note that your mouse cursor inside the Perspective Viewport has changed.
In the Perspective Viewport, navigate towards the outer perimeter of the terrain map and left click to paint on the terrain. Build some hills of different sizes and shapes. In the end, your scene should now look something like this:
If you want, you can play with the terrain properties, namely the Flatten, Smooth, and Pick Height options. When you are satisfied with the terrain generator, save your level (Control-S).
Now that you've almost concluded the 3D scene, it's time to add some illumination to it. In Lumberyard, you can add three types of lighting:
- Environment Probes
- Time of Day
- Basic Lights
Before placing single light objects into the scene, it's always good to start with the default global environment probe. Environment probes are great to achieve global ambient lighting because they contribute to reflections, diffuse materials, particles materials, and shadow colors.
When building a level, you are advised to place multiple environment probe groups to achieve high quality and realistic scenes.
To create the environment probe, select the EnvironmentProbe in the RollUpBar under the Misc option. Move the mouse cursor into the viewport and place the environment probe wherever you want.
You normally want to put your probe in the center of the level and then configure its BoxSize to fill the desired area.
Under the EnvironmentProbe Properties section, you want to change the BoxSizeX, BoxSizeY, and BoxSizeZ to 512, 512, and 250 accordingly. If you zoom out of the scene, you should have a yellow box covering the scene.
Note that these values may not produce the same result in your scene. Thus, you should adjust them to recreate the desired effect.
At this point, the scene has not really changed in terms of lighting because the lighting probe is turned off by default.
To activate the probe, check the box in the Active options under the EnvironmentProbe Properties and then click on the Generate Cubemap button under the Probe Functions.
You should notice that the shadows will be softer.
You can further customize the environment probe by changing the Diffuse and DiffuseMultiplier value. The former represents the probe color, while the latter represents the intensity multiplier between that color and the scene materials properties.
Time of Day
You can control the time of day (TOD), and you can even animate your scene, taking into consideration the real time of day variation values. In order to set the TOD, you must open the TOD editor. Again, you can open it using View > Open View Pane > Time of Day or the shortcut available in the Editors toolbar.
The TOD editor has seven main areas:
- Editor toolbar has icons for importing, saving, and setting specific hours of the day.
- HDR Settings to adjust the HDR lighting.
- Tasks to configure basic functionalities of the editor.
- Time defines the current time for the level. This also includes the start and end time if you want to animate the lighting.
- Update Tasks allows you to play or stop the animations.
- Time line editor gives you control over the light settings during a 24-hour period.
- Parameters give you more options to configure the lighting properties.
Let's import a predefined TOD .xml file. Click Import file and navigate to SamplesProject\Levels\GettingStartedFiles, choose the TimeOfDay file, and click Open. The lighting settings will be changed automatically.
You can further customize the TOD properties as you want. Play with the Sun color, Sun color multiplier, and Sun intensity to see the differences.
Change the TOD to 9:00 PM before continuing. Close the TOD editor.
Your scene is now darker. It is now time to add basic lights. In the RollupBar, on the Objects tab, select the Entity button. Under the heading Browser, expand the folder Lights and select the Light object. Drag it into your scene and place it near one of the streetlamp objects.
Note that, if you encounter any problem precisely aligning the light, you are advised to turn on the Snap to Grid option.
Because the light source is a streetlamp, it should be a spot light (rather than a fill light). To change the light from fill to spot: Beneath the header Entity Properties, find the title Projector. Select Texture, and then click the folder icon.
Now open the directory \SamplesProject\textures\lights\generic and open the spot_075.dds file.
The light changes to a spotlight, but it is oriented sideways. Use the rotate tool to select and rotate the light so that it points down.
Beneath the header Entity Properties, you can modify a variety of settings to customize the light.
- AttenuationBulbSize is the light bulb size; this is the starting point for where light begins to fall off exponentially. A value of 1 sets the light at full intensity for one meter before it begins to fall off. Adjust this size in relation to the diffuse multiplier to manage the brightness of the light source without entering unmanageable numbers.
- Radius is the distance from the source at which the light affects the surrounding area.
- Diffuse represents the RGB color value of the light.
- DiffuseMultiplier is the intensity of the diffuse color; balance this value with the AttenuationBulbSize to define the balance of natural light levels.
- ProjectorFov represents the field of view for the projection light.
- CastShadows makes the light cast a shadow based on the minimum selected configuration specifications. To ensure shadows are always cast, set this to 'Low Spec'. Note that the CastShadows setting is not a 'quality' setting but rather a performance specification setting for the type of machine running the level.
For this tutorial, use the following settings:
- AttenuationBulbSize = 6
- Radius = 20
- Diffuse Color = 228, 224,102
- DiffuseMultiplier = 20
- ProjectorFov = 80
- CastShadows = Low Spec
Experiment with these settings to get a feel for how the differences between bulb size, radius, and diffuse multiplier change based on the input values you use.
Run the game (Control-G) and see how your character behaves when in contact with the new light source. For each streetlamp, add a new light. You can do it by duplicating the current light or adding ones.
In order to test the knowledge acquired so far, you are now challenged to recreate the getting-started-completed-level.
For that, you will need to play with the brushes, lighting, materials, textures, and terrains. In short, re-apply everything that you've learned so far. Your final level should look like the following:
This concludes this tutorial on Lumberyard. You learned how to configure the camera and player positioning, and you learned how to import external assets and place several entities, creating prefabs and textures. Finally, you were introduced to lighting properties.
If you have any questions or comments, as always, feel free to drop a line in the comments.
Subscribe below and we’ll send you a weekly email summary of all new Game Development tutorials. Never miss out on learning about the next big thing.Update me weekly
Envato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!Translate this post