Unity 标准粒子着色器是可用于渲染各种粒子系统效果的内置着色器。这些着色器提供标准着色器不具备的各种粒子特有功能。
要使用粒子着色器,请执行以下操作:
1.选择要将着色器应用到的材质。例如,可将火焰材质应用于火焰粒子系统效果。
2.在材质 (Material) 的 Inspector 中,选择 Shader Particles。
3.选择要使用的粒子着色器,例如 Standard Surface。
4.在 Inspector 中启用和禁用各种粒子着色器属性。
标准粒子着色器具有与标准着色器相同的属性集(或这些属性的子集,具体取决于着色器)。本页面将介绍标准着色器属性之外的其他属性和选项。如需了解标准着色器属性的信息,请参阅有关材质参数的文档。
所有标准粒子着色器都具有__混合选项 (Blending Options)__,允许以不同方式将粒子与周围的对象混合。
属性: | 功能: |
---|---|
Rendering Mode | The Standard Particle Shaders can have the following additional Rendering Mode options: Additive: Adds the background and particle colors together. This is useful for glow effects, like those you might use for fire or magic spells. Subtractive: Subtracts particle colors from the background, which darkens the particles against the background. This is useful for foggy effects, like those you might use for steam, or thick black smoke. Modulate: Multiplies the material pixels with the background color. This is useful for portals and light-rays. |
Color Mode | Control how the albedo texture is combined with the particle color. The Color Mode options are: Multiply: Multiplies the particle color with the particle texture. Additive: Preserves a hot spot, such as a white part of the particle texture, while adding the particle color to the darker pixels of the texture. Subtractive: Subtracts the particle color from the particle texture. Overlay: Gives more contrast to the original color and adds the particle color to the gray values. This is similar to Additive, but preserves the original colors. Color: Uses the alpha channel from the particle texture and the color from the particle itself. This is useful for overwriting particles with the same color, while keeping their original “shape”. Difference: Subtracts the particle color from the texture, or the texture from the color, to get a positive value. This is useful for a range of effects where you want a more dynamic color change. See image below table for a demonstration of this effect. |
属性 | 功能 |
---|---|
Flip-Book Mode | 将翻页渲染为单独的帧或将帧混合在一起以提供更流畅的动画。设置为以下选项之一: Simple - 将翻页中的帧渲染为单帧序列。 Blended - 混合翻页中的帧以将翻页渲染为平滑动画。 |
Two Sided | 渲染粒子的正面和背面。禁用时,Unity 仅渲染几何体的正面,即摄像机视图中的面。 |
Enable Soft Particles | Fade out particles when they get close to the surface of objects written into the depth buffer. This is useful for avoiding hard edges when particles intersect with opaque geometry. For example, by enabling soft particles, you can make the particle system emit particles close to an opaque surface without causing harsh intersections with the surface: |
Enable Camera Fading | 当粒子接近摄像机时淡出粒子。设置为: Near fade - 距离最近的粒子从摄像机视野中淡出之前可以到达摄像机。 Far fade - 距离最远的粒子在从摄像机视野中淡出之前可以远离摄像机。 |
Enable Distortion | Make particles perform fake refraction with the objects drawn before them. Distortion is ideal for creating heat haze effects for fire, for example:This effect can be quite expensive because it captures the current frame to a texture. |
此着色器具有与标准着色器类似的功能,但特别适合粒子。与标准着色器一样,此着色器支持基于物理着色。不包括那些不适合动态粒子的功能,例如光照贴图。
这种简单的着色器比表面着色器更快。支持所有通用粒子控件,例如翻页混合和失真,但不执行任何光照计算。