+1
Ülevaatamisel

Shader not working on Android

Robin Picou 10 aastat tagasi uuendaja juan 6 aastat tagasi 7
Hi !

I'm working on an Android project where we use ShaderForge (0.36) for making some effects, and it turns out that the shaders are not working (or crashing the device) when building to Android.
Anyone experiencing this issue ?

Image 299Image 300
Ülevaatamisel
What if you set it to only have a single light source rather than multiple ones?
And what if you disconnect diffuse and set the shader to unlit?
Ok, I got a bit more time to investigate.
The Vertex Offset output seems to have an issue when using a Texture2D property. I can pass anything if want in it (using Uv coordinates + rotator for exemple) except a Texture2D that will instantly broke the shader on Android (at least on the HTC One X and the Nexus 7). 

Do you want me to post a link with the shader with/without the Vertex Offset ?
Oh, you need to connect the MIP input of the texture for that to work on OpenGL. Undocumented thing that should throw a warning.
Hi Joachim, thanks for the answers !

I just put a Value : 1 to the MIP input (not sure of what should be passed, this is the index of the MIP map right ?) of my textures, but it don't seems to change anything : / 

I can upload the shader somewhere, I only have an HTC One X and a Nexus 7 to test.
A Value of 1 should work, but try 0 as well

I'm also facing the same issue here even 3 years later :( 

Putting value 1 on MIP does't seem to fix it. What should i do?

+3


Hey maeby is like some years later but, i had a free day today and i just tried to solve this problem.
alert (pls sorry for my english i'm learning)
So, the first that i did was see my lasts shader files that i did when i was learning, and i saw that the shaderGraph's shader are too long, maeby some shader expert could slap me the face , but i just started to delete all that "extra" code, obviously testing with every single line code that i deleted.
The first part was this section (ShadowCaster):

Yeah maeby it's an important part of the code, but, honestly, i don't need the best Shadows for my material in an Android game, so... bye bye.

The second Part, was this another section (ForwardDelta):

Uh... I don't know what´s that but... the shader still working Exactly as the begin without this, so... ejem , bye bye.

And Finally, the last par. Here, I only kept the first part of the code, and it looks like this


It works in PC but it still did not working in Android, so i erased this lines code:


and EUREKA the shader was working in my phone and even with all this changes in the code, it looks like  it was looking before. 
here is my test shader in shaderForge

And here is the shader Working in my Android Phone.


As you can see, i tested with Vertex offset, emmision, opacity and diffuse, the most important for me.
I hope that this could help you ;:) i had this problem for one year and i didn't found any solution. 

WARNING: if you open the shader with ShaderForge Again, it just Compile the code as in the begin