Shadertoy tutorial on mobile and desktop

I look into this tutorial and notes that what on mobile the quality of the resulting image is much worse than on desktop.

How it looks on iPhone5s:
IMG_0309

On desktop, the image quality is identical to original shadertoy example.
I also used the same shader with Apple SpriteKit on iphone (in OpenGL mode) and get the good result identical to shadertoy.
Does author of that tutorial tried to run it on mobile? What was the result he get?
How to get good quality on mobile?

Not sure what causes this but my first thought is that this is a problem with precision.

I’ll run some tests when I get the time. (I am currently on a 10 day parental leave).

1 Like

Yes. Adding precision highp float; to the shader source completely solve the issue on mobile. But, on desktop build there is now error:
WARNING:GRAPHICS: ERROR: 0:<line_number>: 'precision' : syntax error: syntax error
and example don’t build.
This is strange.

For now, the only way to make this example to work as expected on mobile AND desktop is explicitly qualify precision on every variable and constant.

Edit:
Or we can add
#ifdef GL_ES precision highp float; #endif
and remove precision qualifiers from var_texcoord0 and time and all will be ok.

2 Likes