Unity HDRP Custom Pass 实现场景雪地效果

先使用Shader Graph连一个使用模型法线添加雪地的shader,并赋给一个material。

1.1 先拿到模型世界坐标下的顶点法线,简单处理一下,赋给透明度即可。

给场景添加Custom Pass,剔除不需要的层级。

1.在Hierarchy界面中,右键创建Volume -> Custom Pass

2.添加Draw Renderers Custom Pass 到Custom Pass Volume 中

3.附上材质,调整渲染为 All Opaque, Forward ,深度测试可以测试一下Equal,Greater,Always,。

4.Always的效果:

解决报错(Your HDRP setting do not support Forwardonly, some objects might not renderer)。

1.解决该报错,需要调整当前使用的HDRP Asset的光照渲染模式为ForwardOnly

2.当前使用的HDRP Asset可在Edit -> Project settting -> Quality -> Rendering -> Render Pipeline Asset 查看到。

优化Shader Graph。

1.可以通过Frame Debugger中查看当前Custom Pass的渲染队列

Custom Pass 挂载的材质只是在原有材质上附加了一层,如果我们需要雪地的过度,就需要对用法线得到的透明度进行剔除。主要就是对法线操作。

效果:

相关推荐
狂人开飞机8 小时前
14、游戏手感与视觉打磨
游戏·游戏引擎·godot
狂人开飞机14 小时前
15、音频系统
游戏引擎·godot
狂人开飞机14 小时前
16、粒子线条与视觉特效
游戏引擎·godot
心前阳光1 天前
Unity发布PC软件图标不能改变
unity·游戏引擎
an86950011 天前
unity如何在visual studio中打断点debug
unity·游戏引擎·visual studio
xcLeigh1 天前
Unity基础:使用Transform控制物体移动——Translate与position详解
unity·游戏引擎
FairGuard手游加固1 天前
Unity小游戏加密:global-metadata.dat与AssetBundle保护
游戏·unity·游戏引擎
狂人开飞机2 天前
11、UI系统
游戏引擎·godot
真鬼1232 天前
【Unity AI】Untiy链接cursor与MCP
unity·游戏引擎
WarPigs2 天前
Unity设置人物位置无效的原因
unity