Comments (8)
I tried the attached reproducer and the problem is clearly visible on the quest while it does not occur on desktop:
I used renderdoc to inspect the created shader and it seems to be a floating point precision problem:
In the final fragment shader there is at the top a
#if defined(USE_HIGHP_PRECISION)
precision highp float;
precision highp int;
#else
precision mediump float;
precision mediump int;
#endif
but USE_HIGHP_PRECISION
is not defined. So the default precision for computations is mediump
.
The computation from the shader graph later looks like this.
{
vec3 m_n_out7p0;
m_n_out7p0 = vec3(uv_interp, 0.0);
float m_n_out2p0;
m_n_out2p0 = time;
float m_n_in5p1 = 0.3;
float m_n_out5p0;
m_n_out5p0 = (m_n_out2p0 * m_n_in5p1);
float m_n_in4p2 = 0.0;
vec3 m_n_out4p0;
m_n_out4p0 = vec3(m_n_out5p0, m_n_out5p0, m_n_in4p2);
vec3 m_n_out6p0;
m_n_out6p0 = (m_n_out7p0 + m_n_out4p0);
vec3 m_n_out3p0;
float m_n_out3p1;
vec4 m_tex_frg_3_read = texture2D(m_tex_frg_3, m_n_out6p0.xy);
m_n_out3p0 = m_tex_frg_3_read.rgb;
m_n_out3p1 = m_tex_frg_3_read.a;
albedo = m_n_out3p0;
}
even though the time
variable is defined as uniform highp float time;
the actual computation is done in mediump!
Querying the precision on the oculus quest using glGetShaderPrecisionFormat
gives
V GodotOVRMobile: Fragment Shader Precision: LOW [15, 15] 10
V GodotOVRMobile: Fragment Shader Precision: MED [15, 15] 10
V GodotOVRMobile: Fragment Shader Precision: HIGH [127, 127] 23
so all computations are done with 10bit mantissa.
Looking into the godot code the only place where USE_HIGHP_PRECISION
is defined for the shader seems to be in the JavaScript case:
https://github.com/godotengine/godot/blob/ac38f0782fbf781265ec34a43196e3ea157f3696/drivers/gles2/shader_gles2.cpp#L180
Forcing this define to be always present by disabling the #ifdef JAVASCRIPT_ENABLED
fixed the issue.
I don't know what the proper solution to this problem is. Two ideas from my side are
- Add an optional
highp
mode for shader graph computations - Have a global flag in the mobile settings to push the high precision mode for all shaders
from godot_oculus_mobile.
cc @akien-mga
from godot_oculus_mobile.
@fakedeltatime Can you open an issue on the main Godot engine issues page as well since as @NeoSpark314 mentions this may also affect other platforms.
from godot_oculus_mobile.
Related: godotengine/godot#32813
from godot_oculus_mobile.
Related: godotengine/godot#32813
I tested the reproduction project there on a Xiaomi Pocophone F1 and I can confirm that the same issue happens as described here, so it's the same bug.
@NeoSpark314 Would be worth adding your findings there.
from godot_oculus_mobile.
I'm surprised that I'm not getting these problems with my low tier Nokia 1 phone, but I guess that might be because it's running Android Go (a lighter version of Android) instead of regular Android?
from godot_oculus_mobile.
Since godotengine/godot#33646 was merged into master and included in 3.2.3, shouldn't this issue be closed?
That PR was probably the best that could've been done in any case ^^'
from godot_oculus_mobile.
Agree, thanks for the reminder @Firepal!
from godot_oculus_mobile.
Related Issues (20)
- The controller positions do not handle world_scale correctly HOT 4
- Using GLES3 causes rendering issues with Blend Keys
- Integrate oculus audio spatializer HOT 11
- Build procedure error HOT 2
- Add use of pointer_pose into the demo HOT 1
- Add Oculus Quest 2 support
- Add support for the Oculus platform keyboard HOT 12
- Mobile Vulkan for Oculus Quest 2 ? HOT 2
- 64bit Android binaries for Oculus Quest ? HOT 3
- VR framework for Godot ? HOT 3
- Head transformation may be invalid
- Cannot download asset from AssetLib HOT 4
- GearVR oculus update required HOT 2
- Controller positions mishandle worldscale in versions since v3.0.1 HOT 2
- Just a friendly reminder that the version in the asset store is still 3.0.1 HOT 8
- ovr_display.get_supported_display_refresh_rates() returns only 60hz and 72hz on Oculus Quest 2 HOT 3
- Export APK works fine, but unable to run in Godot IDE: "No library set for this platform" HOT 1
- Lag between ARVRCamera and ARVROrigin when moving HOT 3
- Add support for Passthrough API HOT 3
- Meta Quest 2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godot_oculus_mobile.