<p>Resolved by adding <code>precision highp sampler2D</code> to my shaders.</p>

<p>About default precision settings on ES - <a href="https://www.khronos.org/files/opengles_shading_language.pdf">https://www.khronos.org/files/opengles_shading_language.pdf</a> page 36.</p>

CC BY-SA 3.0
2016-03-09T09:33:26.220Z
Out of curiosity, what was the precision before? Low or Medium?
Simon F
CC BY-SA 3.0
2016-03-09T21:16:58.943Z
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
CC BY-SA 3.0
2016-03-10T12:30:13.953Z
OK. Was just wondering if you'd tried mediump as there could be performance (and power) benefits.
Simon F
CC BY-SA 3.0
2016-03-14T21:22:20.267Z
mediump doesn't help in my case, and also I don't notice any significant performance difference either.
pronvit
CC BY-SA 3.0
2016-03-08T23:20:07.050Z
2016-03-09T21:19:12.457Z
2016-03-09T21:19:12.457Z
pronvit
<p>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, <a href="http://theorangeduck.com/page/pure-depth-ssao" rel="noreferrer">this one</a>, and <a href="https://www.shadertoy.com/view/Ms33WB" rel="noreferrer">this one</a>.</p>

<p>On OS X they all work as they should, but on iPhone <em>all</em> 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?</p>

<p><a href="https://i.sstatic.net/C1NhL.png" rel="noreferrer"><img src="https://i.sstatic.net/C1NhL.png" alt="img1"></a> <a href="https://i.sstatic.net/3FQYE.png" rel="noreferrer"><img src="https://i.sstatic.net/3FQYE.png" alt="img2"></a> </p>

<shader><opengl-es>
SSAO artefacts on iPhone (OpenGL ES)
pronvit
# SSAO artefacts on iPhone (OpenGL ES)

(Asked by: username_0 on 2016-03-08)

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](http://theorangeduck.com/page/pure-depth-ssao), and [this one](https://www.shadertoy.com/view/Ms33WB).

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](https://i.sstatic.net/C1NhL.png)](https://i.sstatic.net/C1NhL.png) [![img2](https://i.sstatic.net/3FQYE.png)](https://i.sstatic.net/3FQYE.png)

**Tags:** shader, opengl-es


---

## 1 answers

### Answer by username_0 on 2016-03-08. Score: 6 | Accepted answer

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.

> **Comments:**
> **username_1**: Out of curiosity, what was the precision before? Low or Medium?  
> **username_0**: 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.  
> **username_1**: OK. Was just wondering if you'd tried mediump as there could be performance (and power) benefits.  
> **username_0**: mediump doesn't help in my case, and also I don't notice any significant performance difference either.  

---

