URP——着色器和材质——简单光照 Simple Lit

Simple Lit Shader

当性能比写实更重要时,使用这个着色器。这个着色器使用一个简单的近似的照明。因为这个着色器不计算物理正确性和能量守恒,它渲染迅速。

Using the Simple Lit Shader in the Editor

选择和使用这个着色器:

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

UI overview

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

Surface Options

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

PropertyDescription
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

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

PropertyDescription
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通道或颜色。

Specular Map

Controls the color of your specular highlights from direct lighting, for example Directional, Point, and Spot lights. To assign a Texture to the Specular 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
In Source, you can select a Texture in your Project to act as a source for the smoothness. By default, the source is the Alpha channel for this Texture. 
You can use the Smoothness slider to control the spread of highlights on the surface. 0 gives a wide, rough highlight. 1 gives a small, sharp highlight like glass. Values in between produce semi-glossy looks. For example, 0.5 produces a plastic-like glossiness.

从直接照明控制您的高光的颜色,例如方向灯,点,和聚光灯。要为高光贴图设置一个纹理,点击它旁边的对象选择器。这会打开资产浏览器,在那里你可以从你的项目的纹理中选择。或者,您可以使用颜色选择器。

在Source中,您可以在项目中选择一个纹理作为平滑度的源。默认情况下,源是这个纹理的Alpha通道。

您可以使用平滑滑块来控制表面上高光的扩展。0给出了粗浅的高光。1给出一个小的,尖锐的高光像玻璃。介于两者之间的值会产生半光滑的外观。例如,0.5可以产生类似塑料的光泽度。

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将自发光设置为黑色,并且不计算自发光。

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

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

ropertyDescription
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渲染管道中的渲染队列。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值