当前位置:网站首页>Unity URP entry practice
Unity URP entry practice
2022-07-26 15:07:00 【T.D.C】
Reading guide
This article tells
How to use from the application level URP
How to code for URP Add more rendering features
If you expand URP Post treatment effect of
URP Pipeline properties
The number of light sources :
Straight light plus 4 Other light sources
There are many built-in pipelines Pass Forward Rendering, Will use new for additional light sources when there are multiple light sources FowardAdd Pass Calculation ,Pass Quantity is the number of light sources that affect an object , The maximum value is 8
shortcoming :
1 Multi camera overlay is not supported
2 Defferred Renderring, Now? URP There is no delayed rendering , There is no time domain anti aliasing TAA
Use URP The first step is to configure URP Of Asset

get 2 Configuration files

Change your name

Setting graphics options

Configure quality options
Do not configure this in Camera I can't choose among them Renderer

Configure post-processing

Drag it up

by URP Add new rendering features :CustomRenderPassFeature
principle :XXXFeature Class provides XXXPass to Renderer, This adds a rendering feature

At this point you get a RenderFeature class

There is template code , It can be expanded as needed
Expand post-processing
expand URP The principle of post-processing
Use a last executed Pass, Process the rendered output of the current camera
step
1 New class inheritance Volume, This step is to provide data settings for post-processing . You can not do this step , Because you can go directly RenderFeature You can also read in the configuration of
2 Add one more renderer feature, In this Feature Create custom pass, stay pass After treatment in
For post-treatment shader
Use Shader Graph Or write your own URP Of shader, Use this shader Build a material , Use this material to finish post-processing
One thing to note is , If you don't want to make additional settings ,shader The name of the input map in is dead _MainTex
Customization for post-processing RenderPassFeature Sample code
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class TestUrpPostRenderPassFeature : ScriptableRendererFeature
{
public Material postMat;
class CustomRenderPass : ScriptableRenderPass
{
private int effectRtPropId = Shader.PropertyToID("testUrpRt");
private RenderTargetIdentifier effectRtId;
private RenderTargetIdentifier source;
public Material postMat;
public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
{
source = renderingData.cameraData.renderer.cameraColorTarget;
RenderTextureDescriptor descriptor = renderingData.cameraData.cameraTargetDescriptor;
descriptor.depthBufferBits = 0;
cmd.GetTemporaryRT(effectRtPropId, descriptor, FilterMode.Bilinear);
effectRtId = new RenderTargetIdentifier(effectRtPropId);
// Debug.Log("custom urp setup camera");
}
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
{
CommandBuffer cmd = CommandBufferPool.Get("Custom Post Processing");
cmd.Clear();
Blit(cmd, source, effectRtId, postMat);
Blit(cmd, effectRtId, source);
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
// Debug.Log("custom urp execute");
}
public override void OnCameraCleanup(CommandBuffer cmd)
{
cmd.ReleaseTemporaryRT(effectRtPropId);
// Debug.Log("custom urp release");
}
}
CustomRenderPass m_ScriptablePass;
public override void Create()
{
m_ScriptablePass = new CustomRenderPass();
m_ScriptablePass.renderPassEvent = RenderPassEvent.AfterRenderingTransparents;
m_ScriptablePass.postMat = postMat;
}
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
renderer.EnqueuePass(m_ScriptablePass);
}
}
Reference material
See the official documents for the introduction of application
Shader Stripping | Package Manager UI website
Realize analysis and explanation
[Universal RP]Unity General rendering pipeline learning - You know
References for post-processing
renderer feature:
Unity3D URP Use in Render Feature Achieve post-processing effect - whcsrl_ Technical network
Custom Post Processing in Unity URP | Febucci
volume
Code
Get the output of the current camera RenderTargetIdentifier
var renderer = renderingData.cameraData.renderer;
source = renderer.cameraColorTarget;
边栏推荐
- Winscp transfer file and VNC connection problem
- R语言ggplot2可视化:使用ggpubr包的ggballoonplot函数可视化气球图(可视化由两个分类变量组成的列联表)、配置guides函数中的size参数指定不显示数据点大小的图例
- 带你熟悉云网络的“电话簿”:DNS
- Huawei applications have called the checkappupdate interface. Why is there no prompt for version update in the application
- Simple implementation of pytorch
- Ner of NLP: Exploration and practice of product title attribute recognition
- Cve-2022-33891 vulnerability recurrence
- 精益产品开发:原则、方法与实施
- Character function and string function and memory function
- Deep packet inspection using quotient filter paper summary
猜你喜欢

OpenGL学习日记2——着色器

RPN:Region Proposal Networks (区域候选网络)

Simple implementation of pytorch

C# 给Word每一页设置不同文字水印

Double the efficiency of dual screen collaboration lingyao x dual screen Pro leads the new trend of dual screen technology

1. Sum of two numbers

AMB | towards sustainable agriculture: rhizosphere microbial engineering

JS analog clock with text label
![[2022 national game simulation] Bai Loujian - Sam, rollback Mo team, second offline](/img/e1/0574dd4eb311e79afdb1d071f59c4d.png)
[2022 national game simulation] Bai Loujian - Sam, rollback Mo team, second offline

The practice of software R & D should start from the design
随机推荐
DevSecOps,让速度和安全兼顾
Whaledi message queue stability improvement practice
SA-Siam:用于实时目标跟踪的孪生网络
7. In JS [] = =! [] Why is it true?
oss删除当前时间前两天的所有文件
JS analog clock with text label
CVE-2022-33891漏洞复现
Chuhuan technology is listed on Shenzhen Stock Exchange: Minsheng securities, with a market value of 2.7 billion, is a shareholder
生泰尔科技IPO被终止:曾拟募资5.6亿 启明与济峰资本是股东
Cve-2022-33891 vulnerability recurrence
Postman environment variable setting code storage
R语言ggplot2可视化:使用ggpubr包的ggballoonplot函数可视化气球图(可视化由两个分类变量组成的列联表)、配置guides函数中的size参数指定不显示数据点大小的图例
Sexy prime number (summer vacation daily question 1)
本科毕业论文外文文献翻译怎么找?
Summary of target tracking related knowledge
PyTorch中 nn.Conv2d与nn.ConvTranspose2d函数的用法
NLP之NER:商品标题属性识别探索与实践
什么是传输层协议TCP/UDP???
The leader took credit for it. I changed the variable name and laid him off
华为应用已经调用了checkAppUpdate接口,为什么应用内不提示版本更新