天天看点

URP——着色器和材质——粒子无光照着色器 Particles Unlit ShaderParticles Unlit Shader

重要提示:此页面在2019.1测试周期中可能会发生更改。

Particles Unlit Shader

对不需要光照的粒子使用这个着色器。因为没有耗时的照明计算或查找,这个着色器是最优的低端硬件。Unlit着色器在通用渲染管道(URP)中使用最简单的阴影模型。

Using the Particles Unlit Shader in the Editor

选择和使用这个着色器:

  1. 在你的项目中,创建或找到你想使用着色器的材质。选择材质。这时会打开一个材质检查窗口。
  2. 点击着色器,选择Universal Render Pipeline > Particles > Unlit。

UI overview

这个着色器的检查器窗口包含以下元素:

  • Surface Options
  • Surface Inputs
  • Advanced
URP——着色器和材质——粒子无光照着色器 Particles Unlit ShaderParticles Unlit Shader

Surface Options

Surface选项控制URP如何在屏幕上渲染材质。

Property Description
Surface Type

Use this drop-down to apply an Opaque or Transparent surface type to the Material. This determines which render pass URP renders the material in. Opaque surface types are always fully visible, regardless of what’s behind them. URP renders opaque Materials first. Transparent surface types are affected by their background, and they can vary according to which type of transparent surface type you choose. URP renders transparent Materials in a separate pass after opaque objects. If you select Transparent, the Blending Mode drop-down appears.

使用此下拉菜单为材质应用不透明或透明的表面类型。这决定了URP的渲染路径。不透明的表面类型总是完全可见的,不管它们背后是什么。URP首先渲染不透明的材料。透明表面类型受其背景的影响,它们可以根据您选择的透明表面类型的类型而变化。URP在不透明对象之后单独渲染透明材质。如果你选择透明,混合模式下拉菜单就会出现。

Blending Mode

Use this drop-down to determine how URP calculates the color of each pixel of the transparent Material by blending the Material with the background pixels.

Alpha uses the Material’s alpha value to change how transparent an object is. 0 is fully transparent. 1 appears fully opaque, but the Material is still rendered during the Transparent render pass. This is useful for visuals that you want to be fully visible but to also fade over time, like clouds.

Premultiply applies a similar effect to the Material as Alpha, but preserves reflections and highlights, even when your surface is transparent. This means that only the reflected light is visible. For example, imagine transparent glass.

Additive adds an extra layer to the Material, on top of another surface. This is good for holograms. 

Multiply multiplies the color of the Material with the color behind the surface. This creates a darker effect, like when you look through colored glass.

使用这个下拉列表来确定URP如何通过混合材质和背景像素来计算透明材质的每个像素的颜色。

Alpha使用材质的Alpha值来改变物体的透明度。0是完全透明的。1显示完全不透明,但是在透明渲染过程中材质仍然被渲染。这对于那些你想要完全可见但又想要随着时间逐渐消失的图像,比如云,是很有用的。

Premultiply 在材质上应用了类似Alpha的效果,但是保留了反射和高光,即使你的表面是透明的。这意味着只有反射光是可见的。例如,想象一下透明的玻璃。

在材料的另一个表面上增加一个额外的层。这对全息图很有用。

Multiply 将材料的颜色与表面后面的颜色进行叠加。这会产生一种更暗的效果,就像你透过彩色玻璃看东西一样。

Render Face

Use this drop-down to determine which sides of your geometry to render.

Front Face renders the front face of your geometry and culls the back face. This is the default setting. 

Back Face renders the front face of your geometry and culls the front face. 

Both makes URP render both faces of the geometry. This is good for small, flat objects, like leaves, where you might want both sides visible.

使用这个下拉菜单来确定要渲染几何图形的哪一面。

Front Face 渲染几何图形的前面并剔除后面。这是默认设置。

Back Face 渲染几何图形的前面并剔除前面。

Both 两者都使URP渲染几何图形的两面。这对小而扁平的物体很有用,比如叶子,你可能想让它的两边都可见。

Alpha Clipping

Makes your Material act like a Cutout Shader. Use this to create a transparent effect with hard edges between the opaque and transparent areas. For example, to create blades of grass. To achieve this effect, URP does not render alpha values below the specified Threshold, which appears when you enable Alpha Clipping. You can set the Threshold by moving the slider, which accepts values from 0 to 1. All values above your threshold are fully opaque, and all values below your threshold are invisible. For example, a threshold of 0.1 means that URP doesn't render alpha values below 0.1. The default value is 0.5.

使你的材质表现得像一个剪切着色器。使用这个在不透明和透明区域之间创建一个有硬边的透明效果。例如,创建草的叶片。为了实现此效果,URP不渲染低于指定阈值的alpha值,阈值在启用alpha剪切时出现。您可以通过移动滑块来设置阈值,滑块接受从0到1的值。阈值以上的所有值都是不透明的,而阈值以下的所有值都是不可见的。例如,阈值为0.1意味着URP不渲染低于0.1的alpha值。默认值是0.5。

