7
$\begingroup$

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

$\endgroup$

1 Answer 1

6
$\begingroup$

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.

$\endgroup$
4
  • $\begingroup$ Out of curiosity, what was the precision before? Low or Medium? $\endgroup$
    – Simon F
    Mar 9, 2016 at 9:33
  • $\begingroup$ 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. $\endgroup$
    – pronvit
    Mar 9, 2016 at 21:16
  • $\begingroup$ OK. Was just wondering if you'd tried mediump as there could be performance (and power) benefits. $\endgroup$
    – Simon F
    Mar 10, 2016 at 12:30
  • $\begingroup$ mediump doesn't help in my case, and also I don't notice any significant performance difference either. $\endgroup$
    – pronvit
    Mar 14, 2016 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.