Search Unity

Procedural Stochastic Texturing in Unity

February 14, 2019 in Technology | 3 min. read
Topics covered

Have you ever tried using tileable textures to cover large surfaces or add fine-scale detail to your meshes? If so, you’re probably familiar with the visible repetition pattern that quickly emerges with higher tiling values. At Unity Labs, we have developed a new texturing technique that avoids this issue, Procedural Stochastic Texturing.

Tileable textures are a useful tool to add detail to your 3D scenes. However, whenever you want to texture large areas or achieve highly detailed surfaces using tileable textures and detail maps, tiling patterns become visible. This effect is illustrated on the left-hand side of the following picture. Typically, reducing repetition patterns requires bigger textures or hiding the visible repetition with additional objects. In this blog post, we provide a plugin that solves this problem for textures with stochastic appearances, such as rust, moss, bark, etc. Its impact is shown on the right-hand side of the following picture.

Rusted metal material with regular texturing (left) and our technique (right).

Download the plugin here.

Given an input texture, the plugin will procedurally generate an infinite texture that matches the appearance of the input. We do so by leveraging a state-of-the-art texture blending function that operates on a modified version of the input texture, which only requires three texture samples per fragment, and by fetching a small lookup-table. Since the plugin avoids the need for tiling, it makes it possible to cover larger surfaces with smaller textures and higher levels of detail without any repetition artifacts.

Using the StandardStochastic shader

The plugin provides a variant of the Standard shader, which is included in a Unity package. Once you have imported the package, select the StandardStochastic shader for your material. The interface is the same as that of the Standard shader, with the addition of two new controls at the top, corresponding to the two required setup steps:

  1. The Stochastic Inputs menu allows you to specify on which of the input textures you wish to enable our technique (it can be set to Everything, or specific textures, e.g., albedo and/or normal map).
  2. The Apply button pre-computes data for the selected stochastic inputs and updates the material, finishing the process. For each input texture, this step generates two intermediate textures located in the same folder.

A few additional remarks:

  • Because existing intermediate textures are loaded when they are found to skip generation times, any modification to the original texture requires deleting them both before hitting the Apply button again to force their regeneration.
  • When switching between the Standard and StandardStochastic shaders, parameters are transferred back and forth.
  • A StandardStochastic (Specular setup) shader is also provided for materials using the Specular workflow.

The following examples show the prototype working with different materials using small (256²) input textures.

Wood detail maps with albedo, normal and occlusion textures
Rock material with albedo, normal, occlusion and height textures
Iron material with albedo, normal, and metallic/smoothness textures


This technique is only compatible with tileable stochastic and near-stochastic textures, such as textures resembling random noise when viewed from a distance and typically natural-looking materials without precise geometric shapes.


This is a research prototype; it is not under active development. As such, we don’t guarantee maintenance or support but feel free to ask any question and offer feedback on this Unity Forum thread. We are currently working on a ShaderGraph implementation for custom shaders and compatibility with the new rendering pipelines. Look out for updates on the forum thread!

Further reading

Curious about how the plugin works? Check out our two recently published research papers on the subject, which our plugin builds upon:

The code delivered with the plugin features comments referring to specific sections of the technical chapter.

February 14, 2019 in Technology | 3 min. read
Topics covered