Color Mode

Use this drop-down to determine how the particle color and the Material color blend together.

Multiply produces a darker final color by multiplying the two colors.

Additive produces a brighter final colour by adding the two colours together.

Subtractive subtracts the particle color from the base color of the Material. This creates an overall dark effect in the pixel itself, with less brightness.

Overlay blends the particle color over the base color of the Material. This creates a brighter color at values over 0.5 and darker colors at values under 0.5.

Color uses the particle color to colorize the Material color, while keeping the value and saturation of the base color of the Material. This is good for adding splashes of color to monochrome Scenes.

Difference returns the difference between both color values. This is good for blending particle and Material colors that are similar to each other.

使用下拉菜单来确定粒子颜色和材质颜色是如何混合在一起的。

Multiply通过将两种颜色相乘产生一种更暗的最终颜色。

Additive通过将两种颜色加在一起产生更亮的最终颜色。

Subtractive 从材料的基色中减去粒子的颜色。这在像素本身创建了一个整体的黑暗效果,亮度较低。

Overlay 覆盖混合粒子颜色在材料的基础颜色上。这在值大于0.5时创建了更亮的颜色,在值小于0.5时创建了更暗的颜色。

Color 颜色使用粒子颜色着色的材料颜色,同时保持的价值和饱和度的基础颜色的材料。这对于在单色场景中添加飞溅的颜色很有用。

Difference 返回两个颜色值之间的差值。这对于混合相似的粒子和材料颜色很好。

Surface Inputs

表面输入描述了表面本身。例如,您可以使用这些属性使您的表面看起来湿、干、粗糙或光滑。

Property Description
Base Map

Adds color to the surface, also known as the diffuse map. To assign a Texture to the Base Map setting, click the object picker next to it. This opens the Asset Browser, where you can select from the Textures in your Project. Alternatively, you can use the color picker. The color next to the setting shows the tint on top of your assigned Texture. To assign another tint, you can click this color swatch. If you select Transparent or Alpha Clipping under Surface Options, your Material uses the Texture’s alpha channel or color.

为表面添加颜色,也称为漫反射贴图。要为基础贴图设置分配纹理,请单击它旁边的对象选择器。这会打开资产浏览器,在那里你可以从你的项目的纹理中选择。或者,您可以使用颜色选择器。设置旁边的颜色显示了你分配的纹理上的色彩。要指定另一种色调,可以单击这个色板。如果你在表面选项下选择透明或Alpha剪裁,你的材质会使用纹理的Alpha通道或颜色。

Normal Map

Adds a normal map to the surface. With a normal map, you can add surface details like bumps, scratches and grooves. To add the map, click the object picker next to it. The normal map picks up ambient lighting in the environment. 

The float value next to the setting is a multiplier for the effect of the Normal Map. Low values decrease the effect of the normal map. High values create stronger effects.

向表面添加法线贴图。使用法线贴图,您可以添加表面细节,如凹凸、划痕和凹槽。要添加贴图,单击它旁边的对象选择器。法线贴图拾取环境中的光线。

该设置旁边的浮点值是法线贴图效果的乘数。低值会降低法线贴图的效果。价值越高,效果越强。

Emission

Makes the surface look like it emits lights. When enabled, the Emission Map and Emission Color settings appear.

To assign an Emission Map, click the object picture next to it. This opens the Asset Browser, where you can select from the textures in your Project.

For Emission Color, you can use the color picker to assign a tint on top of the color. This can be more than 100% white, which is useful for effects like lava, that shines brighter than white while still being another color.

If you have not assigned an Emission Map, the Emission setting only uses the tint you’ve assigned in Emission Color.

If you do not enable Emission, URP sets the emission to black and does not calculate emission.

使表面看起来像在发光。启用后,Emission Map自发光贴图和Emission Color 自发光颜色设置就会出现。

若要分配自发光贴图,请单击它旁边的对象图片。这会打开资产浏览器,在那里你可以从你的项目的纹理中选择。

对于自发光颜色,您可以使用颜色选择器在颜色的顶部分配一个色调。这可以是超过100%的白色,这对效果很有用,如熔岩,闪耀比白色更明亮,但仍然是另一种颜色。

如果您没有分配一个自发光贴图,发光设置只使用您在自发光颜色中分配的着色。

如果不启用自发光,URP将自发光设置为黑色,并且不计算自发光。

Advanced

高级设置会影响渲染的底层计算。它们对你的表面没有明显的影响。

roperty Description
Flip-Book Blending

Tick this box to blend flip-book frames together. This is useful in texture sheet animations with limited frames, because it makes animations smoother. If you have performance issues, try turning this off.

