nillerusr / source-engine

Modified source engine (2017) developed by valve and leaked in 2020. Not for commercial purporses
Other
1.13k stars 173 forks source link

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

Open Norbi095 opened 1 year ago

Norbi095 commented 1 year ago

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
Ben10164 commented 1 year ago

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

schm1dtxbox commented 1 month ago

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).