[Unity]URP学习记录(2)

2020/09 12 19:09

在Shader的Inspector中,可以查看

Surface shader:URP不支持Surface shader,URP一般为no
Fixed function:固定管线(老显卡)-URP一般为no
Compiled code:编译Shader并查看代码
Cast Shadows:投射阴影
Render queue:渲染次序
LOD:LOD值
Ignore projector:忽略投影
Disable batching:禁用合批
Keywords:编译宏
SRP Batcher: compatible / not compatible(兼容&非兼容)

如果Shader中 使用了
CBUFFER_START(UnityPerMaterial)
CBUFFER_END
则兼容,反之不兼容

相关资料:

https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@8.0/manual/index.html

https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@8.0/manual/shaders-in-universalrp.html

配置URP

一、创建URPAsset
1、URPAsset 控制项目中全局的渲染和质量配置,
以及创建渲染管线实例(rendering pipeline instance),
渲染管线实例包含中间资源和渲染管线实现。
2、按以下步骤创建URPAsset
在编辑器Project中,Create > Rendering > Universal Render Pipeline > Pipeline Asset

二、将URPAsset配置到图形设置中
如果不配置,则Unity仍然使用内置渲染管线
1、Edit > Project Settings > Graphics
将URPAsset拖到 Scriptable Render Pipeline Settings

三、升级Shader
内置Shader不支持URP,需要进行切换
1、使用内置切换功能
Edit > Render Pipeline > Universal Render Pipeline
根据需求点 Upgrade Project Material to URP Materials 或者 Upgrade Selected Materials to URP Materials
Tips: 如果升级后Project中的缩略图错了,可以选择Reimport All
Tips: SpeedTree的Shader,需要 “Generate Materials”或者 “Apply & Generate Materils”

Shader升级列表

Unity built-in shaderUniversal Render Pipeline shader
StandardUniversal Render Pipeline/Lit
Standard (Specular Setup)Universal Render Pipeline/Lit
Standard TerrainUniversal Render Pipeline/Terrain/Lit
Particles/Standard SurfaceUniversal Render Pipeline/Particles/Lit
Particles/Standard UnlitUniversal Render Pipeline/Particles/Unlit
Mobile/DiffuseUniversal Render Pipeline/Simple Lit
Mobile/Bumped SpecularUniversal Render Pipeline/Simple Lit
Mobile/Bumped Specular(1 Directional Light)Universal Render Pipeline/Simple Lit
Mobile/Unlit (Supports Lightmap)Universal Render Pipeline/Simple Lit
Mobile/VertexLitUniversal Render Pipeline/Simple Lit
Legacy Shaders/DiffuseUniversal Render Pipeline/Simple Lit
Legacy Shaders/SpecularUniversal Render Pipeline/Simple Lit
Legacy Shaders/Bumped DiffuseUniversal Render Pipeline/Simple Lit
Legacy Shaders/Bumped SpecularUniversal Render Pipeline/Simple Lit
Legacy Shaders/Self-Illumin/DiffuseUniversal Render Pipeline/Simple Lit
Legacy Shaders/Self-Illumin/Bumped DiffuseUniversal Render Pipeline/Simple Lit
Legacy Shaders/Self-Illumin/SpecularUniversal Render Pipeline/Simple Lit
Legacy Shaders/Self-Illumin/Bumped SpecularUniversal Render Pipeline/Simple Lit
Legacy Shaders/Transparent/DiffuseUniversal Render Pipeline/Simple Lit
Legacy Shaders/Transparent/SpecularUniversal Render Pipeline/Simple Lit
Legacy Shaders/Transparent/Bumped DiffuseUniversal Render Pipeline/Simple Lit
Legacy Shaders/Transparent/Bumped SpecularUniversal Render Pipeline/Simple Lit
Legacy Shaders/Transparent/Cutout/DiffuseUniversal Render Pipeline/Simple Lit
Legacy Shaders/Transparent/Cutout/SpecularUniversal Render Pipeline/Simple Lit
Legacy Shaders/Transparent/Cutout/Bumped DiffuseUniversal Render Pipeline/Simple Lit
Legacy Shaders/Transparent/Cutout/Bumped SpecularUniversal Render Pipeline/Simple Lit