- Home /
Graphical artifacts
Hello everyone it's first time when I was working on game for android and encountered this problem which occurs as graphic artifacts only on android build on desktop everything works ok, I tried several things to solve this:
set every material to use default Unity shader
disabled multi threaded rendering
force unity to use ogl 2.0 on android
main camera has static color as background
tried setting several rendering paths on camera (currently set to forward)
disabled occlusion culling on camera
But still without luck. Also logs from android are clear from any errors. Maybe someone encountered this before?
Answer by piter00999 · Dec 08, 2018 at 03:24 PM
Okay finally found an issue, it was enabled instancing on my custom shader which wasn't really prepared to work with instancing, funny thing is on pc everything was working ok: no graphical glitches and reduced batches count. However on android everything was messed up just like on screenshot.
Finally solution:
added support in my custom shader for gpu instancing -> https://docs.unity3d.com/550/Documentation/Manual/GPUInstancing.html
In my shader I added things like
UNITY_SETUP_INSTANCE_ID (v);
UNITY_TRANSFER_INSTANCE_ID (v, data)
in vertex part and in surface/fragment part just that single line on top
UNITY_SETUP_INSTANCE_ID(IN);
Also in structure that is passed from vertex to fragment I added
UNITY_VERTEX_INPUT_INSTANCE_ID
as another variable. And last thing added
#pragma multi_compile_instancing
Under CPROGRAM line so now shader supports both instancing enabled and disabled.
Your answer
Follow this Question
Related Questions
Android texture Problem? 0 Answers
Can Unity render to a secondary screen in Android? 0 Answers
Smooth edges on android 1 Answer
Android missing gdiplus.dll error 0 Answers
why is the Custom GUI Skin with APK formatting stretching the buttons? 1 Answer