Unlit Shader
在你的视觉不需要照明时,为特效或独特的对象使用这个着色器。因为没有耗时的照明计算或查找,这个着色器是最优的低端硬件。Unlit Shader使用了URP中最简单的阴影模型shading model。
Using the Simple Lit Shader in the Editor
选择和使用这个着色器:
- 在你的项目中,创建或找到你想使用着色器的材质。选择材质。这时会打开一个材质检查窗口。
- 点击着色器,选择Universal Render Pipeline > Unlit。
UI overview
这个着色器的检查器窗口包含以下元素:
- Surface Options
- Surface Inputs
- Advanced
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。 |
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通道或颜色。 |
Tiling | A 2D multiplier value that scales the Texture to fit across a mesh according to the U and V axes. This is good for surfaces like floors and walls. The default value is 1, which means no scaling. Set a higher value to make the Texture repeat across your mesh. Set a lower value to stretch the Texture. Try different values until you reach your desired effect. 一个2D倍增值,根据U和V轴缩放纹理以适应网格。对地板和墙壁这样的表面很好。默认值是1,这意味着没有缩放。设置一个更高的值使纹理在你的网格上重复。设置一个较低的值来拉伸纹理。尝试不同的值,直到达到你想要的效果。 |
Offset | The 2D offset that positions the Texture on the mesh. To adjust the position on your mesh, move the Texture across the U or V axes. 在网格上定位纹理的2D偏移量。为了调整网格的位置,在U轴或V轴上移动纹理。 |
Advanced
高级设置会影响渲染的底层计算。它们对你的表面没有明显的影响。
roperty | Description |
---|---|
Enable GPU Instancing | Makes URP render meshes with the same geometry and Material in one batch, when possible. This makes rendering faster. URP cannot render Meshes in one batch if they have different Materials or if the hardware does not support GPU instancing. 如果可能的话使URP渲染网格与相同的几何和材料在一批。这使得渲染速度更快。如果网格有不同的材质或者硬件不支持GPU实例化,URP不能在一批中渲染网格。 |
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渲染管道中的渲染队列。 |