Skip to content

Instantly share code, notes, and snippets.

@SDGNelson
Created May 17, 2022 01:32
Show Gist options
  • Save SDGNelson/dcd967e7ca1a0db7e15cce258ed7e401 to your computer and use it in GitHub Desktop.
Save SDGNelson/dcd967e7ca1a0db7e15cce258ed7e401 to your computer and use it in GitHub Desktop.
3.22.9.0 Terrain FAQ

Q: Why is material painting only working with a few materials?

Each terrain tile/chunk can have up to eight unique materials, but auto-converted maps will have all of the eight layers filled already. When you try to paint a ninth material onto the tile it cannot find an empty slot. The solution is to reassign an unused layer:

  1. Open the Terrain > Tiles tab. Each tile/chunk of the terrain can have up to eight unique materials which is useful for biome variety, whereas the old terrain only had eight materials across the entire level.
  2. Click on a terrain tile to select it. In the bottom right you can see the eight layers and which materials are applied to the tile.
  3. Click on one of the eight layers to select it. The selected layer is shown in the top right. You can now click a material from the list to replace it.
  4. Painting the reassigned material should work!

Q: How to bake materials?

Baking the entire terrain at once has been replaced with "auto foundation" and "auto slope" options. While not as immediate a result, this scales much better for large maps with a variety of biomes and elevation. If you want to quickly use settings per-material you can configure them in a custom material asset and then paint with the Auto [W] brush.

Q: How to remove baked trees from the old terrain?

Tree baking is still available! Details and Resources tabs were merged into the Foliage tab. With the Terrain > Foliage > Bake [E] tool automatic grass and tree placement works the same as before.

Manually removing individual baked trees and grass will be added in the next update with a new hotkey. By default they are filtered out from the removal brush because there are so many.

Q: How to manually place trees?

  1. Open the Terrain > Foliage tab.
  2. Equip the Paint [Q] tool for bulk placement over large areas, or Exact [W] for individual placement.
  3. Select a foliage asset from the list on the right.
  4. Click on the terrain to add, or hold Shift to remove.

Q: How to fix red checkerboard or other incorrect materials?

If some materials on your terrain were replaced this means the game was unable to figure out which material was being used. Unfortunately the old terrain only stored the name of the texture, for example "grass.png", in which case maybe PEI grass is the wrong match, or if the texture name is unknown a checkerboard is used. Thankfully all of the material placement was preserved, so it should be a relatively easy fix:

  1. Open the Terrain > Tiles tab. Each tile/chunk of the terrain can have up to eight unique materials which is useful for biome variety, whereas the old terrain only had eight materials across the entire level.
  2. Click on a terrain tile to select it. In the bottom right you can see the eight layers and which materials are applied to the tile.
  3. Click on one of the eight layers to select it. The selected layer is shown in the top right. You can now click a material from the list to replace it.
  4. When you are happy with the fixed materials you can click "Copy Layers to All Tiles" to apply your changes across the entire level. This button is only useful for newly converted maps because later each tile might have different painted materials.

Q: How to convert custom Materials.unity3d file?

If any of the textures in your file were from official maps it should fortunately be an easy fix of re-assigning them in the Tiles tab. Refer to "How to fix red checkerboard or other incorrect materials?" for more instructions.

If you had custom textures in your Materials.unity3d file then there are unfortunately more steps. On the bright side, once finished you can use more than the old limit of eight textures, as well as different textures around the level for biome variety.

  1. The Materials.unity3d file needs to be converted to the "master bundle" format. The easiest option, especially if you do NOT still have the Unity project, is to just rename the file to something like "MyCustomMapMaterials.masterbundle" and create a MasterBundle.dat file, then move them into your map's Bundles folder. More info here: https://github.com/SmartlyDressedGames/U3-Docs/blob/master/AssetBundles.md If you cannot remember exactly what the file names were you can open the .unity3d in a text editor like VS Code and Ctrl+F search for "assets/". For example in the old PEI Materials.unity3d it looks like one of the file names was: "assets/game/bundles/terrain/devtest/materialspei_current_tweaked_alpha/grass.png"

  2. Create a Landscape Material Asset in your map's Bundles folder for each custom material on your map. The easiest way would be to copy one of the materials from Unturned's Bundles/Assets/Landscapes/Materials folder, change the GUID to a new one from https://guidgenerator.com/, and then update the "Name" and "Texture" path to your master bundle and texture name. For example the core vanilla asset bundle name is "core.masterbundle", but yours might be something like "myterrainmaterials.masterbundle". Then set the "Texture" "Path" to the file path relative to the Assets_Prefix. For example if I had set Assets_Prefix to "assets/game/bundles/terrain" then I could set path to "devtest/materialspei_current_tweaked_alpha/grass.png"

Q: How to convert hole volumes?

Converting hole volumes to painted holes is recommended, but optional. The main benefits are that painting holes is easier and unlimited. When you delete a hole volume the auto-painted area is preserved, so what I did for Germany, Hawaii, and Greece was delete all of the hole volumes, save, and then tidy up the edges with the Terrain > Materials > Cut [R] tool and some boulders to cover any gaps.

Q: Why are hole edges jagged now?

Previously each pixel of the terrain was tested against the hole colliders which meant they had pixel-perfect precision, but did not scale well with larger numbers of holes. Now the holes are represented as a texture which has approximately the same resolution as the heightmap. The loss of precision is unfortunate, but in my opinion getting rid of all the hacked-together physics workarounds and limitations was worth it.

Q: How to fill holes in the terrain?

A: Hold left shift while clicking with the Terrain > Materials > Cut [R] tool.

@Bar0nline
Copy link

hmm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment