godotengine / godot

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

Broken GLES2 render in Godot 3.4 and later on iOS due to Octahedral Compression #57322

Closed SkanerSoft closed 2 years ago

SkanerSoft commented 2 years ago

Godot version

3.4.2 and 3.5 beta 1

System information

iOS 15.2.1 / iPhone SE / OpenGL ES 2.0 Renderer: Apple A9 GPU

Issue description

When running the game on iOS, GLES2 rendering does not work correctly. I tried a variety of render settings, re-imported everything several times, but nothing helped. I have tried all versions of Godot since 3.4 to check at what point the rendering started to work incorrectly, however, in all versions the situation is the same.

On the video you can track the process of how it looks.

https://user-images.githubusercontent.com/13809475/151420521-a01c91e0-bb55-4235-9335-593ddb72cc9f.mp4

Also here are some screenshots. Sorry for the quality, I didn't make it. Shotcut_00_00_16_533

Shotcut_00_00_03_467

Shotcut_00_00_36_067

Runs from Xcode

xcode

This project works great on Android, Windows, Linux, MacOS but is completely broken on iOS. Switching to GLES3 solves this problem, but the game starts to work very slowly (FPS drops a lot).

When starting the project, the console outputs this

*********** main.m
running app main
Path: /var/containers/Bundle/Application/141C6F1F-C05D-41A4-BAFE-8B9F9C1B4C81/Bunker.app
godot_iphone /var/containers/Bundle/Application/141C6F1F-C05D-41A4-BAFE-8B9F9C1B4C81/Bunker.app/Bunker
cwd /private/var/containers/Bundle/Application/141C6F1F-C05D-41A4-BAFE-8B9F9C1B4C81/Bunker.app
os created
setting data dir to /var/mobile/Containers/Data/Application/E8A36F7A-E7D7-49B6-AA65-3296D3C7DC04/Documents from /var/mobile/Containers/Data/Application/E8A36F7A-E7D7-49B6-AA65-3296D3C7DC04/Documents
setup 0
2022-01-27 19:12:00.839936+0300 Bunker[1369:282913] Metal API Validation Enabled
2022-01-27 19:12:00.977090+0300 Bunker[1369:282913] Setting up an OpenGL ES 2.0 context.
2022-01-27 19:12:00.977381+0300 Bunker[1369:282913] failed to make complete framebuffer object 8cd6
2022-01-27 19:12:00.977430+0300 Bunker[1369:282913] Failed to create frame buffer!
******** setting up keyboard input view
******** adding observer for keyboard show/hide

start animation!
2022-01-27 19:12:01.018063+0300 Bunker[1369:282913] ERROR: AudioOutputUnitStart failed, code: -50
2022-01-27 19:12:01.018145+0300 Bunker[1369:282913]    at: start (drivers/coreaudio/audio_driver_coreaudio.cpp:249) - AudioOutputUnitStart failed, code: -50
ERROR: AudioOutputUnitStart failed, code: -50
   at: start (drivers/coreaudio/audio_driver_coreaudio.cpp:249) - AudioOutputUnitStart failed, code: -50
2022-01-27 19:12:01.025181+0300 Bunker[1369:282913] Godot Engine v3.5.beta1.official.b9b23d222 - https://godotengine.org
Godot Engine v3.5.beta1.official.b9b23d222 - https://godotengine.org
2022-01-27 19:12:01.030797+0300 Bunker[1369:282913] OpenGL ES 2.0 Renderer: Apple A9 GPU
OpenGL ES 2.0 Renderer: Apple A9 GPU
2022-01-27 19:12:01.202877+0300 Bunker[1369:282913] 

When switching to a game scene with a loaded 3D level

(servers/visual/visual_server_scene.cpp:731) - Index p_surface = 0 is out of bounds (instance->materials.size() = 0).
ERROR: Index p_surface = 0 is out of bounds (instance->materials.size() = 0).
   at: instance_set_surface_material (servers/visual/visual_server_scene.cpp:731) - Index p_surface = 0 is out of bounds (instance->materials.size() = 0).
2022-01-27 19:12:39.319028+0300 Bunker[1369:282913] ERROR: Index p_surface = 0 is out of bounds (instance->materials.size() = 0).
2022-01-27 19:12:39.319089+0300 Bunker[1369:282913]    at: instance_set_surface_material (servers/visual/visual_server_scene.cpp:731) - Index p_surface = 0 is out of bounds (instance->materials.size() = 0).
ERROR: Index p_surface = 0 is out of bounds (instance->materials.size() = 0).
   at: instance_set_surface_material (servers/visual/visual_server_scene.cpp:731) - Index p_surface = 0 is out of bounds (instance->materials.size() = 0).

Endless spamming of bugs to the console (shown in the video video) throughout the game.

2022-01-27 19:16:12.030526+0300 Bunker[1369:282913] DrawView: 500 error
2022-01-27 19:16:12.047285+0300 Bunker[1369:282913] DrawView: 500 error
2022-01-27 19:16:12.065636+0300 Bunker[1369:282913] DrawView: 500 error
2022-01-27 19:16:12.080681+0300 Bunker[1369:282913] DrawView: 500 error
2022-01-27 19:16:12.097296+0300 Bunker[1369:282913] DrawView: 500 error
2022-01-27 19:16:12.114506+0300 Bunker[1369:282913] DrawView: 500 error
2022-01-27 19:16:12.130409+0300 Bunker[1369:282913] DrawView: 500 error
2022-01-27 19:16:12.146974+0300 Bunker[1369:282913] DrawView: 500 error
2022-01-27 19:16:12.164081+0300 Bunker[1369:282913] DrawView: 500 error
2022-01-27 19:16:12.181806+0300 Bunker[1369:282913] DrawView: 500 error
2022-01-27 19:16:12.197300+0300 Bunker[1369:282913] DrawView: 500 error
2022-01-27 19:16:12.213994+0300 Bunker[1369:282913] DrawView: 500 error
2022-01-27 19:16:12.230584+0300 Bunker[1369:282913] DrawView: 500 error
2022-01-27 19:16:12.247444+0300 Bunker[1369:282913] DrawView: 500 error
2022-01-27 19:16:12.264062+0300 Bunker[1369:282913] DrawView: 500 error
2022-01-27 19:16:12.281690+0300 Bunker[1369:282913] DrawView: 500 error
2022-01-27 19:16:12.298460+0300 Bunker[1369:282913] DrawView: 500 error
2022-01-27 19:16:12.314070+0300 Bunker[1369:282913] DrawView: 500 error

Steps to reproduce

Download and open the project from the archive.

The minimum project contains the most complete script for building the game.

Main level in res://levels/level_0.tscn

Rendering takes place on the scene res://scenes/game.tscn

Minimal reproduction project

Bunker_21.zip

Calinou commented 2 years ago

@SkanerSoft Bump :slightly_smiling_face:

Can you test this on 3.5.rc2?

akien-mga commented 2 years ago

Assuming fixed, please comment if the issue is still reproducible.

SkanerSoft commented 2 years ago

Good afternoon! The problem has now been fixed!

akien-mga commented 2 years ago

Awesome, thanks for confirming!