Search Unity

Working with Physically-Based Shading: a Practical Approach

, February 18, 2015

Throughout the development of Unity 5, we’ve used our Viking Village project internally as a testing ground for shading and lighting workflows.

If you’re using the Unity 5 beta, you can download the Viking Village package from the Asset Store to get insights into how you can assemble and illuminate a scene in Unity 5. We also present some of our learnings below.

Creating a template environment

In order to ensure that your texturing and shader configuration is behaving appropriately, we recommend that you use a simple scene with a variety of lighting setups. This could mean differing skyboxes, lights etc – anything that contributes to illuminating your model.

When you open Unity 5, you’ll notice that any new empty scene has a procedural sky as well as default ambient and reflection settings. This provides a suitable starting point.


For our template environment we used:

  • HDR camera rendering

  • A few scattered reflection probes (for localized reflections on objects)

  • A group of light-probes

  • A set of HDR sky-textures and materials, as well as procedural skies. The sky which ships with this project was custom-made for Unity by Bob Groothuis, author of Dutch Skies 360.

  • Off-white directional lights with matched intensity and HDR sky color

Adjusting sky texture panoramas

Most sky textures include the sun (along with flares etc.), thus, light from the sun gets reflected by surfaces. This has the potential to cause three issues:

1) The Directional light you use to represent the sun must match the exact direction of the sun painted onto the skybox or there will be multiple specular hotspots on the material.

2) The reflected sun and the specular hotspot overlap, causing intense specular highlights.

3) The baked-in sun reflection is not occluded when the surface is in shadow and it becomes overly shiny in darkness.


The sun is erased from the sky texture and re-added using a directional light and a lens flare.

As a result, the sun highlight, flares, sunrays and HDR values need to be edited out of the sky texture and reapplied using Directional Lights.

Authoring physically-based shading materials

To avoid the guesswork involved in emulating real world materials, it is useful to follow a reliable known reference.The Standard Shader supports both a Specular Color and a Metallic workflow. They both define the color of the reflections leaving the surface. In the Specular workflow, color is specified directly, whilst in the Metallic workflow, the color is derived from a combination of the diffuse color and the metallic value set in the Standard Shader controls

For the Viking Village project, we used the Standard Shader’s Specular Color Workflow. Our calibration scene, which you can download from the Asset Store, includes some handy calibration charts. We referenced the charts regularly when designing our materials.

When approaching materials you can choose between what we call the Specular and the Metallic workflows, each with its own set of values and a reference chart. In the Specular workflow you choose the color of the specularly reflected light directly, in the metallic workflow you choose if the material behaves like a metal when it is illuminated.

The specular value chart:


The metallic value chart:

UnityMetallicChartChoosing between Specular or Metallic workflows is largely a matter of personal preference, you can usually get the same result whichever workflow you choose to use.

Aside from charts and values, gathering samples of real world surfaces is highly valuable. It is of great help to find the surface type you are trying to imitate and try to get an understanding of how it reacts to light.

Setting up the material

When starting out, it’s often useful to create a plain but tweakable representation of the materials using colors, values and sliders derived from the calibration charts. Then, you can apply textures while keeping the original material as a reference to confirm that characteristics are preserved.


Top row: untextured. Bottom row: textured. Left to right: Rock, Wood, Bone, Metal.

The traditional approach to creating textures

Textures in the Viking Village have been authored using both manual-traditional methods (photos + tweaking) as well as through scanned Diffuse/albedo, specular-, gloss and normal map images which were provided to us by Quixel.

Be careful when adding detail in the texture channels of the material. For example, it usually pays to avoid placing lighting (Ambient Occlusion, shadows etc.) in your textures: remember that the physically based rendering approach provides all the lighting you should need.

Naturally, retouching photographs is more demanding than using scanned data, specially when it comes to PBS-friendly values. There are tools that provide assistance to make the process easier, such as Quixel Suite and Allegorithmic Substance Painter.

Scanned data

PBS-calibrated scanned textures alleviate the need for editing, since data is already separated into channels and contains values for albedo, specular and smoothness. It is best if the software that provides the PBS-calibrated data contains a Unity profile for export. You can always use the reference charts as a sanity check and as a guide if you need to calibrate the values using Photoshop or a related tool.

Material examples

The Viking Village Scene features a large amount of content while trying to stay within reasonable texture memory consumption. Let’s take a look at how we set up a 10-meter-high wooden crane as an example.

Notice that many textures, especially specular and diffuse textures, are homogenous and require different resolutions.

image10Example1: This Crane object has 2 materials: 2 diffuse, 1 specular-smoothness, 2 occlusion and 2 detailed textures.

image06Example 2: The shield prop has 1 material: 1 diffuse, 1 specular-smoothness, 1 occlusion and no detailed textures.

Screen Shot 2015-02-17 at 17.12.23On the left: Crane Inspector for both materials. Rightmost is the shield prop material.

  • Albedo texture: In the specular workflow it represents the color of diffuse light bounced off the surface. It does not necessarily need to be highly detailed as seen in the left image (crane), whereas the right texture (shield) includes significant unique detail.

