glKarin / com.n0n3m4.diii4a

idTech4A++, idTech engine game For Android, DOOM III/Quake 4/Prey(2006)/DOOM3 BFG 1&2/The Dark Mod/RTCW/Quake 3/Quake 2/Quake 1
GNU General Public License v3.0
233 stars 15 forks source link

Graphic Problems on The Dark Mod for Mali GPU #179

Open keepChatAlive opened 1 month ago

keepChatAlive commented 1 month ago

By default, TDM can render the menu and go into the game level as of now. However, at least on my current Mali device, the level is pitch black and the moon on skybox is twitching. I analysed the problem and there are 4 problems:

1.stdout.txt complaining about missing precision in the parameter "stencilTexture" Screenshot_20240502-002519_ZArchiver Pro This can be fixed by adding mediump or highp precision to parameter "stencilTexture" of the type usampler2D in the file tdm_shadowstencilsoft.glsl after adding precision keyword, this shader file can be compiled with no problem and the level would at least show something however, the geometry in level seems to still be wobbly even if we choose highp precision

2.the moon is twitching in the level "The New Job", the moon on skybox is twitching(irrevelant of if 1 is fixed or not, highp or mediump), maybe due to shader precision or compliation errors, or more severe errors

3.stdout.txt complaining about missing OpenGL extension, causing another shader compliation to fail:

Linking GLSL program interaction_shadowmap ...
Linking GLSL program stencil_shadow ...
WARNING:Compiling shader file stages/shadow_map/shadow_map.vert.glsl failed:
0:17: P0003: Warning: Extension 'GL_EXT_clip_cull_distance' not supported
0:82: L0002: Undeclared variable 'gl_ClipDistance'
0:83: L0002: Undeclared variable 'gl_ClipDistance'
0:84: L0002: Undeclared variable 'gl_ClipDistance'
0:85: L0002: Undeclared variable 'gl_ClipDistance'
0:86: L0002: Undeclared variable 'gl_ClipDistance'

File indexes:
  0 - stages/shadow_map/shadow_map.vert.glsl

WARNING:Failed to attach shader stages/shadow_map/shadow_map.vert.glsl to program shadow_map.

Linking GLSL program shadow_map ...
WARNING:Linking program shadow_map failed:
Link failed because of missing vertex shader.

This likely cannot be fixed unless we find a way to "polyfill" the missing GL_EXT_clip_cull_distance extension, which is hard. Maybe my current Mali phone really sucks and G52 supports too few functions

4.level is still too dark to play even after fixing 1, the level is still too dark to play compared to PC edition, maybe due to 1 2 3, some 1 2 3 and other issues combined, or due to how diii4a framework render shadows making them too hard or too intense

Maybe we can contact TDM developers to discuss how to better port TDM to phones I would not actively contact them, it is up to you to choose

keepChatAlive commented 1 month ago

At least GL_EXT_clip_cull_distance is not supported on Mali G52, G78 and G610 devices, which means they are unsupported on significant portion of Mali GPUs, even the recent ones. reason #657467468 why Mali GPU sucks Seems that Adreno 6xx GPU should support it

glKarin commented 1 month ago

Try remove these lines in files in shadow_map.vert.glsl file: 17:#extension GL_EXT_clip_cull_distance : enable 82~86:gl_ClipDistance...... Shadowmapping is less used.

glKarin commented 1 month ago

And you can contact original author how about glsl shader implemention without gl extensions

keepChatAlive commented 1 month ago

Try remove these lines in files in shadow_map.vert.glsl file: 17:#extension GL_EXT_clip_cull_distance : enable 82~86:gl_ClipDistance...... Shadowmapping is less used.

by following this, shader compliation errors cleared but light quality is not improved(still too dark). maybe the Mali GPU is simply too fxcked up

glKarin commented 1 month ago

Screenshot_2024-05-02-11-49-23-084_com karin idTech4Amm On my device(SD 7Gen2+)

keepChatAlive commented 1 month ago

Screenshot_2024-05-02-11-49-23-084_com karin idTech4Amm On my device(SD 7Gen2+)

This is the same image after I fixed shaders on my Mali phone. This is the best we have now but still very dark compared to PC version and makes things like boxes hard to see. Likely due to how diii4a framework render shadows making them too hard or too intense For example this is the level "The new job" on PC https://www.youtube.com/watch?v=MvT-6CbkZd0

neitey commented 4 weeks ago

image

This is a screenshot from PC. Looks the same for me.