Fixes for various graphics bugs on Linux

edit2: Update: more fixed shaders in a comment below
edit: This will not work with the proprietary NVIDIA driver.

I found a manual workaround to fix the purple character select screen that has plagued Linux users running the native client (using OpenGL) for quite some time:

TLDR:
Create a folder and the following file somewhere:

$ mkdir ~/le_shaders

$ cat > ~/le_shaders/VS_eb68bdbc455fedce16d4835a1b5bf77caa6ba716.glsl<<EOF
#version 460                                                                    
#extension GL_ARB_explicit_attrib_location : require                            
#ifdef GL_ARB_shader_bit_encoding                                               
#extension GL_ARB_shader_bit_encoding : enable                                  
#endif                                                                          
                                                                                
in  vec4 in_POSITION0;                                                          
in  vec4 in_TEXCOORD0;                                                          
out vec2 vs_TEXCOORD0;                                                          
void main()                                                                     
{                                                                               
    gl_Position.xy = in_POSITION0.xy * vec2(-2.0, 2.0);                         
    gl_Position.zw = vec2(1.0, 1.0);                                            
    vs_TEXCOORD0.xy = in_TEXCOORD0.xy;                                          
    return;                                                                     
}
EOF

Then either start the game as follows while steam is running:
MESA_SHADER_READ_PATH=/home/username/le_shaders/ /home/username/.local/share/Steam/steamapps/common/Last\ Epoch/Last\ Epoch.x86_64

or edit Last Epochā€™ Launch options within Steam as follows:
MESA_SHADER_READ_PATH=/home/username/le_shaders/ %command%

Explanation:
(also see Shading Language ā€” The Mesa 3D Graphics Library latest documentation)
I dumped all shaders by starting the game as above but with MESA_SHADER_DUMP_PATH=/home/username/le_shaders_dump/set. I got into the char select menu and quit the game.
I then copied all dumped shaders to the le_shaders folder:
cp /home/username/le_shaders_dump/* /home/username/le_shaders/
and in that folder replaced half the files with a shader doing nothing:

#version 460                                                                    
void main()                                                                     
{                                                                               
    return;                                                                     
}

, checked, split more until I found the shader responsible:

$ cat VS_eb68bdbc455fedce16d4835a1b5bf77caa6ba716.glsl
#version 460
#extension GL_ARB_explicit_attrib_location : require
#ifdef GL_ARB_shader_bit_encoding
#extension GL_ARB_shader_bit_encoding : enable
#endif

in  vec4 in_POSITION0;
in  vec4 in_TEXCOORD0;
out vec2 vs_TEXCOORD0;
void main()
{
    gl_Position.xy = in_POSITION0.xy * vec2(-2.0, 2.0);
    gl_Position.zw = vec2(0.0, 1.0);
    vs_TEXCOORD0.xy = in_TEXCOORD0.xy;
    return;
}

I know nothing about shaders but gl_Position.zw sounded like the depth/z position is set here and after setting it to 1.0 instead of 0.0 the purple screen is gone.

I am not entirely sure whether the shader filenames are the same across systems or not. In case they are not you can repeat the steps I did above and look for the shader having the same contents and modify it.

Also did I metion I know nothing about shaders? Not sure if anything else breaks (visually) because of said modification but so far it seems fine here. I did a quick visual comparison of the char select screen using the modified shader and the char select screen when running with -force-vulkan and they appear the same to me.

Hope this helps and please let me know if it works for you.

1 Like

Hello,

I tried this but it didnā€™t work.

I also tried to dump shaders with the following command (replacing ā€œusernameā€ with my username) but didnā€™t work as well :
MESA_SHADER_DUMP_PATH=/home/username/le_shaders_dump/ /home/username/.local/share/Steam/steamapps/common/Last\ Epoch/Last\ Epoch.x86_64

Thatā€™s too bad. What GPU are you using? It did not dump any shaders at all? Did you create the dump directory beforehand?

Edit: Ah I looked at your post history and it seems you use an NVIDIA GPU with the closed source driver. I do not think that will work as it probably does not allow for runtime replacement of shaders. At least not the way I explained above. You could try with the Nouveau driver: Nouveau - ArchWiki as that is part of mesa but I have no experience with NVIDIA.

Thanks for your feedback. Yes, I created the dump directory before.

Youā€™re right, I have a Nvidia GTX 660 with closed source drivers (Ubuntu 20.04). Anyway I donā€™t think Iā€™ll try with other drivers. Except the character selection screen, the game works well and I donā€™t want to risk to break anything.

I hope your post will give a hint to Eleventh hourā€™s developper to fix the bug.

@Azerov

YOU ARE THE MAN!!!

I tried your solution (Linux Mint 21.1 + Ryzen 5800X3D + Radeon 5600XT) and IT WORKS!!! At first it didnā€™t work because within Steam I copy/pasted MESA_SHADER_READ_PATH=/home/username/le_shaders/ %command% forgetting to change username with my actual username lol lol. Now I will play for a while to see if flashes problem is solved alsoā€¦

PS: EHG should hire you to fix their linux clientā€¦

Update 2023-08-20: added Waste Pools fix

Some more fixed shaders:

Same instructions as above.
The following ā€œbugsā€ are fixed/circumvented:

Purple character select screen:

VS_eb68bdbc455fedce16d4835a1b5bf77caa6ba716.glsl

White circles on water textures:

According to a MESA Contributor this is caused by the shader trying to calculate log2 of 0 which is INF.
The solution used here is to define a variable > 0 and use the max of that variable and the actually passed variable so log2 will never get a 0.

Divine Era - Deep Harbor:
FS_ba149428f93a67dcb7ca55a72724ea0b12dfc24b.glsl
FS_d6ff636fb5519aa7ed760e9cd56f5b7cd857f2a4.glsl
FS_d323137e916a22c896535e6763089888b56332ad.glsl

Divine Era - Majā€™elka Lower District:
FS_29d35a69985f7f59a2c9e22acc3e5fa67619f27d.glsl

Divine Era - The Upper Temple:
FS_79a2e060091eef7cc7c1f075d270d27922d9b241.glsl
FS_c941baefd90e9393ac692400e4c5834b9becdad4.glsl

Monolith - Twisted Mire
FS_06dbd0ddd98b7e12ab8205821f4a561dac314c54.glsl
FS_86628f452c99b2dadde3d5a038c6f1616fc15731.glsl

Monolith - Sinking City
FS_6b38a6a2339ed6b1dee9c97c48241795afc7b693.glsl

Monolith - Waste Pools
FS_00e59b5bbccf2a8e627db1682064604e73583abc.glsl

TODO:

White flashes:

Monolith - Vessel of Chaos

General - Sirens

1 Like

Added some more fixed water shaders that were needed for 0.9.2 patch and the reworked Imperial Era:

(archive contains all fixed shaders so far)

2 Likes

When I did the fix for the character menu is when i started having the flickering screen.

It also often gets stuck in the black and white screen. I have a pretty good screen shot. (to band-aid this you can just remove your chest and put it back on but the problem comes back quickly) I really dont know why this works but it does.

Hi @KingEKoP,
thanks for the feedback. So if you do not apply the purple character select workaround you do not get the black/white flashing screen when i.e. attacking a Vessel of Chaos? What is your setup (Hardware, driver)?
I just tried again without any replaced shaders and for me all issues appear again:

  • purple character select
  • white circles on water textures in i.e. Deep Harbor
  • black & white flashes when attacking i.e. Vessels of Chaos (also happens with Sirens, and Vessels of Hope)
  • Fire Beam from elementals in Lightless Harbor is a plain white beam.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.