DougReeder / aframe-simple-sun-sky

An A-Frame WebVR sky primitive using a simple (and fast) gradient away from the sun
MIT License
15 stars 3 forks source link

Issue with rendering sun inside VR #3

Closed msub2 closed 1 year ago

msub2 commented 1 year ago

Currently testing a scene with my Quest 2 on the current version of the browser, this is what I see when I look up at the sun in-headset (looks correct everywhere else)

It appears to be an issue somewhere in the fragment shader, at least as far as I can tell from fiddling with it a bit.

DougReeder commented 1 year ago

Yes, the the shader has issues on some platforms; I’ll add Quest 2 to the list. :-( I hope to be able to work on that in the next month. Thanks!

On Feb 1, 2023, at 2:22 AM, Daniel Adams @.***> wrote:

Currently testing a scene with my Quest 2 on the current version of the browser, this is what I see when I look up at the sun in-headset (looks correct everywhere else)I suspect it's some kind of shader issue but I'm not sure exactly what might be affecting it. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Doug Reeder @.*** Get routine info out of your head with Notes Together! Never spend time tidying up — unless you want to! https://notestogether.hominidsoftware.com/ My gender pronouns are: he, him, his.

msub2 commented 1 year ago

Update: It turns out that the issue was from setting precision mediump float. If I set it to precision highp float it renders properly!

DougReeder commented 1 year ago

Ah, that sounds very plausible!

DougReeder commented 1 year ago

IIRC, precision mediump float was for compatibility with systems like Google Cardboard. I have removed it in v1.2.3, now published. Thanks much!

DougReeder commented 1 year ago

Per https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices#be_precise_with_glsl_precision_annotations the general solution would be

ifdef GL_FRAGMENT_PRECISION_HIGH

precision highp float;

else

precision mediump float;

endif

... but my fragment shader doesn't require this.