• <xmp id="om0om">
  • <table id="om0om"><noscript id="om0om"></noscript></table>
  • 3 月 19 日下午 2 點,鎖定 NVIDIA AI 網絡中文專場。立即注冊觀看
    圖形/仿真

    使用時空藍色噪聲紋理實時渲染,第 1 部分

    藍色噪波紋理可用于提供每像素隨機值以在渲染中生成噪波圖案。藍色噪聲紋理比隨機數生成器或散列(兩者都是白噪聲)產生的噪聲更難看到,也更容易去除。要使用藍色噪波紋理,請在屏幕上平鋪它,使用最近鄰點采樣讀取紋理,并將其用作隨機值。

    在本文中,我們將時間軸添加到藍色噪波紋理中,為每個幀提供高質量的空間藍色噪波,并使每個像素隨時間變為藍色。與其他藍色噪聲動畫方法相比,這提供了更好的收斂性和時間穩定性。我們還將向您展示如何制作非均勻的藍色噪波紋理,以便進行重要采樣。我們將在后續文章 使用時空藍色噪聲紋理實時渲染,第 2 部分 中進行更深入的技術探討。

    雖然 other methods 結合了藍色噪聲和更好的收斂性,但它們首先關注收斂性,其次關注藍色噪聲。我們的工作首先關注藍色噪聲,其次關注收斂,這有助于在采樣數最低的情況下獲得更好的渲染效果,而藍色噪聲的好處最大。

    藍色噪聲紋理的一個顯著限制是,它們在低采樣數、低維算法中效果最好。對于高采樣數或路徑跟蹤等算法中的高維,您可能希望切換到低差異序列以消除錯誤,而不是試圖用藍色噪聲隱藏錯誤。

    同樣值得一提的是,在 TAA 下運動的像素失去了時間上的好處,我們的噪聲就如同純粹的空間藍色噪聲。然而,在一瞬間仍然是偶數的像素獲得了時間穩定性和較低的誤差,當它們再次運動時,這將由 TAA 攜帶。在這些情況下,我們的噪聲并不比空間藍色噪聲差,因此應始終使用它,以在可用的情況下獲得好處,否則不會更糟。

    有關更多信息,請在 Github 載時空藍噪聲紋理和生成代碼NVIDIAGameWorks/SpatiotemporalBlueNoiseSDK.

    圖 1 顯示了與時空藍色噪聲相比使用藍色噪聲的示例。

    The Disney Moana cloud rendered using various types of noise and showing frequency content.The Disney Moana cloud rendered using various types of noise and showing frequency content.
    圖 1 。使用指數移動平均( EMA )和 <  lpha ><  lpha >= 0.1

    圖 1 使用隨機單次散射,其中自由飛行距離隨時間使用一系列藍色噪聲遮罩進行采樣。傳統的 2D 藍色噪聲遮罩(最左側)很容易在空間上進行過濾,但隨著時間的推移,會顯示出白噪聲信號,使得基礎信號難以在時間上進行過濾。

    我們的時空藍色噪聲( STBN )遮罩(大圖像右側)在時間維度上還表現出藍色噪聲,導致信號更容易隨時間過濾。在最右邊,我們展示了主圖像的兩種裁剪,以及它們在空間( DFT ( XY ))和時間( DFT ( ZY ))上的相應離散傅里葉變換。 Z 軸是時間。大圖像中的插圖(右上角和右下角)顯示了地面真相。

    標量

    標量時空藍色噪波紋理存儲每個像素的標量值,對于需要每個像素的隨機標量值的渲染算法非常有用,例如隨機透明度。通過 在 3D 中運行 void 和 cluster 算法 生成這些紋理,但修改能量函數。

    計算兩個像素之間的能量時,僅當兩個像素來自同一紋理切片(具有相同的 z 值)或在不同時間點是相同的像素(具有相同的 xy 值)時,才返回能量值;否則,它返回零。結果是 N 紋理,在空間上是完全藍色的,但每個像素在 z 軸(時間)上也是藍色的。在這些紋理中,( xy )平面是與屏幕像素相對應的空間維度, z 軸是時間維度。在每幀 z 尺寸上前進一步。

    圖 2 顯示了時空藍色噪波、一組獨立的 2D 藍色噪波紋理和 3D 藍色噪波的示例紋理以及 XY 和 XZ DFT 。只有我們的噪聲在空間( XY )上是藍色的,在時間( Z )上是藍色的,正如你可以從中心的變暗中看到的,在那里低頻會衰減。

    在圖 2 中, 3D 藍色噪聲的各個片段在空間和時間上都不好。只有我們的時空藍色噪聲在空間和時間上都是藍色的。有關為什么 3D 藍色噪波對設置藍色噪波動畫不有用的更多信息,請參見 3D 藍色噪音問題 中 Christoph Peters 的精彩解釋。

    Spatiotemporal frequency composition of 2D Blue noise, spatiotemporal blue noise, and 3D blue noise.Spatiotemporal frequency composition of 2D Blue noise, spatiotemporal blue noise, and 3D blue noise.
    圖 2 。二維藍色噪波在空間上是藍色的,但在時間上不是很好的采樣

    圖 3 顯示了在黑色背景上 50% 透明的紋理,使用噪波進行二元 alpha 測試(隨機透明度),并使用 temporal anti-aliasing ( TAA )進行過濾。

    獨立的藍色噪波紋理是對白色噪波的顯著改進,它在每一幀中都有一組均勻分布的幸存像素。與白噪聲相比,這種方法對于鄰域采樣抑制效果更好,白噪聲具有殘存像素的團塊和空洞。時空藍色噪波通過使每個像素在時間上均勻分布的幀上存活下來而表現得更好,從而獲得更收斂、更穩定的結果。

    Comparison of noise types used for stochastic transparency.Comparison of noise types used for stochastic transparency.
    圖 3 。在 TAA 下,使用各種類型的噪聲進行 50% 透明度的隨機透明度測試

    在圖 3 中,白噪波(左)非常嘈雜,因為藍噪波(中)中不存在團塊和空洞。我們的時空藍色噪聲通過使像素不僅在空間上而且在時間上均勻地存活而做得更好。

    載體

    矢量時空藍色噪波紋理存儲每個像素的矢量值,對于需要每個像素的隨機矢量的渲染算法非常有用,例如光線跟蹤環境光遮擋。您可以通過在 3D 中從 藍色噪聲抖動采樣 ( BNDS )運行算法來生成這些紋理。你在那篇論文中對能量函數做了同樣的修改,就像你在 void 和 cluster 中對標量做的一樣。如果它們來自同一紋理切片,或者它們在不同時間點是同一像素,則僅返回非零能量。

    結果還是 N 紋理,在空間上是完全藍色的,但每個像素在 z 軸上也是藍色的。可以使用單位向量,這在需要方向向量的情況下很有用,也可以使用非單位向量,這在只需要 N 維隨機數(如空間中的點)時很有用。

    圖 4 顯示了向量值時空藍色噪聲的切片,以及它們在空間和時間軸上的頻率分量。這表明它們在空間上是藍色的,在時間上是藍色的。

    ? Vec1 Unit Vec1 Vec2 Unit Vec2 Vec3 Unit Vec3
    XY[0] This image has an empty alt attribute; its file name is red-black-vec1.pngThis image has an empty alt attribute; its file name is red-black-vec1.png This image has an empty alt attribute; its file name is red-black-unit-vec1.pngThis image has an empty alt attribute; its file name is red-black-unit-vec1.png This image has an empty alt attribute; its file name is yellow-multi-vec2.pngThis image has an empty alt attribute; its file name is yellow-multi-vec2.png This image has an empty alt attribute; its file name is yellow-multi-unit-vec2.pngThis image has an empty alt attribute; its file name is yellow-multi-unit-vec2.png This image has an empty alt attribute; its file name is white-multi-vec3-1.pngThis image has an empty alt attribute; its file name is white-multi-vec3-1.png This image has an empty alt attribute; its file name is white-multi-unit-vec3.pngThis image has an empty alt attribute; its file name is white-multi-unit-vec3.png
    DFT(XY) This image has an empty alt attribute; its file name is red-black-smooth-vec1.pngThis image has an empty alt attribute; its file name is red-black-smooth-vec1.png This image has an empty alt attribute; its file name is red-black-smooth-unit-vec1.pngThis image has an empty alt attribute; its file name is red-black-smooth-unit-vec1.png This image has an empty alt attribute; its file name is yellow-black-smooth-vec2.pngThis image has an empty alt attribute; its file name is yellow-black-smooth-vec2.png This image has an empty alt attribute; its file name is yellow-black-smooth-unit-vec2.pngThis image has an empty alt attribute; its file name is yellow-black-smooth-unit-vec2.png This image has an empty alt attribute; its file name is grey-black-smooth-vec3.pngThis image has an empty alt attribute; its file name is grey-black-smooth-vec3.png This image has an empty alt attribute; its file name is grey-black-smooth-unit-vec3.pngThis image has an empty alt attribute; its file name is grey-black-smooth-unit-vec3.png
    DFT(XZ) This image has an empty alt attribute; its file name is red-black-2-smooth-vec1.pngThis image has an empty alt attribute; its file name is red-black-2-smooth-vec1.png This image has an empty alt attribute; its file name is red-black-2-scmooth-unit-vec1.pngThis image has an empty alt attribute; its file name is red-black-2-scmooth-unit-vec1.png This image has an empty alt attribute; its file name is yellow-black-2-smooth-vec2.pngThis image has an empty alt attribute; its file name is yellow-black-2-smooth-vec2.png This image has an empty alt attribute; its file name is yellow-black-2-smooth-unit-vec2.pngThis image has an empty alt attribute; its file name is yellow-black-2-smooth-unit-vec2.png This image has an empty alt attribute; its file name is grey-black-2-smooth-vec3.pngThis image has an empty alt attribute; its file name is grey-black-2-smooth-vec3.png This image has an empty alt attribute; its file name is grey-black-2-smooth-unit-vec3.pngThis image has an empty alt attribute; its file name is grey-black-2-smooth-unit-vec3.png
    圖 4 。 128x128x64 時空藍色噪聲紋理及其頻率顯示為維度 1 、 2 和 3 的單位向量和非單位向量。

    圖 5 顯示了使用各種類型的單位 vec3 噪聲的 4 個逐像素光線跟蹤環境遮擋( AO )樣本。如果向量朝向法線,則該向量為負值。白噪聲、獨立的藍色噪聲紋理和時空藍色噪聲之間的質量差異非常明顯。

    Uniform sampled ambient, occlusion-rendering comparison. Uniform sampled ambient, occlusion-rendering comparison.
    圖 5 。使用均勻分布的光線對每像素 AO 進行四次采樣。藍色噪聲比白色噪聲好得多,而時空藍色噪聲比藍色噪聲好得多,因為隨著時間的推移采樣效果更好。

    重要性抽樣

    BNDS 算法從一組白噪聲紋理開始,并重復隨機交換像素(如果交換改善了能量函數)。但是,沒有理由必須將這些紋理初始化為均勻的白噪聲向量。

    當將它們初始化為非均勻分布時,該算法仍然可以創建藍色噪波紋理。結果是時空藍色噪聲紋理,它也恰好有一個非均勻直方圖,允許進行重要采樣。由于需要每個像素的 PDF 進行重要性采樣,您可以將 PDF ( x )存儲在 alpha 通道中,也可以根據紋理中的值計算 PDF ,例如,如果它是余弦半球加權的,則進行點積,或者除以作為著色器常量傳入的規格化值。

    圖 6 顯示了重要性采樣、向量值、時空藍色噪聲紋理。

    ? Texture[0] DFT(XY) DFT(ZY) Importance Map
    Cosine Weighted Hemisphere Unit Vec3 This image has an empty alt attribute; its file name is purple-texture0.pngThis image has an empty alt attribute; its file name is purple-texture0.png This image has an empty alt attribute; its file name is olive-grey-DFTXY.pngThis image has an empty alt attribute; its file name is olive-grey-DFTXY.png This image has an empty alt attribute; its file name is olive-grey-DFTZY.pngThis image has an empty alt attribute; its file name is olive-grey-DFTZY.png N/A
    HDR Skybox Importance Sampled Unit Vec3 This image has an empty alt attribute; its file name is red-pink-texture0.pngThis image has an empty alt attribute; its file name is red-pink-texture0.png This image has an empty alt attribute; its file name is deep-teal-DFTXY.pngThis image has an empty alt attribute; its file name is deep-teal-DFTXY.png This image has an empty alt attribute; its file name is deep-teal-DFTZY.pngThis image has an empty alt attribute; its file name is deep-teal-DFTZY.png This image has an empty alt attribute; its file name is foliage-importance-map.pngThis image has an empty alt attribute; its file name is foliage-importance-map.png
    圖 6 。重要采樣的時空藍色噪聲切片,其 DFT ,以及它們是重要采樣的源圖像。紋理的 alpha 通道將 PDF 存儲為最小和最大 PDF 之間的百分比。

    圖 7 顯示了再次跟蹤 AO 的四個每像素采樣光線,但使用了余弦加權半球,重要性采樣單位向量。白噪波生成一個單位 vec3 ,將其添加到法線,然后進行規格化。 Blue noise 和 STBN 的紋理中存儲了余弦加權半球向量,這些向量使用 TBN 基矩陣轉換為切線空間。

    • 查看旋轉木馬頂部的橢圓顯示藍色噪波比白色噪波效果更好。
    • 查看右上角的窗口幀,您可以看到 STBN 在陰影中的噪波如何比獨立的藍色噪波紋理少。
    Importance sampled ambient occlusion rendering comparison. Importance sampled ambient occlusion rendering comparison.
    圖 7 。余弦加權半球形(重要性采樣)每像素四個采樣環境遮擋。

    在圖 7 中,噪聲之間的差異不如均勻采樣時明顯,但仍然存在。藍色噪聲中的噪聲比白色噪聲更難看到,也更容易過濾。 STBN 中的噪聲與之相同,但幅度也較低。

    結論

    藍色噪波是一種在低采樣數下獲得外觀更好的圖像的好方法,就像在實時渲染中發現的那樣。藍色噪波在幾乎任何每像素需要一個或多個隨機值的情況下都很有用。

    有使用藍色噪音的想法嗎?下載紋理,嘗試一下,并在評論中分享你的結果。我們很想看到他們!

    ?

    0

    標簽

    人人超碰97caoporen国产