SED3/Hello World

From Serious Sam Wiki
Jump to: navigation, search

This tutorial explains how to create a very simple world with basic texturing and lighting.

Navigation

If you have previous experience with moving around in Serious Editor 1/2/3, you can skip this section. Otherwise, you should remember these shortcuts:

  • To move your view, hold down Space and:
    • Double-click LMB to some point in the scene will "teleport" your current view focus to observe that point.
    • Hold down LMB to move your view left/right/up/down with the mouse.
    • Hold down RMB to zoom your view closer/farther to the current focus point.
    • Hold down LMB+RMB to move your view with the mouse (orbiting around the current focus point).
    • Hold down Space+Ctrl and double-click LMB or RMB to focus some point and at the same time zoom in/out.
  • Press Esc to toggle "Fly Mode" in which you move around with FPS commands:
    • Mouse to look around,
    • W , S , A , D to move forward/backward/left/right,
    • Space , F to move up/down,
    • mouse wheel to change movement speed.

The Floor

Empty floor
  1. From the menu, select File>New>World
  2. Point at the middle of the grid and press Insert key to insert a Static Model entity under mouse pointer. It will appear as a green box. This symbolizes an empty mesh.
  3. Press Shift+E, then E (or alternatively double click on the green box) to enter "Mesh Editor".
  4. Press Shift+X to start the "PrimitiveBox Tool", then click and drag across the grid to create a floor polygon.
  5. Press Q to show the "Tools" panel.
  6. In the dialog, unfold Box Guide and inside it then Box Center and Box Size. Set the x,y,z values for center to 0,0,0 and width,height,length for size to 16,0,16.
    Important:  Make sure to press Enter to confirm the values, and then Esc to release focus to the mouse pointer!
  7. Press ~ (the "tilde") key to accept the box and drop the tool.


Texturing

Textured floor
  1. Roll the mouse wheel down twice until "Shader" rendering mode is selected (in the second drop down at the top left of view window). Since there is no texture yet, the floor appears as flat gray with wireframe on top of it.
  2. Point at the floor and Ctrl+Alt+LMB click on it. It should show the "Layers" panel and automatically unfold Polygon maps>Default.
  3. Edit the "Default" polygon map property in the Layers panel. (By clicking on the "(none)" label on the right of the "Default" polygon map.) Pick New>ShaderPreset from the menu.
  4. Add new configuration. (By clicking on the small yellow plus sign on the right of the "Configurations[0]" property.)
  5. Edit the "Shader" property. Browse for the "Standard" shader.
  6. Under the shader's "base texture" property, browse for this texture "Content/SeriousSamHD/Textures/Generic/Ground/StoneTiles_CM.tex".
    Hint:  while browsing for textures (or models), you can point at a file in the file browser and hold F3 to see a preview.
  7. Under the shader's "base uvmap" property, select "Texture" from the drop down. You should see the texture now. (To have a texture visible, you need both a texture file and a UV map.)
  8. Set the "base stretch U" and "base stretch V" both to 10, to make the texture tile more (the floor is 16 meters big, so the stones should appear smaller).


More Architecture

An additional box
  1. Press E to exit from Mesh Editor back to the World Editor.
  2. Point on the floor and press Insert to add one more Static Model entity. Use the 'Q' shortcut to invoke Tools panel and reposition the new entity to 0,0,0.
  3. Enter mesh editor with the new entity and use the PrimitiveBox Tool to create a box sized 4x4x4 meters positioned at 0,0,0.
    Note:  The mesh coordinates are in world space, so in this you want to keep the new geometry near the entity's handle, or otherwise you'd create an entity that behaves "off-center" when rotating.
  4. Repeat the texturing steps above to give it the same texture as the floor. This time you will need much smaller UV stretch (2,2 will be ok), because the object is smaller at UV map is fitted to the object size by default. (You can recreate any uv map differently if you like - see SED3 UV Mapping ).
  5. Press Ctrl+A to invoke the "Align To Origin" tool align the box's mesh so it doesn't protrude through the floor. (The default settings do exactly that.)
  6. Exit back to World Editor, and use Ctrl+LMB to "teleport" the new entity to some other place on the floor.


Sun

