• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ColinLeung-NiloCat/UnityURP-MobileScreenSpacePlanarReflection: Reusable Renderer ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

ColinLeung-NiloCat/UnityURP-MobileScreenSpacePlanarReflection

开源软件地址(OpenSource Url):

https://github.com/ColinLeung-NiloCat/UnityURP-MobileScreenSpacePlanarReflection

开源编程语言(OpenSource Language):

C# 75.4%

开源软件介绍(OpenSource Introduction):

UnityURP-MobileScreenSpacePlanarReflection

A simple and fast ScreenSpacePlanarReflection(SSPR) as a standalone reusable RendererFeature in URP.
Can run on PC/console/vulkan android, other platforms not tested but should work if compute shader is supported.

SSPR ON screenshot SSPR OFF screenshot SSPR ON screenshot SSPR OFF screenshot

On Adreno630 GPU android mobile device(almost all 2018/2019 flagship android mobiles), Toggle SSPR ON/OFF:

  • cost <1ms to update 128 height SSPR RT
  • cost <1ms to update 256 height SSPR RT
  • cost 1~2ms to update 512 height SSPR RT

On Adreno612 GPU android mobile device(Samsung Galaxy A70), Toggle SSPR ON/OFF:

  • cost <1ms to update 128 height SSPR RT
  • cost 1~2ms to update 256 height SSPR RT
  • cost 4~5ms to update 512 height SSPR RT

On Adreno506 GPU android mobile device(Lenovo S5), Toggle SSPR ON/OFF:

  • cost ~1ms to update 128 height SSPR RT
  • cost 3~4ms to update 256 height SSPR RT
  • cost 8~9ms to update 512 height SSPR RT

Where are the important files?

There are only 4 important code files, all inside a folder "Assets \ _MobileSSPR \ ReusableCore".
https://github.com/ColinLeung-NiloCat/UnityURP-MobileScreenSpacePlanarReflection/tree/master/Assets/_MobileSSPR/ReusableCore
Other files are for demo only, not important.

Can it run on mobile?

Tested on ~10 android devices(all support Vulkan). If your android device support Vulkan, result should be correct and rendering should be fast enough. (OpenGLES3.2 is not enough, must support Vulkan!)

*We have received a report that this SSPR is not working on MaliT760 GPU android (Galaxy S6), but we don't have this device to reproduce it

How to try this inside my own URP project?

  • copy "Assets \ _MobileSSPR \ ReusableCore" folder to your project (contains 4 important code files)

  • turn on "Depth Texture" in all your project's URP's setting

  • turn on "Opaque Texture" in all your project's URP's setting

  • Add MobileSSPRRendererFeature(RendererFeature) to your forward renderer asset

  • create a new plane game object in your scene (set world space pos y = 0.01)

  • create a material using MobileSSPRExampleShader.shader

  • assign this material to your new plane

  • DONE! You should see correct reflection both in scene and game window

I can see some small flickering in reflection / can't see any reflection

It is not expected! Please report your device name in Issues, thanks!

Notes

It is not safe to use InterlockedMin() and RenderTexture color format "RInt" on android/iOS compute shader(see -> https://zhuanlan.zhihu.com/p/150890059). Instead, we will use RenderTexture color format RFloat / ARGBHalf to produce similar result.

Editor

2020.3.33f1 LTS

Implementation reference

Change log

  • 2020-08-23: add iOS/OSX support (with the help of MusouCrow)
  • 2022-05-02: upgrade project to Unity2020.3.33f1, merged a bug fix in MobileSSPRComputeShader.compute



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap