S&box Wiki

Revision Difference


<cat>Dev.Map</cat> <title>Creating your first gm_flatgrass</title> The purpose of this guide is to jump into Hammer and start creating something, in this case, we will be recreating **`gm_flatgrass`** step-by-step. For more documentation and tutorials on Source 2 mapping, refer to the [Mapping Resources Page](https://wiki.facepunch.com/sbox/Mapping_Resources). *`Note: This guide uses the version of Hammer that is included in Half-Life: Alyx`* <note> TO-DO: Add step or remake step a step to include removing unnecessary faces. </note> # Knowing your tools **'File' > 'New'** ( <key>CTRL</key> + <key>N</key> ) to open a new map and then **'File' > 'Save'** ( <key>CTRL</key> + <key>S</key> ) to save as *gm_flatgrass*. ## Selection Modes <upload src="314/8d90a75e4575d36.png" size="43404" name="image.png" /> From left to right we will be using the following modes: **Edges** ( <key>2</key> ), **Faces** ( <key>3</key> ), **Objects** ( <key>5</key> ) <upload src="314/8d90a7fff4f08da.gif" size="820392" name="CubeExample.gif" /> These three selection modes are the bare minimum to create this map, you can switch between them by pressing the number keys that represent their position. After picking the **Selection Mode**, you may also choose which **Tool** to interact with. ## Tools You can find tools on the left side, in this guide we will use the following: | Icon | Tool | Description | |:-------------:|:-------------:|:-------------:| | ![](https://files.facepunch.com/wiki/files/1a832/8d90bf5906f9260.png) | **Selection Tool ( <key>⇧ SHIFT</key> + <key>S</key> )** | Select geometry elements, objects and groups. You can also use this to resize them. | | ![](https://files.facepunch.com/wiki/files/1a832/8d90bf60b4a1a43.png) | **Move Tool ( <key>T</key> )** | Move your selection along the X Y Z axes. | | ![](https://files.facepunch.com/wiki/files/1a832/8d90bf663711719.png) | **Rotate Tool ( <key>R</key> )** | Rotate your selection along the X Y Z axes. | | ![](https://files.facepunch.com/wiki/files/1a832/8d90bf680080886.png) | **Entity Tool ( <key>⇧ SHIFT</key> + <key>E</key> )** | Place any type of point entity such as: player spawns, AI spaws, logic entities, props | | ![](https://files.facepunch.com/wiki/files/1a832/8d90bf68fed02fc.png) | **Block Tool ( <key>⇧ SHIFT</key> + <key>B</key> )** | Create basic geometric shapes such as: Quad, Block, Cylinder, Spike, Sphere | | ![](https://files.facepunch.com/wiki/files/1a832/8d90bf6a5855e18.png) | **Clipping Tool ( <key>⇧ SHIFT</key> + <key>X</key> )** | Slice geometry, cuts must be made in the 2D viewport and confirmed with **ENTER.** | See also: https://files.facepunch.com/wiki/files/314/8d90a83c8940111.png ## All of the rest Crash course on everything else we will be using on this guide and a short description. I suggest you look at [this video tutorial](https://www.youtube.com/watch?v=HrfsfgYpYN0) to help with the layout. <upload src="314/8d90a86169ab3d9.png" size="359908" name="Remaining Stuff.png" /> * **Object Editing**: Depending on the **Tool** and your **Selection Mode**, this section will have different options to interact and modify the selected geometry. * **Compile & Play**: Opens the compile tool to run your map, use Fast Compile while working. * **2D Viewport**: Shows an [orthographic](https://en.wikipedia.org/wiki/Orthographic_projection) view of the map from any direction. You can shift views by pressing Top ( <key>F2</key> ), Front ( <key>F3</key> ), Side ( <key>F4</key> ) * **Assets Window**: Props, Materials, Prefabs etc... You can drag and drop from the **Asset Browser** that opens when running the workshop tools as well. * **Object Properties**: While having an object or **point entity** selected you can modify its scale, position, rotation, and any properties it might have. * **Grid Settings**: When moving or resizing an object, it will snap to the smallest amount of units you have selected. Most of the time we will use **64**, **32**, **16**, and **8** units. <key>W</key> <key>A</key> <key>S</key> <key>D</key> to move the camera in the viewports, <key>Scroll</key> to Zoom-in/out and hold <key>Right-Click</key> to rotate. --- # Making the map step-by-step ## Step 1: With the **Block Tool** ( <key>SHIFT</key> + <key>B</key> ), select **Quad** in the **Object Editing** window, make a plane that is *2048x2048* units. The bigger your map is, the longer compiling takes, so for now we'll keep it small and enlarge it when we're ready to finalize. <upload src="314/8d90a8c729cf228.png" size="910081" name="image.png" /> You can use the **Object Properties** to center the plane in **X: 0; Y: 0** ## Step 2: With the **Entity Tool** ( <key>SHIFT</key> + <key>E</key> ) selected, from the **Object Editing** window place the **Player Start**, **Sky**, and **Environment Light**. Make sure to rotate the light having the arrow face down using the **Rotate Tool** ( <key>R</key> ) <upload src="314/8d90a8d6cba4512.png" size="447667" name="image.png" /> ### Step 2.5: Slap a grass texture on the plane and do a **Fast Compile**, if all you wanted was a literal flatgrass then you have finished the tutorial. ## Step 3: With the **Block Tool** ( <key>SHIFT</key> + <key>B</key> ), select **Cylinder** in the **Object Editing** window, make a cylinder that is *512x512* units and has *64* sides, place it in the center. <upload src="314/8d90a8ed3e90fc7.png" size="825083" name="image.png" /> ## Step 4: With the **Clipping Tool** ( <key>SHIFT</key> + <key>X</key> ) and working in the **2D Viewport**, slice the cylinder in half by pressing <key>ENTER</key> to confirm, then slice in quarters. <upload src="314/8d90a8f8be3894c.png" size="951295" name="image.png" /> In the **Object Editing** window remember to have the third **Keep Mode** selected. ## Step 5: While in **Objects Selection Mode** ( <key>5</key> ) use the **Move Tool** ( <key>T</key> ) to separate the sections an equal distance from each other. <upload src="314/8d90a90de6709c7.png" size="937315" name="image.png" /> ## Step 6: While in **Edges Selection Mode** ( <key>2</key> ) use the **Selection Tool** ( <key>SHIFT</key> + <key>S</key> ) to select all the edges on the side which is missing a face of two opposite sections. To select multiple edges at once you can hold <key>SHIFT</key> while clicking on the edges. <upload src="314/8d90b45017a071b.png" size="735207" name="image.png" /> After you have all the edges selected like in the picture **Bridge** ( <key>ALT</key> + <key>B</key> ) them and, through the **Object Editing** window, select only *1* Step (Only 1 straight face will be generated) then press <key>ENTER</key> to confirm. Repeat on the other side. ## Step 7: Select the edges of the remaining faceless side by either **Double Clicking** or **Select Loop** ( <key>L</key> ) in the **Object Editing** window after selecting one of the edges. <upload src="314/8d90b46ca27add8.png" size="612829" name="image.png" /> **Fill Hole** ( <key>P</key> ) to cover the face, repeat on the other side. ## Step 8: While in **Objects Selection Mode** ( <key>5</key> ) select both foundations and use the **Selection Tool** ( <key>SHIFT</key> + <key>S</key> ) to make them taller by dragging the arrow facing upwards. <upload src="314/8d90b485e82e33f.png" size="817666" name="image.png" /> ## Step 9: Using the **Move Tool** ( <key>T</key> ) and while holding <key>SHIFT</key>, move both foundations up to clone them. <upload src="314/8d90b4971bbda77.png" size="525063" name="image.png" /> We will be using these clones to create the concrete slabs that separates the two foundations. ## Step 10: While in **Objects Selection Mode** ( <key>5</key> ) select both slabs and use the **Selection Tool** ( <key>SHIFT</key> + <key>S</key> ) to make them **shorter** by dragging the arrow facing downwards. I suggest changing the **Grid**'s *size* to a smaller value like *16*. <upload src="314/8d90b4d85c8d299.png" size="1203441" name="image.png" /> Using the **2D Viewport** to help, place the slabs on top of the bottom foundations with the **Move Tool** ( <key>T</key> ). While selecting one slab at a time, slightly make them larger on each side to create an overhang. ## Step 11: Using the **Move Tool** ( <key>T</key> ) and while holding <key>SHIFT</key>, move the bottom foundations up to clone them. Resize these new top foundations one-by-one to make them shorter and just a bit thinner on each side to accentuate the concrete slab's overhang. <upload src="314/8d90b5013dd1030.png" size="931565" name="image.png" /> While in **Faces Selection Mode** ( <key>3</key> ) select the inner 2 faces of the top foundations and **Delete** ( <key>DEL</key> ) them. These brick foundations will have a wide arch that connects them. ## Step 12: With the **Block Tool** ( <key>SHIFT</key> + <key>B</key> ), create a cylinder with 32 faces that is as wide as the top foundation's height (In my case they are *160* units). <upload src="314/8d90b50ff6d063f.png" size="986081" name="image.png" /> With the help of the **2D Viewport**, **Rotate** ( <key>R</key> ) the cylinder 90° and place it exactly in the center of the two top foundations. Using the **Selection Tool** ( <key>SHIFT</key> + <key>S</key> ) resize the cylinder to be exactly as deep as the top foundations. ## Step 13: While using the **2D Viewport** and the **Faces Selection Mode** ( <key>3</key> ), select the bottom half of the cylinder and **Delete** ( <key>DEL</key> ) it. <upload src="314/8d90b51e4f0c814.png" size="814787" name="image.png" /> **Delete** ( <key>DEL</key> ) the front and back faces as well. ## Step 14: While in **Objects Selection Mode** ( <key>5</key> ) select the half cylinder **Flip Faces** ( <key>F</key> ). <upload src="314/8d90b526a33429a.png" size="660015" name="image.png" /> ## Step 15: Using the **Clipping Tool** ( <key>SHIFT</key> + <key>X</key> ), cut the object in half and with the help of the **2D Viewport** **Move** ( <key>T</key> ) them close to the top foundations and on the concrete slabs just like in the picture. <upload src="314/8d90b52b84d46b3.png" size="880122" name="image.png" /> You might want to lower the **Grid**'s *size* for this, I've used *8*. ## Step 16: In **Edges Selection Mode** ( <key>2</key> ), select the arc's top opposing edges and **Bridge** ( <key>ALT</key> + <key>B</key> ) them. <upload src="314/8d90b53c571469f.png" size="805954" name="image.png" /> ## Step 17: In **Edges Selection Mode** ( <key>2</key> ), select the top foundation's upper edges and **Bridge** ( <key>ALT</key> + <key>B</key> ) them together. <upload src="314/8d90b549e447080.png" size="1050769" name="image.png" /> In **Objects Selection Mode** ( <key>5</key> ), select the top foundation and the two arcs and **Merge** ( <key>M</key> ) the meshes together. (**Reminder:** Hold <key>SHIFT</key> to select multiple objects) ## Step 18: While in **Edges Selection Mode**, select one of the edges belonging to the missing face and **Select Loop** ( <key>L</key> ) or **Double-Click** to include all of them. <upload src="314/8d90b55825e1fc7.png" size="1061881" name="image.png" /> **Fill Hole** ( <key>P</key> ) to create the missing face and repeat on the other side. <note>TO-DO: Change this step to avoid creating a n-gon. Extrude and stitch instead</note> ### Step 18.1: Step 18 will create what is known as a **'ngon'**, it is generally looked down by 3D Modelers as it may lead to problems with lighting, collisions, and subdivisions. While there is no proof that a flat static **ngon** in Source 2 causes any problem, we will show how to fix this. You may skip this step if you do not care about what other people think about you and your mapping skills. <upload src="314/8d914b65735df5b.jpg" size="217650" name="1.jpg" /> To help visualize the position of all vertices we need to **Toggle mesh subdivision view** ( <key>CTRL</key> + <key>SHIFT</key> + <key>F6</key> ). ### Step 18.2: In **Vertices Selection Mode** ( <key>1</key> ), select one of the top vertices and two bottom adjacent vertices. (Hold <key>SHIFT</key> to select multiple points at once) <upload src="314/8d914b6c3cd14cf.jpg" size="114297" name="2.jpg" /> **Connect** ( <key>V</key> ) them together, this will create a new face that has only 3 edges. ### Step 18.3: Here is a video to show the workflow, all of this can be done in less than 2 minutes if you have quick and steady hands. <upload src="314/8d914b81ec6b207.mp4" size="3173045" name="gm_flatgrass_fix.mp4" /> <upload src="314/8d914bf36d4c1f6.mp4" size="2052866" name="gm_flatgrass_fix_speedrun.mp4" /> You can check if you finished by going into **Edges Selection Mode** ( <key>2</key> ) and sweeping the face to compare the mesh. ## Step 19: Duplicate the first two concrete slabs with the **Move Tool** ( <key>T</key> ) in **Objects Selection Mode** ( <key>5</key> ) and place them on the top brick foundation. <upload src="314/8d90b562f501e87.png" size="943464" name="image.png" /> Select the two inner faces in **Faces Selection Mode** ( <key>3</key> ) and **Delete** ( <key>DEL</key> ) them, then select all edges of the missing face in **Edges Selection Mode** ( <key>2</key> ) and **Bridge** ( <key>ALT</key> + <key>B</key> ) them together. ## Step 20: Drag some textures from the **Assets Browser**, resize the grass plane and do a **Fast Compile** to check out your map! <upload src="314/8d90b56ca352240.png" size="693373" name="image.png" /> # Result <upload src="314/8d90b56d0f8bd29.png" size="1204355" name="image.png" /> This may look like a discount **`gm_flatgrass`** but what you learned here were the very basics to Hammer.