Feature Highlight: Setting up 3D Environments in Unity

In this guide I’ll cover some of the basics of creating a 3D environment for your game and how to apply textures and materials to your environmental objects.

What does it mean to create a 3D environment? In simple terms, its the process going from this:

To this:

We take basic structural elements such as pillars and window frames (usually provided by an artist) and then apply materials and lighting to them to make them beautiful.

Materials, Shaders, and Textures

The first things to understand for environment design are the concepts of materials, shaders, and textures. Here is a quick overview from the Unity documentation:

You can take a simple object such as our white pillar above and apply a material set to it to change the design. Within the Material property, by default there is a “standard” shader which can hold a color or a pattern as well as a number of detailed properties such as Metallic or Smoothness.

By modifying the Albedo (color) channel, we can make a basic update to our white pillar and turn it blue. But what we really want to do is match the design of the pillar on the left, which we can do by adding a texture. The gray box to the left of Albedo allows us to implement a texture on an object.

We have a black marble texture preset which we can apply here to begin matching the effect.

Two things you will still notice here — the color is off and our marble lines and streaks are much larger on the right pillar than the left. To match the marble streaking we need to update the tiling setting, which indicates the frequency of repeat for the texture. For this pillar tiling of 1x1 needs to be updated to 4x4.

That is much more similar to our intended left pillar design. Now for our “color” adjustment — in fact this isn’t an adjustment of color at all. If we were to simply adjust the albedo color to black this pillar would lose its detail.

Instead we want to adjust our Metallic and Smoothness settings. The metallic setting controls how glossy the object is:

Smoothness controls how rough vs. how reflective and smooth the object is:

And with a little tweaking, our two pillars now look about the same:

Now looking ahead to our next objects, we have two columns with multiple materials on them.

These are called sub-meshes, which can be created by outside 3D modeling programs to allow for customization of individual parts of a more complex object. You can see each material within the mesh renderer:

Now since we will be using the same black marble texture for multiple objects it makes sense to save it as a material that we can apply over and over. I’ve created a new material and named it BlackMarble_mat and applied our albedo texture as well as metallic and smoothness settings. You can preview your material in the inspector as you design these settings:

This looks pretty good. We can do the same for the white wall material as well as the gold emblem, and end up with a pretty similar design result:

Another cool tool to understand is Occlusion, which can help you add shadows to your game objects.

It’s a subtle change, but it helps to add depth and detail to you game. This is set up using what is called an Occlusion map, which is essentially a grayscale image that tells the system which areas should receive full direct lighting (white) and no direct lighting (black):

The Occlusion setting scales from 0 (no shadow) to 1 (full shadow) which is the intensity of the effect or in other words how closely to follow the direction of the occlusion map.

I hope that is helpful in understanding how to create and apply material settings in Unity. A lot will depend on the 3D models and art assets / textures you have at your disposal, but the implementation is quite straight forward. In the next guide I’ll cover how to set up lighting to set the tone for your 3D game — see ya there!

Unity Developer from Los Angeles, CA