unity 程序紋理
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.
您是否嘗試過使用可平鋪的紋理覆蓋大表面或向網格添加精細比例的細節? 如果是這樣,您可能會熟悉可見的重複模式,該模式會隨着較高的平鋪值而Swift出現。 在Unity Labs,我們開發了一種避免這種問題的新紋理化技術,即過程隨機紋理化。
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.
花木紋理是將細節添加到3D場景的有用工具。 但是,每當您要使用可平鋪的紋理和局部貼圖對大面積進行紋理化或獲得高度精細的表面時,平鋪模式都將變得可見。 下圖的左側說明了這種效果。 通常,減少重複圖案需要較大的紋理或使用其他對象隱藏可見的重複。 在此博客文章中,我們提供了一個插件,該插件可解決具有隨機外觀的紋理(例如鏽,苔蘚,樹皮等)的此問題。其影響顯示在下圖的右側。
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.
給定輸入紋理後,插件將在程序上生成與輸入外觀匹配的無限紋理。 我們通過利用對輸入紋理的修改版本進行操作的最先進的紋理混合功能(每個片段僅需要三個紋理樣本)並獲取一個小的查找表來做到這一點。 由於該插件避免了平鋪的需要,因此可以使用較小的紋理和較高的細節覆蓋較大的表面,而不會出現重複的僞像。
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:
該插件提供了標準着色器的變體,它包含在Unity軟件包中。 導入包後,爲您的材質選擇StandardStochastic着色器。 該界面與標準着色器的界面相同,在頂部添加了兩個新控件,分別對應於兩個必需的設置步驟:
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).
隨機輸入菜單允許您指定要在哪種輸入紋理上啓用我們的技術(可以將其設置爲全部,或設置爲特定紋理,例如反照率和/或法線貼圖)。
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:
一些補充說明:
The following examples show the prototype working with different materials using small (256²) input textures.
以下示例顯示了使用小(256²)輸入紋理處理不同材質的原型。
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!
這是一個研究原型; 它沒有得到積極發展。 因此,我們不保證會提供任何維護或支持,但隨時可以提出任何問題並提供有關Unity論壇主題的反饋。 我們目前正在開發ShaderGraph實現,以實現自定義着色器並與新的渲染管道兼容。 尋找有關論壇主題的更新!
Curious about how the plugin works? Check out our two recently published research papers on the subject, which our plugin builds upon:
對插件的工作方式感到好奇嗎? 查看我們最近發表的有關該主題的兩篇研究論文,我們的插件基於這些論文:
Paper: High-Performance By-Example Noise using a Histogram-Preserving Blending Operator – Eric Heitz and Fabrice Neyret, HPG 2018
論文: 使用直方圖混合運算符的高性能示例噪聲 -Eric Heitz和Fabrice Neyret,HPG 2018
Technical chapter: Procedural Stochastic Textures by Tiling and Blending – Thomas Deliot and Eric Heitz, GPU Zen 2
技術章節: 平鋪和混合的程序隨機紋理 – Thomas Deliot和Eric Heitz,GPU Zen 2
Check out our other research work at Unity: Unity Labs Publications
在Unity: Unity Labs出版物上查看我們的其他研究工作
The code delivered with the plugin features comments referring to specific sections of the technical chapter.
插件隨附的代碼具有註釋,這些註釋指的是技術章節的特定部分。
翻譯自: https://blogs.unity3d.com/2019/02/14/procedural-stochastic-texturing-in-unity/
unity 程序紋理