现象

shader使用的一张贴图在手机上不显示颜色。安卓小米mix 2s,unity 2017.4.40f1

原因

该纹理是一张RenderTexture,需要深度信息,当时创建时使用的是RenderTextureFormat.Depth格式。奇怪的是使用

SystemInfo.SupportsRenderTextureFormat( RenderTextureFormat.Depth)

测试,结果是该手机支持Depth格式。

这是创建的代码:

rt = RenderTexture.GetTemporary(256, 256, 16, RenderTextureFormat.Depth);

rt.useMipMap = false;
rt.filterMode = FilterMode.Bilinear;
rt.depth = 16; 

结果

因为只需要简单的遮罩效果,所以最后使用了RHalf格式

Logo

智屏生态联盟致力于大屏生态发展,利用大屏快应用技术降低开发者开发、发布大屏应用门槛

更多推荐