source-engine icon indicating copy to clipboard operation
source-engine copied to clipboard

(macOS) Half-Life 2 flashlight/shadows bug, possibly due to OpenGL Renderer issues on Apple Silicon machines.

Open Norbi095 opened this issue 1 year ago • 2 comments

Tested on my M1 MacBook Air, -Half Life 2 -Half Life 2 Episode One -Half Life 2 Episode Two all have a flashlight, and a shadow-casting bug, rendering them incorrectly as shown in the picture.

HL2flashlightmacOS

Norbi095 avatar May 10 '23 12:05 Norbi095

Another reason it might be because of OpenGL is that when you use the console and do r_newflashlight 0, reverting the light to HL1 style, it works. But the HL1 style flashlight doesn't use dynamic lighting.

image r_newflashlight 0 image r_newflashlight 1

Ben10164 avatar May 11 '23 14:05 Ben10164

A better hack than using the awful HL1 flashlight may be to forcibly disable Pixel Shader 2.0b support using the launch option -nops2b, forcing the game to revert to using Pixel Shader 2.0 base instead. You lose a few graphical effects introduced to HL2 post-launch like phong and whatnot (and possibly other stuff that got added with the Orange Box update), but the modern flashlight ends up exhibiting graphical corruption far less often as a result.

EDIT: To add to what I mentioned above, I believe that the ps20b codepaths in DrawFlashlight_dx90 in BaseVSShader.cpp are responsible for the corruption artefacts mentioned above. I suspect forcing those to fallback to the legacy ps20 codepath on OSX would alleviate those graphical corruptions without sacrificing other ps20b effects as such (except for flashlight depth texture/shadowing ofc).

schm1dtmac avatar May 31 '24 13:05 schm1dtmac