doitsujin / dxvk

Vulkan-based implementation of D3D9, D3D10 and D3D11 for Linux / Wine
zlib License
12.29k stars 786 forks source link

[Source Engine] Translucent sprites rendering issue #4006

Open yurakone opened 1 month ago

yurakone commented 1 month ago

Hard edges on translucent sprites env_sprite with World Space Glow render mode (9) in Source engine games, also affects to env_lensflare in Black Mesa

Software information

Tested on Half-Life 2 Deathmatch, Black Mesa

System information\Tested on

Apitrace file(s)

hl_trace

Log files

hl2_d3d9.log

Screenshots

Black Mesa sreenshots: IMG_8029 IMG_8030 Half-Life 2 Deathmatch sreenshots: IMG_8031 IMG_8032

Blisto91 commented 1 month ago

Just checking out the apitrace it looks fine on my RX 7900xtx with both radv and amdvlk

K0bin commented 1 month ago

Image I can reproduce it

K0bin commented 1 month ago

Internal note: It's blending a texture that gets uploaded via a simple Lock,Copy,Unlock onto the render target. The blending is a simple add and output alpha of the fragment shader is 1.0 across the board. The only thing that might be interesting is that both the RT as well as the texture are reinterpreted as SRGB. It's a BC1 texture with a SRGB view blended (with a fixed alpha) onto a SRGB B8G8R8A8 texture with a SRGB view.

It seems indeed related to SRGB. If I disable the SRGB views and manually transform it to 2.2 Gamma after sampling and at the end of the shader, it looks fine.

@WinterSnowfall has also confirmed that it renders correctly on Intel.

So... Nvidia driver bug?

yurakone commented 1 month ago

I looked into the problem a little. I added alpha channel to the texture, cuz it was with no alpha DXT1 and created a new material then I tried different shader parameters --Shader used: UnlitGeneric --Shader parameters tested: $translucent 1 $additive 1 --Texture format: DXT5 Compressed texture 20240519015728_1 20240519015828_1 So... this looks like a problem with $additive 1 only, and maybe Nvidia drivers

Blisto91 commented 1 month ago

This indeed is looking like a Nvidia driver bug. We've confirmed that it looks fine on AMD with the radv and amdvlk driver. On Intel it looks good with the Linux driver and on Nvidia it also looks fine on the NVK Linux driver while Nvidias own have the issue.

Tiagoquix commented 2 weeks ago

Does hiding the NVIDIA GPU (report as AMD GPU) fix the bug?

Blisto91 commented 2 weeks ago

No. A bug report needs to be made to Nvidia, which we haven't gotten to yet (I've volunteered now)