vv albedo texturePainted Crane Diffuse Map snippet with plain wooden color and intensity. Contains a modest amount of detail. Right image: Shield Diffuse texture with higher (ppi) unique detail.
image09Diffuse value (no texture) for crane material

  • Specular: Non-metals (insulators) are comparatively dark and in grayscale while metal values are bright and could be colored (remember that rust, oil and dirt on a metal are not metallic). Specular for the wood surface did not benefit extensively from a specular texture, so a value was used instead of inputting a map.

image07Crane Specular values for wood.

Screen Shot 2015-02-17 at 17.40.23Crane Specular map for metal (not using metallic shader). Right: Shield Specular texture.

  • Smoothness is a key element in PBS materials. It contributes variation, imperfections and detail to surfaces and helps represent their state and age.
    For the crane, smoothness happened to be fairly constant across the surface and was therefore substituted by a value. This delivered a reasonable texture memory gain.

image05Crane Smoothness values for wood. No textures required!

Screen Shot 2015-02-17 at 17.51.13Crane Smoothness map for metal (not using metallic shader). Right: Shield Smoothness map with mixed metal and wood surfaces.

  • Occlusion indicates how exposed different points of the surface are to the light of the surrounding environment. Ambient Occlusion brings out surface detail and depth by muting ambient and reflection in areas with little indirect light.
    Keep in mind that there’s also the option of using SSAO (Screen Space Ambient Occlusion) in your scene. Using SSAO and AO could result in double darkening of certain areas, in which case you may want to consider treating the AO map as a cavity map.
    An AO map that would emphasise deep cracks and creases may be the best option if the game uses SSAO and/or lightmapped Ambient Occlusion.


1 Lightmapped AO, 2: Occlusion texture, 3: Occlusion in Diffuse, 4: Image effect SSAO 

Secondary Textures and resolution

Secondary Textures can be used to increase the level of detail or provide variation within the material. They can be masked using the Detail Mask property.

Due to the low resolution primary diffuse wood texture in the Crane example, the secondary texture set is crucial. It adds the fine detail to the final surface. In this instance, the detail-maps are tiled and at a reasonably low resolution. They are repeated on many other wooden surfaces, thus delivering a major texture memory saving.

image20Secondary albedo- and normal maps compensate for the low-resolution main diffuse and normal map. Both textures reduce overall texture memory by being widely “overlayed” and tiled on wooden surfaces throughout the village. Be cautious when providing lighting information to a diffuse detail map as it this has a similar effect to adding such information to primary diffuse.

image16Crane wooden surface with (left) and without (right) secondary texture maps.

These workflows certainly helped us when designing the Viking Village project. We hope you also find them useful, and look forward to reading your comments!


The Viking Village project was launched in partnership with the creative team at Quixel, developer of HDR surface capture technology and the Quixel Megascans library of PBS-ready textures.

Big thanks to the very talented Emmanuel “Manu” Tavares and Plamen “Paco” Tamnev for bringing this scene to life.

Go and download the project at the Asset Store. Be aware that it’s optimised for Unity 5.0.0 RC2.

35 replies on “Working with Physically-Based Shading: a Practical Approach”

Great article: I need just a little information:

You have written:

The baked-in sun reflection is not occluded when the surface is in shadow and it becomes overly shiny in darkness.

I have this issue in one of my project where I want to make use of both indoor and outdoor environments. I can clearly see that, on some really shiny materials, such as Glass, the skybox is reflected on them, but they are occluded inside a solidified box (made with Blender). I partially solved this by disabling reflections, but how can I make glasses reflect the indoor environment without disabling skybox reflection (this way I can make external items reflect the skybox)?


Hey there,

the secondary details maps are very cool.
However, I saw that
– if you apply them, they “add” to the general Albedo map in a certain way but I cannot figure out how exactly. Is that a colour-add or an overlay (e.g. similar to a certain blend mode in Photoshop)?
– you did the project in cooperation with Quixel. I’d love to fully edit my Unity 5 materials with Quixel but so far could not spot a possibility to add a “secondary albedo x2 detail” channel there. Is there a way to do that?

I keep getting an error while trying to download this package from the Asset Store, using Unity 5. Anyone else is experiencing the same?

Can you explain your object’s materials? For example, the fish texture “prop_fish_01_d.tif” is really washed out. I am sure that you did that for a reason, but it is not clear to me yet, and I would really to understand it. Thank you.

[…] makes good use of the real-time global illumination feature, physically based shading, reflection probes , HDR environment lighting, the linear lighting pipeline and a slew of […]

I was kind of indifferent to PBR, I didn’t really get it until a few nights ago when i seriously tried it out. It’s amazing what you can achieve, the variety of textures with just a diffuse and normal map even. It’s much more realistic and feels based in nature. Great work. I’m sure there will be a lot of beautiful projects that take advantage of it.

Hi Erland, very nice work. Could the teleporter demo you worked on last year be made available in the asset store as well?

