ValveSoftware / halflife

Half-Life 1 engine based games
Other
3.71k stars 625 forks source link

[MOD] - [SOHL] - White screen in fullscreen *while in-game* #3481

Open theOneTrueFunniBoi opened 11 months ago

theOneTrueFunniBoi commented 11 months ago

While I was working on my Half-Life mod (which uses modified sohl dlls) (adding stuff from this github page), all of a sudden, when ever I play in fullscreen or with low video quality disabled the game just shows up as a white screen/how the void appears. Any idea what causes this and how I can fix it?

https://github.com/ValveSoftware/halflife/assets/112577221/c406668b-64a0-4d8a-97a3-45fef3856b9b

SamVanheer commented 11 months ago

Use the steam_legacy branch to run mods.

As i recall Spirit uses custom OpenGL code which won't work properly with the new update due to the many changes to the renderer. Spirit's graphics code will need updates to function again. Given that the engine can choose between OpenGL 4.2 shaders or the legacy immediate mode renderer writing graphics code that works properly for all users may be difficult.

theOneTrueFunniBoi commented 11 months ago

Use the steam_legacy branch to run mods.

As i recall Spirit uses custom OpenGL code which won't work properly with the new update due to the many changes to the renderer. Spirit's graphics code will need updates to function again. Given that the engine can choose between OpenGL 4.2 shaders or the legacy immediate mode renderer writing graphics code that works properly for all users may be difficult.

This is not as a result of the 25th anniversary update. This has been happening for a couple months now. The solution was to enable low graphics mode, but that doesn't work anymore because valve removed it.

And software mode doesn't work either. Pre-25th anniversary update, it would just crash the game and revert straight back to OpenGL.

theOneTrueFunniBoi commented 11 months ago

However, software mode works fine now (provided you have -novid), and running OpenGL mode at lower resolutions provides some insight into whats happening. The visible screen flys off to the right. It's really weird.

SamVanheer commented 11 months ago

Sounds like Spirit needs to be updated to account for changes that have been made to the engine.

theOneTrueFunniBoi commented 11 months ago

Sounds like Spirit needs to be updated to account for changes that have been made to the engine.

Again, this issue occured before the 25th anniversary update.

theOneTrueFunniBoi commented 11 months ago

Here it is running on the legacy build, I start out with "Low video quality" enabled, the disable it, and the bug occurs.

https://github.com/ValveSoftware/halflife/assets/112577221/b759726d-da6c-458b-9c33-5e0f233a6d06

SamVanheer commented 11 months ago

Sounds like Spirit needs to be updated to account for changes that have been made to the engine.

Again, this issue occured before the 25th anniversary update.

Yes, and my answer remains the same. There are a lot of different versions of Spirit and they are known to break sometimes. This isn't something that needs fixing in the engine.

Some versions use NVidia Cg, an old graphics library which is no longer supported: https://developer.nvidia.com/cg-toolkit

The Cg Toolkit is a legacy NVIDIA toolkit no longer under active development or support. Cg 3.1 is our last release and while we continue to make it available to developers, we do not recommend using it in new development projects because future hardware features may not be supported.

It's possible that some mod features aren't compatible with newer hardware and/or OpenGL features which can cause glitches.

The proper way to implement something like this would be to use modern OpenGL using GLSL shaders, just like the engine now does when shaders are enabled.

theOneTrueFunniBoi commented 11 months ago

Ok i have the issue pin pointed to sohl's r_glow command. Setting it to 2 give cool glow effects when textures are brightly lit, but causes the bug in full screen. r_glow 0 disables it, and r_glow 1 throws an error about a missing file.

What I don't know is why the screen bugs out.

SamVanheer commented 11 months ago

Looking at Spirit's code for r_glow it looks like the problem is that's it's trying to copy the current screen contents: https://github.com/HLSources/Spirit-of-Half-Life/blob/5ad2e00fe1546cc73e19255c75512a11ee3980c8/cl_dll/glow.cpp#L274

This won't work properly since additions like MSAA require a different approach to this kind of thing.

Given how drastically the engine's renderer has been updated i think all of Spirit's OpenGL code needs a rewrite.

Also r_glow 1 uses a CG shader. The shader file is needed for it to work and even then it could still break.

theOneTrueFunniBoi commented 11 months ago

Also r_glow 1 uses a CG shader. The shader file is needed for it to work and even then it could still break.

By shader file do you mean the cg and cgGL dlls?

SamVanheer commented 11 months ago

No, those are executable libraries.

The game loads these shaders:

They should be included with Spirit game installations.

theOneTrueFunniBoi commented 11 months ago

But they’re not, they’re not anywhere in the spirit 8.1 src.

SamVanheer commented 11 months ago

The shaders are included in this download: https://www.moddb.com/mods/spirit-of-half-life/downloads/sohl-v18-with-source-code-compatible-with-vs2010

In this archive there is another archive and that contains the shader files.

theOneTrueFunniBoi commented 11 months ago

Alright I’ll check when I have the time.

theOneTrueFunniBoi commented 11 months ago

Yep, checked, and the bug still persists. No more error on r_glow 1 though, it shows the same bug as r_glow 2 but the glow itself is different.