godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.82k stars 21.14k forks source link

Shader looks different on Android (two devices; GLES2) #27784

Open LinuxUserGD opened 5 years ago

LinuxUserGD commented 5 years ago

Godot version: master

OS/device including version: Android (zerofltexx Ressurrection OS 9.0; matissewifi Lineage OS 7.1)

Issue description: While the shader looks correct on my smartphone, on my tablet with lineage os there are strange rectangles.

Steps to reproduce: bug expected

Minimal reproduction project: Solus-Stunts-v1.0-bug.zip

akien-mga commented 5 years ago

Could you retrieve OpenGL ES capabilities of both devices with this app? https://play.google.com/store/apps/details?id=de.saschawillems.glescapsviewer It lets you upload the report from within the app which can then link from opengles.gpuinfo.org (the upload function might give an error, but it seems to work nevertheless).

LinuxUserGD commented 5 years ago

It worked. zerofltexx: https://opengles.gpuinfo.org/displayreport.php?id=3503 matissewifi: https://opengles.gpuinfo.org/displayreport.php?id=3504 Both devices support OpenGL ES 3 but I'm using GLES2. This is the shader: https://codeberg.org/HugeGameArtGD/Solus-Stunts/raw/branch/dev-new/source/tracks/3/shader/Splatmap.gdshader

clayjohn commented 4 years ago

Is this still reproducible in 3.1.2 or 3.2beta?

LinuxUserGD commented 4 years ago

I can still reproduce it using Godot 3.2.1 stable.

LinuxUserGD commented 4 years ago

I tried it on linux with android one click deploy and changed texture import from vram to lossy but this didn't fix it: First try: Linux: linux1 Android: android1

Second try (without albedo color param): Linux: linux2 Android: android2

And those are the textures assigned to the shader param: shader param

So expected would be that the terrain texture (called "splatmap" in this case) is displayed when far away and the detailed grass albedo texture together with roughness and normal blends over the terrain where the car drives.

Maybe mipmaps don't work in GLES2 on this device or just multiplying the texture uv and repeating doesn't work.

Edit: I still need to add a minimal reproduction project later to only display the shader as for now it's part of the game. But should be possible to assign the shader/material to any mesh for trying to reproduce this issue.

akien-mga commented 3 years ago

Is this still reproducible in 3.3 or later?

A minimal reproducible project would be useful, though even then it might be tricky to debug as this issue likely only happens with devices which lack support for some features or have driver bugs (bugs which might be even more prominent on unofficial ROMs like LineageOS).

Calinou commented 3 years ago

Those artifacts may be due to the more limited shader precision available on mobile devices. See https://github.com/godotengine/godot-proposals/issues/1747. In the meantime, you can detect whether the host OS is a mobile platform using OS.has_feature("mobile") and use a simpler shader.