General概要

The Redshift Sprite Node allows the use of texture to define the parts of a surface that are totally transparent. This can be useful to create detail on thin, low-polygon geometry. A good example of this is foliage: the leaves of a tree can be modeled as quads, but the shape of each leaf can come from a black and white texture. The alternative solution would be to model the shape of each leaf with triangles/quads but that could require a lot of effort and would occupy significant memory resources.

Redshfit Sprite Node允許使用紋理來定義表面上完全透明的區域。對於表面小物體上的細節,低精度幾何體,這個節點非常有用。植物就是很好的例子:樹的葉子可以通過創建四邊形來表現,只要每片樹葉的形狀通過Alpha通道來定義就行了。另一個解決方案就是組每片葉子形狀建成三角/四組的模型,但是這樣可能需要大量的時間並佔用大量內存資源。

In Redshift, apart from the sprite node, one could achieve the same result by simply connecting a texture to the shader』s transparency port. In the case of the architectural shader, one could connect a black and white texture to the shader』s 『opacity cutout』 port.

Redshift中,除了通過Sprite Node,也可以直接連接Alpha貼圖到材質的Tranparency埠,這樣做可以達到同樣的效果。對於Architecutral材質而言,可將Alpha貼圖連接到材質的Opacity Cutout埠。

However, both of these alternatives can be problematic:然而,以上兩種選擇都會帶來問題:
  • They can reduce the performance of the renderer. When a ray hits a polygon, Redshift has to execute certain operations to read the texture, setup the next transparency/refraction ray, etc. These operations can be wasteful if the ray hits a 『totally empty』 part of the polygon.

它們會使渲染器性能減弱。當採樣射線到達多這形時,Redshift需要執行一系列操作來讀取紋理,建立下一次Transparency/Refraction採樣射線等等,若採樣射線到達時是完全鏤空區域,這些操作就都浪費了。

  • The transparency/refraction trace depth would have to be increased in order to prevent transparency/refraction rays from being terminated prematurely and introducing visual artifacts.

必須增加Transparency/Refraction的Trace Depth,以防止過早終 Transparency/refraction採樣射線所引發的可見瑕疵。

The Redshift Sprite Node addresses both of these issues! First, it is optimized to very quickly skip empty parts of a polygon and with very few operations. That can yield far superior performance compared to transparencies. Secondly, it does not rely on the refraction trace depth. So, even if your max refraction trace depth was zero, the rays would still successfully go through any opacity/alpha cutouts and without any artifacts.

以上兩個問題Redshift Sprite Node都能解決。首先,它經過優化,能用很少的操作快速地跳過多邊形鏤空的部分。從而使實際的渲染性能遠遠優於使用透明度。其次,它不依賴於折射Trace Depth。因此,如果Max Refraction Trace Depth為0,採樣射線仍然能夠順利通過由Opacity/Alpha剪切掉的部分,不會造成可見的瑕疵。

However, to achieve this performance, the sprite node has a couple of limitations too:

然而,為了實現上述功能,Sprite Node也帶來了幾個局限性:

  • The textures used by the sprite node occupy GPU memory and cannot be out-of-core. This means that if your scene is using many high-resolution alpha textures, Redshift could potentially run out of GPU memory. This is in contrast to all other textures in Redshift which are out-of-core and can be of any size without triggering out-of-memory issues. A 1024x1024 sprite node texture occupies 1MB of memory, a 4K one occupies 16MB of memory and so on.The number of megabytes these textures occupy is shown in the 「Redshift Feedback Display」 window.

Sprite Node使用的紋理佔用GPU顯存,不能使用出核技術。這意味著如果場景使用很多高解析度的Alpha紋理,Redshift可能耗盡GPU顯存。相比之下,Redshift能通過出核技術支持任意大小的貼圖紋理,避免由此引發的顯存溢出問題。1024x1024的Sprite Node紋理佔1MB的顯存,4K的Sprite Node紋理佔用16MB的顯存,以此類推。這此紋理佔據的位元組數量會在Redshift FeedBack Display窗口顯示。

  • No shadernode operations are permitted on the sprite node alpha texture. This means that you cannot use shader nodes to adjust the texture』s look, like for example brighten or darken it. Or be able to blend multiple alpha textures together before connecting the result to the sprite node. Therefore, any modifications to the sprite node texture have to happen in your texture authoring tool.

Sprite Node的Alpha通道不允許使用任何調整節點。就是說,不可以用材質節點來對Alpha通道,進行類似於提高或者變暗的調整。也不可以在輸出連接到Sprite Node以前將多個Alpha紋理混到一起。因此,任何對Sprite Node Alpha通道的修改,都只能在圖形編輯軟體中操作。

Below are two screenshots demonstrating alpha-cutout using the architectural shader』s opacity cutout port and using the sprite node.

下面兩張截圖分別展示在Architectural材質中使用Opacity Cutout埠的Alpha-Cutout,以及在Sprite Node中使用Alpha-Cutout。

Note注意

Please note that the large performance difference demonstrated below is because of the multiple stacked cards which is a pathological case. In this scene all ray types

(primary, GI, shadow, reflection) have to travel and intersect many layers of alpha cutout geometry. A scene with fewer layers would yield a smaller performance benefit - but a benefit nevertheless!

請注意,下面展示的巨大性能差異是由面片大量的堆疊所造成的。這種堆疊對於渲染來說是影響很大的。在這個場景中,所有採樣射線類型(主採樣、全局照明、陰影、反射)都是穿過無數層經過Alpha Cutout「掏洞」的幾何體。場景中堆疊層次越少,相應的性能優勢也越小------雖然如此,還是會有差別。

Scene rendered using the architectural nodes opacity cutout feature. Even with a high trace depth limit, there are still artifacts on the upper left part of the image. Also some reflections are missing between the first two rows. Rendering time was approx. 50 seconds on a low-end GPU.

渲染的場景使用Architectural節點的Opacity Cutout功能。即使Trace Depth Limit已經設定得很高,畫面的左上部分還是出現了問題,且頭兩排之間的還損失了一些反射。在低端的GPU中的渲染時間大約是50秒。

Scene rendered using the sprite node. There are no trace-depth-related artifacts. Rendering time was approx. 14 seconds on the same GPU as the example above. Trace depth limits were left the same, but they are irrelevant to the sprite node.

使用Sprite節點渲染場景,與Trace Depth相關的問題不存在。使用與上面例子相同的GPU渲染時間大約是14秒。Trace Depth Limits設置上同上,實際上這與Sprite節點沒什麼關係。

Shader Options著色器選項

Shader Input著色器輸入

This is the shader graph to execute when the sprite is not cut-out.

用於連接未作剪切的著色器節點。

Stencil模版

Map貼圖

This is the opacity cutout texture map file.

用於剪切的透明度紋理貼圖文件

Texture Space紋理空間

This is the texture mapping space, which defines the uv channel.

紋理貼圖空間,定義UV通道。

Opacity Calculation透明度計算

This tells the Sprite shader how to calculate the opacity value from the texture

map. It can be derived in one of two ways:

設定Sprite Shader如何根據紋理貼圖計算透明度,可以有兩種方法選擇:

  • From Color Intensity (uses the RGB channel color information)(使用RGB通道顏色信息)
  • From Alpha (uses the alpha channel information)(使用Alpha通道信息)

Stencil Opacity Threshold標籤透明度閾值

This is the opacity cutout threshold. When the value from the opacity texture map is

greater than this threshold, the material will be executed as normal. When the value is less than or equal to this threshold, the material will be cut out as if completely transparent.

當透明貼圖中的值大於這個閾值時,材質保持原始狀態。當值小於或者等於這個閾值時,物體將被裁剪。

Texture Repeats紋理重複

This option allows you to repeat the texture map image without having to repeat the uv coordinates.

此選項允許你重複貼圖圖像,而無須重複UV坐標。

How To Use如何使用

In order to enable sprite opacity cut-out on your material, this shadernode must be connected to the Surface shader material input in Softimage, whereas in Maya this connection is automatic when you assign the shader node to an object (through 『Assign Material To Selection』, for example). Once it is connected it will automatically affect shadow and photon shaders too, regardless of their individual shader graph inputs.

要在Softimage中使用Sprite節點在材質上作剪切,必須將其與表面材質Material的Input連接。在Maya中,只需要將這個材質節點賦予物體即可(例如通過Assign Material To Selection)。連接好以後,無論它們中的每個著色器網路輸入是怎樣,Shadow(陰影)和Photon(光子)節點會自動連接上。

Valid shading group using the Sprite node, placed at the head of the shader graph

The Sprite shader node settings must be correct in order for it to function. Here are the conditions:

為正常運行,Sprite Shader節點必須設著正確。條件如下:

  • A texture map file must be assigned.必須指定一個貼圖文件。
  • The texture space uv channel assignment must exist in the mesh the material is assigned to.在材質被賦予的物體中,必須包含Texture Space UV信息。

If one or more of these conditions are not met, the sprite shader will be disabled. When there is a texture space miss-match, Redshift will also issue a warning or an error (see below).

如果上述條件有一個不滿足,Sprite材質將無法使用。如果無法匹配Texture Space(紋理空間),Redshift將發出警告或者錯誤提示(見下文)。

Warnings and Errors警告和錯誤

Proxy Mesh代理物體

If you wish to assign a new material with a sprite node to an imported proxy mesh,

it is important to make sure the texture space uv channel property that your new sprite shader will use was exported with the proxy. If the proxy mesh does not contain the named uv channel, you will see this warning:

如果想給一個代理物體指定一個Sprite節點,一定要確保導出時,代理中包含可以被Sprite正確訪問的Texture Space UV信息。如果代理中不包含有名字的UV信息,將看到以下警告:

「Mesh『NAME』 is a proxy and is using a sprite shader node that is referencing a uv

channel that does not exist on the original exported proxy.」

(物體Name為代理,Sprite Shader節點無法訪問到UV信息,因為代理在輸出時沒有導出)

Instanced Mesh實例物體

As with Proxy Meshes, an instanced mesh (or model) template must contain the texture space uv channel property that your new sprite shader will use. If the instanced mesh does not contain the named uv channel, you will see this

warning:

與代理物體相同,instanced物體的實例模版也必須包含Texture Space UV信息供Sprite節點使用。若Instanced物體中不包含指定的UV通道,你將看到以下警告:

「Mesh『NAME』 is instanced and its instances are using a sprite shader node that isreferencing a uv channel that does not exist.「

(物體Name被實例化了,而其實例正使用Sprite節佔為,但無法訪問一可用的UV信息)

Another more problematic situation will arise if your instanced mesh template uses asprite shader that references a differentuv channel to the instance, but both channels exist. In this case, you will actually get the following error message and rendering will be aborted:

另一種更嚴重的問題是,如果物體實例使用了Sprite節點,但物體實例使用了不同的UV通道,所有UV通道都存在。這種情況下,會出現以下報錯信息,同時渲染終止。

「Mesh『NAME』 is instanced and its instances are using a sprite shader node that isreferencing a different uv channel to the template. Aborting rendering.」

(Name物體被實例化了,其實例使用了Sprite節點,並引用了不同的UV信息。渲染停止。)

Instanced Proxy Mesh實例代理網路 

An instanced proxy mesh will have had its sprite node uv channel baked into it on

export (if it exists and is even using a sprite node shader). So, bearing thisin mind, if you instance a proxy mesh, the original proxy material must also beusing a sprite node with a matching uv channel to your instance. Failure to dothis will result in the following error and rendering will be aborted:

實例代理物體中果賦予了Sprite節點,那麼在導出時,先要包含UV信息。因此請記住,如果要為代理為實例化,原始的代理材質只要用到Sprite節點,就必須是擁有匹配UV信息的。否則渲染無法進行,並顯示下列錯誤:

「Mesh『NAME』 is instanced and its instances are using a sprite shader node that is

referencing a different uv channel to the one exported with proxy template.Aborting rendering.」

(物體Name已經被實例化,它的實例正在使用Sprite節點,但Sprite節點引用UV信息,與物體導出成代理模版時不同。渲染停止。)


推薦閱讀:
相关文章