Sprite Node 精灵节点

Introduction

引言

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.

红移精灵节点允许使用纹理来定义完全透明的表面部分。这对于创建细小、低多边形几何形状的细节非常有用。树叶就是一个很好的例子: 一棵树的叶子可以被模拟成四边形,但是每片叶子的形状可以来自于一个黑色和白色的纹理。另一种解决方案是用三角形/四边形建立每片叶子的形状模型,但这可能需要很多努力,并占用大量内存资源。

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.

在红移中,除了精灵节点,可以通过简单地将纹理连接到着色器的透明端口来达到同样的效果。在建筑着色器的例子中,可以将黑白纹理连接到着色器的“不透明剪裁”端口。

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. 它们会降低渲染器的性能。当一条光线撞击一个多边形时,红移必须执行特定的操作来读取纹理,设置下一条透明/折射光线,等等。如果射线击中多边形的一个“完全空”的部分,这些操作将是浪费
  • 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. 为了防止透明度/折射光过早终止并引入视觉伪影,必须增加透明度/折射迹深度

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.

红移精灵节点解决了这两个问题!首先,它是优化非常快速跳过一个多边形的空部分和非常少的操作。这可以产生远远优于透明度的性能。其次,它不依赖于折射迹深。因此,即使你的最大折射跟踪深度为零,光线仍然可以成功地通过任何不透明度/阿尔法裁剪和没有任何人工制品。

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

但是,为了实现这个性能,sprite 节点也有一些限制:

  • 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 " 精灵节点使用的纹理占用 GPU 内存,不能脱离核心。这意味着,如果你的场景使用了许多高分辨率的阿尔法纹理,红移可能会耗尽 GPU 内存。这与 Redshift 其他所有的纹理形成了鲜明的对比,这些纹理都是核心外的,可以是任何尺寸,而不会触发内存不足的问题。一个1024x1024精灵节点的纹理占用1mb 的内存,一个4K 的节点占用16mb 的内存等等。这些纹理占用的兆字节数显示在”Feedback Display 反馈显示" window. 窗户
  • No shader node 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. 不允许在精灵节点 alpha 纹理上进行着色节点操作。这意味着你不能使用着色器节点来调整纹理的外观,比如说变亮或变暗。或者能够在连接结果到精灵节点之前将多个 alpha 纹理混合在一起。因此,对精灵节点纹理的任何修改都必须在纹理创作工具中进行

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

下面是两个截图演示了使用架构着色器的透明剪切端口和使用精灵节点的 alpha-cutout。

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!

请注意,下面演示的巨大性能差异是因为多个堆叠的卡片是一种病态的情况。在这个场景中,所有的射线类型(主要的,GI,阴影,反射)都必须穿行并与许多层的 alpha 剪切几何图形相交。一个场景与较少的层将产生一个较小的性能利益-但利益无论如何!

C4D周练作业-Sprite Node 精灵节点—RS节点编辑器内容—Redshift红移中文帮助文档手册-苦七君

Scene rendered using the architectural node's 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.

使用建筑节点的不透明剪切特性渲染场景。即使有很高的跟踪深度限制,在图像的左上角仍然有人工制品。前两行之间还缺少一些反射。渲染时间大约为50秒,在低端 GPU 上。

C4D周练作业-Sprite Node 精灵节点—RS节点编辑器内容—Redshift红移中文帮助文档手册-苦七君

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.

使用精灵节点渲染场景。没有跟踪深度相关的工件。渲染时间大约是14秒在同一个 GPU 上作为上面的例子。跟踪深度限制保持不变,但是它们与 sprite 节点无关。

Parameters

参数

Shader Input

着色器输入

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

这是当精灵不被剪切时要执行的着色器图形。

Map

地图

This is the opacity cut out 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 着色器如何从纹理贴图中计算不透明度值。它可以通过以下两种方式中的一种得出:

  • From Color Intensity ( 从颜色强度(uses the RGB channel color information) 使用 RGB 通道颜色信息)
  • From Alpha ( 由阿尔法(uses the alpha channel information 使用阿尔法频道的信息)

Stencil Opacity Threshold 模板不透明阈值

This is the opacity cut out 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.

此选项允许您重复纹理贴图图像,而不必重复紫外线坐标。

How To Use

如何使用

In order to enable sprite opacity cut-out on your material, this shader node 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 的 Surface 着色器材质输入,而在 Maya 这个连接是自动的,当你分配着色器节点到一个对象(通过‘ Assign Material To Selection’,例如)。一旦连接,它将自动影响阴影和光子着色器也,不管他们的个人着色器图形输入。

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

Sprite 着色器节点的设置必须正确才能正常工作:

  • A texture map file must be assigned. 必须分配一个纹理映射文件
  • The texture space uv channel assignment must exist in the mesh the material is assigned to. 纹理空间 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).

如果一个或多个条件不满足,精灵着色器将被禁用。当有纹理空间错过匹配时,红移也会发出警告或错误(见下文)。

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:

如果你想给一个导入的代理网格分配一个带有精灵节点的新材质,确保你的新精灵着色器将要使用的纹理空间 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.

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:

和 Proxy mesh 一样,实例化的 mesh (或者模型)模板必须包含你的新 sprite 着色器将要使用的纹理空间 uv 通道属性。如果实例网格不包含命名的 uv 通道,你会看到这个警告:

Mesh 'NAME' is instanced and its instances are using a sprite shader node that is referencing a uv channel that does not exist."


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

如果你的实例化网格模板使用了一个精灵着色器,它引用了一个不同的 uv 通道到实例,但是这两个通道都存在,那么另一个问题就会出现。在这种情况下,您实际上会得到以下错误消息,并且渲染将被终止:

Mesh 'NAME' is instanced and its instances are using a sprite shader node that is referencing a different uv channel to the template. Aborting rendering.

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 this in mind, if you instance a proxy mesh, the original proxy material must also be using a sprite node with a matching uv channel to your instance. Failure to do this will result in the following error and rendering will be aborted:

一个实例化的代理网格将在导出时将其精灵节点 uv 通道烘烤进去(如果它存在,甚至使用精灵节点着色器)。所以,记住这一点,如果你实例一个代理网格,原始的代理材质也必须使用一个精灵节点与一个匹配的 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.
1

赶快留个言打破零评论!~

返回顶部

显示

忘记密码?

显示

显示

获取验证码

Close