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

效果:

相关推荐
为你写首诗ge14 小时前
【Unity知识分享】Mirror实现房间等待功能(创建房间 / 搜索房间、加入房间、房间准备、房间内角色设置、返回房间)
unity·mirror·房间等待功能
游乐码14 小时前
Unity坦克案例疑难记录(二)
unity·游戏引擎
小白学鸿蒙15 小时前
Funplay Unity MCP 接入 trae 实战
unity·游戏引擎·mcp
相信神话202117 小时前
3.5《酒魂》体验与失败设计
游戏引擎·godot·godot4
游乐码18 小时前
Unity基础(一)游戏中的数学Mathf函数
游戏·unity·游戏引擎
地狱为王1 天前
Unity实现猫脸关键点检测
unity·游戏引擎·猫脸关键点检测
598866753@qq.com2 天前
Unity Job System笔记
unity
winlife_2 天前
Funplay Unity MCP 与 Unity AI Assistant 详细对比:开源 MCP 工具集 vs 官方全栈 AI 产品
人工智能·unity·开源·ai编程·claude·mcp
御水流红叶2 天前
Android-Unity游戏逆向思路
android·游戏·unity
ellis19702 天前
Unity图集Atlas
unity