Search Unity

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.

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.

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!»

11 replies on “Digging into Terrain Paint Holes in Unity 2019.3”

Seems like there would be an option in Probuilder to create a mesh (from a volume around a Terrain Hole) that snaps to the edges and position of a Terrain Hole so that I can have a proper mesh to send to my external DCC (say, Blender or Zbrush) for sculpting.

I think the mandatory «lip» around the edge of a cave looks like garbage and makes this overall workflow suck. :(

Not the best example but it is basic – seems to follow the PhysX option of having terrain tiles which are hidden/non-collidable. Not even diagonal edges. Better than nothing!

And the holes in general look terrible.

I am hoping there are some nicer examples because it looks no better than plugging in a seperate mesh with seperate UVs.

Not really seeing what this does to benefit either aesthetics or workflow.

The key part of this update is more that you can now actually add holes to terrain, which affects which terrain triangles are rendered and how the terrain collision mesh works (Including affecting navmeshes). Actually adding art assets within and around a hole that fit thematically are an exercise for artists and level designers, but at least now you don’t have to add a really hacky solution to allow a player and NPCs to actually walk into a cave rather than slide up and over the entrance.

That workflow looks terrible!! — And the results… terrible too… :'(

Sorry, but why not just give us a way to take the terrain out of Unity quickly and bring back in the resulting mesh we sculpted from Blender?? — We can sculpt caves from the Terrain mesh with Blender to our heart’s content, then bring that mesh (minus the terrain part) back in with some vertex-colors to represent the location of our material textures, and then BOOM, you got Terrain Holes + Caves AND Overhangs.

Until then… YO HOBBYISTS!!! — You’ve got another overly awkward workflow now! — A word to the wise: You might as well just stick with mesh-based terrains for the foreseeable! — You will waste less of your life this way… :(

nice tool !i cant wait to more :) .I havea a question .In the future can the tool attach a collider or a mesh in the hand or foot of any caracter to make a real time deformation terrain with de impact and to use whatever the people want?

Cool:) I’m using procedurally generated terrains. Can i generate a hole at runtime maybe by intersecting terrain with a dungeon door and hallway? And/or is there any API available for this yet/planned?

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *