URP渲染管线与Buildin管线的区别

URP介绍

        UPR前身是LWRP,区别是URP集成了postProcessing。主要是为移动平台设计。UPR相当于SBP(可编程渲染管线)里的一个模板。Universal RP包里可以看到源码。

区别:

        1.光照: 

        传统Bulidin渲染管线的光照是多Pass渲染,每多一个动态光就多一个Pass,这个光影响的物体就要多画一遍。eg:所有物体都受动态光影响,则m个动态光,n个物体,绘制次数m*n。

        URP实现了单Pass渲染光照。也就是上面的例子,最后绘制只需要n次。但URP中限制了灯光的数量。目前是支持1詹平行光,每个对象最多只能接受4个动态光。(版本不同可能不一样)

          2.URP的shader可以使用 Shader Graph,HLSL编写的shader,CG语言因为已经停止更新很多年,所以使用的代码库是HLSL。也支持CG,比如:Bulidin管线中使用CG的Unlit Shader可以延用。Bulidin管线中的其他shader都不能支持。

        3.批处理:

        之前Unity支持:动态批处理,静态批处理,GPU Instancing。SRP在原来的基础上还支持SRP Batcher。SRP Batcher不会减少Draw Call数量,但可以减少Set Pass Call的数量。并减少绘制命令的开销。

        减少绘制命令的开销的原因:CPU不需要每帧都给GPU发送渲染数据,如果数据没有变化,就保存在GPU内存中,每个绘制仅调用包含一个指向正确内存位置的偏移量。(值传递变成了引用传递?!)

        减少Set Pass Call的原因:传统批处理的前提是同一材质,SRP的判断依据是Shader 变种是否变化,Shader变种相同,即使是不同材质都不会被打断。

底层原理:

SRP会在主存中将模型的坐标信息、材质信息、主光源信息阴影参数和非主光源阴影参数分别保存到不同的CBUFFER(常量缓冲区)中,只有CBUFFER发生变化才会重新提交到GPU并保存。

CBUFFER在Shader中就是包含各种声明的Property。所以支持CG的UnlitShader是不能使用SRP

Batcher的。只有使用了名为UnityPerMaterial的CBUFFER才能使用SRP Batcher。

 官网上的对比:

 

 

  • 2
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Do you wish you had debug views in LWRP / URP? Do you wish it was easy to add custom debug views? That it was accessible in game view and in builds? URP Debug Views - A unique plugin that adds debug views support for LWRP / URP and more! TLDR URP Debug Views adds must have features for anyone that uses LWRP / URP: - most of the debug views from the built-in renderer (including Shaded Wireframe!) - works in scene view, game view and in builds - add your own debug view with a single shader Available debug views - Shaded Wireframe - World normals - World tangents - Shadow cascades - Overdraw - Vertex color R - Vertex color G - Vertex color B - Vertex color RGB - Vertex color A - UV0 Checker - UV1 Checker Available everywhere Debug views work in scene view, game view but also in builds. It has been tested on various PCs, Mac, Android and VR. Custom Adding custom debug views is very easy, a single shader is enough! You can then plug the newly created debug view in an editor menu, shortcuts or a custom in-game menu. Time saver Being able to check problems and iterate on them quickly is very important, especially if you are an indie game developper. "Why is this vertex color not working? Is the problem coming from the mesh, Unity or the shader?" "What is this visual bug, is it coming from the geometry or the textures?" Any of theses questions and many more can be answered in one click by using the correct view. Without any debug view, it can take 10 minutes, an hour, or more. Less time fixing problems means more time working on your game. Your time is important, value it! Full source code included! Support I'm dedicated to make this asset a must-have for LWRP / URP. I answer to email and do my best to fix bugs and implement feature request. Please don't hesitate to contact me for feedback, ideas or bug report at ph.graphics.unity@gmail.com You can also come and chat on Discord at https://discord.gg/ksURBah If you are not convinced yet, you can look at reviews for

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值