Search Unity

Digging into Terrain Paint Holes in Unity 2019.3

January 31, 2020 in Technology | 3 min. read
Topics covered
Share

Unity 2019.3 continues to bring more exciting updates to Unity’s Terrain system, including – by popular demand – the ability to create holes in your Terrain!

Using the new Paint Holes brush tool, you can mask out areas in the mesh of your Terrain Tiles, and even manipulate these masks through your code. This makes it easier than ever to add terrain characteristics like holes, portals, or even caves by taking advantage of in-Editor tools like ProBuilder, ProGrids, and Polybrush. Let’s take a look at how we can create a simple cave using this process.

Set up and customize your Terrain Tile

Place a new Terrain Tile in your Scene and create a rough mountain shape. If you haven’t tried our latest Terrain Tools preview package, check out this excellent primer along with this guide on Terrain material painting.

Mask out the entrance for your cave using the Paint Holes tool

From the Terrain Tools drop-down menu, select the Paint Holes brush. With your Terrain Tile selected, pick your brush shape in the Inspector and make sure the opacity of your brush is set to 100. Paint a round shape where you plan to place the entrance of your cave.

This content is hosted by a third party provider that does not allow video views without acceptance of Targeting Cookies. Please set your cookie preferences for Targeting Cookies to yes if you wish to view videos from these providers.

Create your base cave shape using ProBuilder

ProBuilder and Polybrush are in-Editor tools for simple 3D modeling that can be used to create a basic cave. You can easily add both to your Project via the Package Manager. Once both are installed, you can start creating your cave with ProBuilder. 

Open the tool by navigating to Tools > ProBuilder > ProBuilder Window. Using the ProBuilder menu, create a new ProBuilder shape and select the Pipe preset. Identify which end of the pipe you’ll use for the cave’s entrance. Create a new Plane shape that’s slightly larger than the pipe’s radius, and use it to seal the other end of the cave. Select both objects in ProBuilder and merge them to create a single GameObject. Using the ProBuilder face selection tool, delete any extra faces on the plane that are outside of your sealed cave. Scale your object to match the radius of your Terrain hole, and move it into position.

This content is hosted by a third party provider that does not allow video views without acceptance of Targeting Cookies. Please set your cookie preferences for Targeting Cookies to yes if you wish to view videos from these providers.

Sculpt the cave mesh to fit the Terrain hole

Using Polybush, push/pull the vertices along your cave entrance until they align nicely with your Terrain hole. You’ll also want to use Polybrush along the length of your cave to add variation and make it look more like a natural environment.

You now have a cave in your Terrain

Congrats, you now know how to add a bunch of fun details to your Terrain! If you’d rather do your modeling externally, you can still use your favorite 3D modeling program to create a cave mesh and import it using Unity’s DCC integration tools. Don’t forget to further decorate your cave with rocks or lighting!

--

To learn more about how to create rich Terrain, check out our Paint Holes documentation and Terrain workshop from SIGGRAPH 2019. Happy "terraining!"

January 31, 2020 in Technology | 3 min. read
Topics covered