Godot: GLES2 shading issue

Created on 15 Nov 2019  路  18Comments  路  Source: godotengine/godot

Godot version:

Godot 3.2 beta 1, GLES2 renderer

OS/device including version:

Motorola G4 (Android 7)

Issue description:

Serious fragment shading issues on surfaces.

GLES2 shading issue

Steps to reproduce:

  1. Create a GLES2 project
  2. Add a MeshInstance with a default sphere shape
  3. Give the MeshInstance a material with very low roughness (I used 0.06, any value will work but lower roughnesses have more visible issues)
  4. Place a camera very close to the sphere (As close as you can, keeping the sphere on screen)
  5. Export for Android and run on your device

Minimal reproduction project:

gles2_fprec.zip

bug rendering

Most helpful comment

I think I found the cause of the issue: Mip Map level 1 of the prefiltered sky environment map is black!; all other mip levels look correct: here is a render doc trace from the quest with the mip levels visualized:
Mip 0, 1, 2:

Screenshot from 2019-11-15 22-32-13

Screenshot from 2019-11-15 22-32-18

Screenshot from 2019-11-15 22-32-21

All 18 comments

There is already an open issue for this in the Godot Oculus mobile repository, but since I can reproduce it on a regular Android device the issue is more relevant here.

CC @NeoSpark314

This is related also to https://github.com/godotengine/godot/issues/32813 (and https://github.com/GodotVR/godot_oculus_mobile/issues/60)

This is a floating point precision issue due to the fact that medp is using 16bits. Some more details are in the oculus mobile issue https://github.com/GodotVR/godot_oculus_mobile/issues/68 including a small performance benchmark of enabling high precision for all computations on the oculus quest. @clayjohn suggested in a discussion on discord that the agreed solution is providing a project setting to enable high precision.
I will look into creating a PR for this.

look at the spotlight shadows images in https://github.com/godotengine/godot/issues/33551
spot

I just tried forcing high precision locally (same method as the PR above), and this issue still persists, albeit in a slightly different form.

GLES2 high precision still broken

@kaadmy can you try disabling in the project quality settings the mobile approximations like shown below?:

Screenshot from 2019-11-15 21-57-04

@kaadmy I was able to reproduce the issue now also on my oculus quest. Changing the settings did not help. The precision fix in the PR gets rid of the noise; but the dark reflections seem to be an additional issue not fixed by the precision increase.

Same issue occurs here, I've also tried disabling all shading options to no avail. I'll try fixing it locally since I can easily reproduce the issue.

I think I found the cause of the issue: Mip Map level 1 of the prefiltered sky environment map is black!; all other mip levels look correct: here is a render doc trace from the quest with the mip levels visualized:
Mip 0, 1, 2:

Screenshot from 2019-11-15 22-32-13

Screenshot from 2019-11-15 22-32-18

Screenshot from 2019-11-15 22-32-21

I tried disabling mipmap generation (always source from panorama texture and don't blur) and I seem to get much better results:
GLES2 lowp partial fix

This is with the default precision (mediump), highp looks very similar but still has some shading discrepancies.

@NeoSpark314 Sorry to interrupt, but since you seem knowledgeable about mipmapping, would you know if it's possible to fix #33519 without too much trouble?

Fixed by #33646.

Hi, this issue still seems to persist under both 3.2.2 and 3.3.3, tested on Oculus Quest 2.
image

image

Please open a new issue, as it's likely something in the VR code.

@eastrd It's fixed in 3.2.3 (3.2.2 was released long before this issue was closed).
You have to enable a setting to use it, see #33646.

The issue still remains in 3.2.3, even when setting the high precision float flag. It goes away if I change the WorldEnvironment to be Color. But if it is set to Sky or Sky+Color, the issue is still present. Our project is not VR related. Just a regular Android GLES2 app.

Please open a new issue with a reproduction project.

Was this page helpful?
0 / 5 - 0 ratings