Shadows from the Sun.
  1. Press Alt+3 to show the EntityList panel.
  2. Find the "Distant Light" entity (it's in the "Lights" folder). Drag-and-drop it to the world. The world will now become mostly black. This is normal - without any lights engine shows all objects as "full bright". Now that a light is in, it has to be tuned to give proper lighting.
  3. Press Y to activate View From Selection tool. You are now viewing from the light.
  4. Enter "Fly Mode" to move the object you are now viewing from (the light).
  5. Fly backwards and up, while rotating left and down, until you have the entire floor inside your view, viewing it from diagonally from above.
  6. Press Esc to exit the "Fly mode" and ~ to drop the View From Selection tool.
  7. Press J to activate the Rendering options menu and make sure that "Dynamic Shadows" are enabled.
Notice that the shadows are pitch black. That is because there is no ambient on the scene. The best way to get a realistic ambient is to bake Global Illumination (GI) solution lightmaps.


Lightmaps and GI Solver

With GI bounces from the Sun.
  1. Select the box entity and enter Mesh Editor.
  2. In the lower right part of the view there are buttons "VM", "PM" and "LM" (meaning Vertex Maps, Polygon Maps and Layer Maps). Make sure that "VM" is pressed.
  3. Further right, there are buttons "M", "W", "T" and "C" (meaning Morph, Weight, Texture and Color). Make sure that "T" is pressed.
  4. Press Num 8 to show its UV map. There is only one square there, because all six faces are mapped to the same area of the texture. (Since no texture is selected in the drop down to the right, the only available UV map - the default one named "Texture" is shown.)
  5. From that drop down, pick Actions>Create New Vertex Map... The Mapping tool dialog will appear.
  6. Select the "Atlas" tab in the dialog.
  7. Type "Shadow" in the "Target UV Map" box and hit OK. You have now created an UV map used for lightmaps on that object.
  8. Exit to the world editor and repeat the same process with the floor.
  9. Exit to the world editor. Press Num+6 to switch back to the normal rendering preset.
  10. Select both objects (the floor and the box) by holding Shift and clicking on each of them.
  11. Make sure the Entity panel is visible (Toggled with Alt+1). You are now editing both entities at the same time.
  12. In the Shader Modifiers property, add a new modifier of type "CLightmapOvenModifier".
  13. For its "Size U" and "Size V" properties type 256 and 256. (Make sure you do Enter to confirm and Esc to release focus.)
  14. Deselect the entities. (Just so that the blue selection overlay doesn't obscure the view.)
  15. Press Alt+G to invoke the GI Solver baking parameters.
  16. Leave all parameters at default and just hit OK.
  17. A progress bar will appear at the very right-bottom corner of the entire editor application window. When that is done, you will have GI lightmaps on the world!


There is now some ambient from light bounces of the sun, but background influence is missing.

Background

Background generated by SkylightGenerator, and its GI influence.
  1. From the Entity list window (Alt+3) find "Geometry/Cube background" and drag-and-drop it to the world.
  2. Using the Tools panel (Q) position the background somewhere far below the world (e.g. 0,-1000,0)
  3. Using the Entity panel (Alt+1) add a Skylight Generator to the background.
  4. Press Shift+B to bake the current settings of the Skylight Generator into the background (defaults are fine).
  5. Adjust the "Modulator" values for the background to 0.05.
  6. Press Alt+G and then OK to bake the GI solution with background included.


Decorative Objects and Light Probes

Dynamic object with a probe
  1. Insert another Static Model entity somewhere on the floor.
  2. For its "Model" property (using Alt+1 Entity panel), browse the following model: Content/SeriousSamHD/Models/SouthAmerica/TwoHeadSnake/Snake.mdl .

Notice that the model is darker than the surroundings. This is because it doesn't have a lightmap, so it cannot receive GI influence. Dynamic models must receive GI influence through so Probe Light entities:

  1. From the Entity list window (Alt+3) find "Lights/Probe light" and drag-and-drop it to the world.
  2. Using the Entity panel (Alt+1) make sure that its Size property is set to something large. 100x100x100 will be enough.
  3. Press Alt+G and then OK to bake the GI solution with the probe. GI solver will generate a lighting cubemap at the probe's position which will be used by dynamic objects.


Testing

The final result in test-game.
  1. Press T to enter test-game and play around on the level.
  2. When done, press Esc to exit test-game.


Making the content appear in the game

Important:  To use the custom content, users must choose "Play moddable version" when launching the game.

In order for levels and player models to appear in the game, they need to have matching .nfo files. These are plain text files describing name as visible in the UI, thumbnail etc. Examples of such .nfo files can be seen inside offical .gro files. In the current version, the automatic .gro creator tool doesn't include those files, nor their dependencies (e.g. thumbnails). You need to manually add those to your .gro files fter they are created by the tool.

Take special note of the fact that a level (world) will only appear in the in-game UI if the following conditions are met:

  1. The level is inside a folder of an episode, and that episode has its own .nfo file, and
  2. The level is marked with
    LOCKED="No"
    in its .nfo file.

If you are creating a new episode, make sure you create a .nfo file for the episode, and mark at least the first level as unlocked. (If your levels are connected, then others will be unlocked as the player plays through.)