7

I've never written shaders before, and now I'm trying to implement SSAO with SceneKit on OS X and iOS. I'm trying different SSAO shaders that I find, e.g. from Three.js, this one, and this one.

On OS X they all work as they should, but on iPhone all of them giving me the same artefacts (images show SSAO pass only). The lines move when I move the camera. So it must be because of some differences of OpenGL ES. Anyone knows what's wrong?

img1 img2

pronvit
  • 231
  • 1
  • 6

1 Answers1

6

Resolved by adding precision highp sampler2D to my shaders.

About default precision settings on ES - https://www.khronos.org/files/opengles_shading_language.pdf page 36.

pronvit
  • 231
  • 1
  • 6
  • Out of curiosity, what was the precision before? Low or Medium? – Simon F Mar 09 '16 at 09:33
  • I found a document saying it's low for samplers and high for float/int by default on ES. Oh, ints depend on shader type I've added link to my answer. – pronvit Mar 09 '16 at 21:16
  • OK. Was just wondering if you'd tried mediump as there could be performance (and power) benefits. – Simon F Mar 10 '16 at 12:30
  • mediump doesn't help in my case, and also I don't notice any significant performance difference either. – pronvit Mar 14 '16 at 21:22