通过custom节点实现高斯模糊
在PC上可以正常运行,但是在Android环境下会 显示异常
重现步骤
打开工程-》Content目录下的Blur材质-》按照截图设置一下预览平台
您好,可以提供一下这个自定义节点的代码吗,我们需要确认一下里面是否有mobile不支持的指令
Hi,
移动端的SceneTextureLookup函数跟PC上名称不一样,你可以改成下面这种方式,再测试一下。
#if SHADING_PATH_MOBILE Color += MobileSceneTextureLookup(Parameters, tIndex, UV+scale); #else Color += SceneTextureLookup(UV + scale,tIndex,false ); #endif
int tIndex = 14; UV = GetDefaultSceneTextureUV(Parameters, 14); int neighbourCount = (BlurSamples-1)/2; float4 Color = 0; for(int x = 0; x < BlurSamples; x++) { for(int y = 0; y < BlurSamples; y++) { float newX = -(neighbourCount-x); float newY = -(neighbourCount-y); float2 scale = float2(BlurWidth * newX/500, BlurWidth * newY/500); Color += SceneTextureLookup(UV + scale,tIndex,false ); } } Color /= BlurSamples*BlurSamples; return Color;