勾选这个框,将flip-book frames混合在一起。这在有限帧的纹理贴图动画中非常有用,因为它可以使动画更流畅。如果您有性能问题,请尝试关闭此功能。

Vertex Streams

This list shows the vertex streams that this Material requires in order to work properly. If the vertex streams aren’t correctly assigned, the Fix Now button appears. Click this button to apply the correct setup of vertex streams to the Particle System that this Material is assigned to.

这个列表显示了该材质正常工作所需要的顶点流。如果顶点流没有被正确分配,现在修复按钮出现。单击此按钮将顶点流的正确设置应用到该材质指定的粒子系统。

Priority

Use this slider to determine the chronological rendering order for a Material. URP renders Materials with higher values first. You can use this to reduce overdraw on devices by making the pipeline render Materials in front of other Materials first, so it doesn't have to render overlapping areas twice. This works similarly to the render queue in the built-in Unity render pipeline.

使用这个滑块来决定材质的渲染顺序。URP首先渲染较高值的材质。您可以使用它来减少设备上的过度渲染,方法是让管线首先在其他材质之前渲染材质,这样它就不需要渲染两次重叠的区域。这类似于内置的Unity渲染管道中的渲染队列。

Transparent surface type

如果你在表面选项下选择了透明表面类型,这些选项会出现:

URP——着色器和材质——粒子无光照着色器 Particles Unlit ShaderParticles Unlit Shader
Property Description
Soft Particles

Tick this box to make particles fade out when they get close to intersecting with the surface of other geometry written into the depth buffer.

When you enable this feature, the Surface Fadesettings appear:

Near sets the distance from the other surface where the particle is completely transparent. This is where the particle appears to fade out completely.

Far sets the distance from the other surface where the particle is completely opaque. The particle appears solid here.

Distances are measured in world units. Only usable for transparent surface types.

Note: This setting uses the 

CameraDepthTexture

 that is created by URP. To use this setting, enable Depth Texture in the URP Asset or for the Camera that is rendering the particles.

勾选这个框,当粒子接近与写入深度缓冲区的其他几何图形相交时,使其淡出。

当您启用此功能时,出现表面淡出设置:

Near 设置了粒子与另一个完全透明的表面的距离。这就是粒子完全消失的地方。

Far 表示粒子与另一个完全不透明的表面之间的距离。粒子在这里看起来是固体。

距离是用世界单位来测量的。只能用于透明的表面类型。

注意:这个设置使用了URP创建的CameraDepthTexture。要使用这个设置,请在URP资产或渲染粒子的相机中启用深度纹理。

Camera Fading

Tick this box to make particles fade out when they get close to the camera.

When you enable this feature, the Distancesettings appear:

Near sets the distance from the camera where the particle is completely transparent. This is where the particle appears to fade out completely.

Far sets the distance from the camera where the particle is completely opaque. The particle appears solid here.

Distances are measured in world units. 

Note: This uses the 

CameraDepthTexture

 that is created by URP. To use this setting, enable Depth Texture in the URP Asset or for the Camera that is rendering the particles.

勾选这个框,让粒子在靠近相机时淡出。

当您启用此功能,出现距离设置:

Near 设置了从相机到粒子完全透明的距离。这就是粒子完全消失的地方。

Far 设置了粒子到摄像机的完全不透明的距离。粒子在这里看起来是固体。

距离是用世界单位来测量的。

注意:这使用了URP创建的CameraDepthTexture。要使用这个设置,请在URP资产或渲染粒子的相机中启用深度纹理。

Distortion

Creates a distortion effect by making particles perform refraction with the objects drawn before them. This is useful for creating a heat wave effect or for warping objects behind the particles. 

When you enable this feature, these settings appear:

Strength controls how much the Particle distorts the background. Negative values have the opposite effect of positive values. So if something was offset to the right with a positive value, the equal negative value offsets it to the left.

Blend controls how visible the distortion is. At 0, there is no visible distortion. At 1, only the distortion effect is visible.

Note: This uses the 

CameraOpaqueTexture

 that is created by URP. To use this setting, enable Opaque Texture in the URP Asset or for the Camera that is rendering the particles.

通过使粒子与之前绘制的物体进行折射来创建失真效果。这对于创建热波效应或扭曲粒子后面的物体是有用的。

当您启用此功能时,将出现以下设置:

Strength 强度控制粒子扭曲背景的程度。负值与正值具有相反的效果。所以如果某个值向右偏移为正值,那么相等的负值就会向左偏移。

Blend 混合控制失真的可见性。在0时,没有可见的失真。在1,只有失真效果是可见的。

注意:这使用了URP创建的CameraOpaqueTexture。要使用此设置,请在URP资产中启用不透明纹理或为渲染粒子的摄像机启用不透明纹理。