i have a problem with a transparent vertex shader written in CG.
On my computer and on a Samsung Galaxy Note 4 it works perfect but on my Xperia Z and the Xperia Z2 tablet it flickers.
Derivatives aren’t supported by all mobile hardware, or aren’t supported well. Those devices should be capable of it as it’s a requirement of OpenGL ES 3.0, but as you’re not specifying a shader level target it’s possible the devices are running the shader as es2.0 or es1.0(!).
I added #pragma target es3.0 under the #pragma fragment frag but it still doesn’t work. You say that derivatives aren’t supported well. Is there a way to write something like fwidth() what doesn’t use derivatives? Or would it help to wirte the shader in another language?
For mobile hardware I never use derivatives. Too unreliable. So it’s back to the drawing board I think. Just replace it with a texture lookup. When available derivatives will still be used for some proper texture filtering, but on other hardware the fallback is a bit friendlier.
You can imagine that i don’t know what i’m exactly do in shaders (I know that they show the grafik and compute textures and all this but i don’t know where i get things from and how i need to implement things that something else happens). I want that the underground have this wireframe. Until now i used the vertex colors red, green and blue and builded this shader with this as tamplate https://codea.io/talk/discussion/3170/render-a-mesh-as-wireframe.
My underground mesh is varying.
I would appreciate if you explain to me how I implement it with the texture lookup.