One thing I don’t get is the use of light probes. I thought they were only used for lighting dynamic objects? But this is mostly a static scene.

Lightmapping small prop objects like rocks, grass etc is overkill and can be very bad for both baking performance and runtime performance due to larger lightmaps. This is especially important for realtime GI & realtime lightmaps but it is equally applicable to baked lightmaps.

So it is a good idea to use lightprobes to light these small props for performance reasons. You will notice that all shields, grass, fences, barrels and other smaller objects are lit via lightprobes.

Houses & terrain is marked static. This also means that light bounces off of terrain & houses only, which when you want to do realtime GI is a very reasonable tradeoff. I think it would make a quite unnoticable difference to bounce lighting if the fences, barrels, leaves were fully lightmapped (and thus light also bouncing off it)

There is a problem with the mat_terrain_near material in this package. I get a pink surface. Anyone know how to fix this?

RC2 had some changes to the builtin cginclude files which conflicted with a shader in the project. Please update the package on the asset store. It is fixed now.

There is a problem with the asset store package updater. It keeps downloading the old package. To reproduce (Win 7):

-Close Unity 5 RC2.
-Delete downloaded file “Viking Village.unitypackage” from the AppData folder.
-Open the asset store inside Unity and download the viking village. It will show version 1.0.1758, which is the latest version.
-Once downloaded, extract the package into a new project.
-You will see that the ground shader still has an error (pink).
-Restart Unity.
-Open the asset store inside Unity and notice that the viking village package version number has changed to 1.0.1755, which is the old version. It also states that there is an update available, but I just downloaded the latest version (or so I thought).

You forgot to mention how important it is to set the colour space to linear. If you don’t then it throws the smoothness/specular values way off (overly shiny). You can deal with that in sRGB space by doing a sRGB to linear conversion, or simply a corrective gamma curve in Photoshop, but it begins to break down the ‘simple to use’ ethos behind physical rendering. I think this kind of thing should be handled automatically: Substance Designer and other apps can handle it, I hope Unity will in the future.

Aside from that, thank you – it looks wonderful, and thanks for the breakdown and great charts.

Impressive project and really well done sharing it on the asset store. Personally I would recommend doing this with every testing scenes Unity is making. For example: That sci-fi room shown earlier about realtime global illumination, the doll, the transporter scene, sci-fi engine scene. Everyone can learn so much about it, and I enjoy stripping those scenes down and learn from it.

Anyways, last little comment. The name “Groothuis” is spelled wrong, it’s now written down as “Groothius” Just a little comment ;)

Thank you, fixed Bob Groothuis’ name.

Sharing demo projects on the AssetStore is something we at Demo team have been wanting to do for a long time. What has been stopping us, is that it comes with a cost to the project: considerably limited possibility to:
1) use third-party content (because of copyright reasons), and
2) develop our own tools and custom solutions on top of Unity (because of increased maintenance complexity).
This situation is quite restrictive, and the result would be, that we would be holding back from using the full potential of Unity.

This being said, we still wanted to do it for at least some of our projects, so… here is one :)

Thank-you so much for the charts! It’s always much easier to have a reference where you can use the work which people have done before, to make your design choices a lot more accurate and quicker! :D

[…] that effects my packs is the new Physically Based Rendering pipeline. As an artist this means some different techniques when creating various maps for your models. The end result, though, is very much worth the extra […]

Thank you very much for this post. As Jashan said similar posts are super useful to give us overview about where you go and how you think in the process of bringing all these feature to life. Thank you again. Thanks to Unity and your team we can bring education to whole world. Enjoy your day and look forward to 5.0 release. Marek.

Quite impressive project. I was wondering if we can re-use some of Viking Village textures and/or materials in our own assets (at Unity Asset Store) when Unity 5.0 will come out?

That’s very nice to hear, as today there are various issues with getting even simple textures (due to licenses) on the web, and putting texture in the asset is usually treated as redistribution. I am very excited about this project.

That’s very generous. I was wondering about something related to this. I’m hoping to publish some assets in the store soon and it is Sci-Fi. So I was wondering if it was okay to use some of the Angry Bots sounds in my demo level (provided I give due credit, of course). From your answer can I assume that the same applies to all previous UT content?

Yes, the usual Asset Store license applies. Dig into details here:, but long story short, as long as you use the assets “as incorporated and embedded components of electronic games and interactive media and distribute such electronic game and interactive media”, you’re fine.

[…] Throughout the development of Unity 5, we’ve used our Viking Village project internally as a testing ground for shading and lighting workflows. If you’re using the Unity 5 beta, you can download the V…[続きを読む] […]

Blog postings like this are super-useful and make it much easier to get into the flow with PBS/PBR! You might even consider linking some of those from the main documentation for some more details / examples than what you’d usually put into the manual.

Really nice work, it is all coming together with Unity 5 at last, my thanks to all the women and men that have must have died bringing PBR and realtime GI to the masses, it will soon be in the hands of the people, and hopefully not violently explode so much as it has during the beta ;-)

Comments are closed.