RobertBeckebans / RBDOOM-3-BFG

Doom 3 BFG Edition source port with updated DX12 / Vulkan renderer and modern game engine features
https://www.moddb.com/mods/rbdoom-3-bfg
GNU General Public License v3.0
1.38k stars 247 forks source link

digital vomit with latest MESA #386

Closed dukenukemx closed 4 years ago

dukenukemx commented 6 years ago

I'm running Mint 18.2 with RBDOOM3BFG installed from Ubuntu repository, and I had no problem running the game with my Radeon HD 7850. But when I installed Padoka PPA for latest AMD RadeonSi drivers I get corrupted screen that's incomprehensible. Essentially digital vomit. I also tried compiling the latest version from this Github with the same results.

BielBdeLuna commented 6 years ago

capture the screen and post the result here to see what sort of problem you might have

dukenukemx commented 6 years ago

Here is what it looks like. I've tried games like Portal 2, Borderlands 2, and Dolphin and they all render correctly.
doom3bfg

spannerman79 commented 6 years ago

That looks like what used to happen with an older nvidia driver blob and Chrome (unrelated to this project).

But when I installed Padoka PPA for latest AMD RadeonSi drivers

RadeonSI/Gallium3D drivers are too problematic. The same can be said about using nouveau - for which I will never do for gaming.

No need to use a PPA - http://support.amd.com/en-us/download/linux

Edit: News link showing source of Chrome & nVidia GPU "bleed" http://news.softpedia.com/news/nvidia-gpus-break-google-chrome-s-incognito-mode-498716.shtml

dukenukemx commented 6 years ago

The RadeonSi drivers are currently much faster than AMDGPU drivers, except for Vulkan performance. Plus it gives me OpenGL4.5 support. Also the glitching you're seeing is not from a web browser but from the game itself. How the Google crap got in there is beyond me.

DanielGibson commented 6 years ago

Probably uninitialized memory (buffers) still holding old data. Unfortunately on Linux (afaik it's the same on Mac but not on Windows) GPU drivers don't zero out the graphics memory before assigning it to a new process.

dukenukemx commented 6 years ago

A simple solution would be to remove the Padoka PPA, but then I downgrade my graphics driver. So maybe this is a new bug introduced to the drivers since these are bleeding edge, but then why does nothing else have problems?

Also for the hell of it I tried "MESA_GL_VERSION_OVERRIDE=3.3 rbdoom3bfg" and it gave the error "ERROR: GL_ARB_multitexture not available". So that's odd. I tried with opengl4.5 with no difference.

dukenukemx commented 6 years ago

Have a laptop with a Radeon HD 6370 GPU and it hadn't been updated in a while, so I tried RBDOM3BFG and it worked fine with Padoka PPA. Updated the system, which means updated drivers and I get the same digital vomit. Which means a new update broke something.

shmerl commented 6 years ago

It's not limited to Padoka (please rename the bug because it's misleading). It's a general issue with latest Mesa. Here is what I get with latest Mesa master and AMD RX 480:

OpenGL renderer string: AMD Radeon (TM) RX 480 Graphics (POLARIS10 / DRM 3.15.0 / 4.12.0-1-amd64, LLVM 5.0.0)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 17.3.0-devel (git-9573bd70e1)

doom3_bfg_garbled

It does work with older Mesa indeed (though the game looks rather poorly polygonal, may be antialisaing doesn't work at all?). I'll file a separate bug about that.

shmerl commented 6 years ago

I'm also getting this during run:

0:2(10): error: GLSL 1.50 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES

I think it mixes up OpenGL version, and doesn't run in core profile as it should. Is the game using compat profile for some reason?

When running like this:

MESA_GL_VERSION_OVERRIDE=4.5 MESA_GLSL_VERSION_OVERRIDE=450 mesa_run.sh ./RBDoom3BFG

I get:

ERROR: GL_ARB_multitexture not available

It seems to be related to #137.

shmerl commented 6 years ago

OK, I was able to work around it like this. I commented out all checks like:

if( !glConfig.multitextureAvailable )
...
if( !glConfig.textureCompressionAvailable )

And so on, which verify availablity of OpenGL extensions. Then I run the game like this:

MESA_GL_VERSION_OVERRIDE=4.5 MESA_GLSL_VERSION_OVERRIDE=450 mesa_run.sh ./RBDoom3BFG

And it works, and even antialiasing works as it should. I suppose the library which reports availability of extensions to the game is buggy.

Though visually, textures seem to be low quality. May be this hack still doesn't enable usage of all extensions. I suppose going through the code, you can enable all options where similar checks are done.

shmerl commented 6 years ago

Yeah, something is quite off with graphics when using this method. Here is how flashlight lighting looks:

doom3_flashlight_bug

I suspect there is some kind of mess going on, and core profile isn't really used properly.

dukenukemx commented 6 years ago

I updated the title of this so that it isn't just about Padoka. I've also tried Oibaf PPA with similar results. So it seems that because RBDOOM3BFG uses compat profile instead of core profile that this is what causes the problem?

Also is there an official fix or we need to comment out some if statements?

shmerl commented 6 years ago

I'm not sure if commenting out those checks is a proper fix. Developers can probably explain it better, but I suspect that the game relies on compat profile, and it's a problem. It really should be rewritten to use core profile only.

I'll try analyzing the part which sets OpenGL parameters to see what's going on.

shmerl commented 6 years ago

Yep, extensions that the game log reports are from compat profile, not from core profile.

dsalt commented 6 years ago

391 may be related – re-test with that applied and see what you get.

shmerl commented 6 years ago

I just tired it, it helps to start the game, but it's still visually messed up like the flashlight effect above. Is it because some effects still depend on compat profile extensions?

@dsalt: I opened #392 specially for this.

BielBdeLuna commented 6 years ago

in the image, what is it the problem? is it the added brightness in the planar flashlight texture (the one simulating the light interaction with the medium)? if so, this is due that robert changed the gamma value handling of textures for the new renderer, so transparent textures where designed for an incorrect gamma math, so all transparent effects look either too bright or too faint ( like imp fireballs that look way too dark ) this is due the assets where made for that incorrect gamma math in the vanilla renderer and so transparent assets need to be readjusted.

shmerl commented 6 years ago

That image appears like some gray mesh, instead of actual light effect. I.e. very wrong. Also, I'm not sure if quality of the final result is good with Mesa. Can you post an image how to looks with Nvidia blob? I don't have an Nvidia card to compare.

BielBdeLuna commented 6 years ago

I use Intel and it looks the same as your image, those problems where announced when Robert applied the new Gamma math, it's the assets. take a look how imps fireball look, and you can see any let's play to see how they should look like, the same problem the assets conflicting with the new Gamma math.

shmerl commented 6 years ago

I see. And there is no way to fix that? I vaguely remember playing the original binary release with Nvidia card in the past, and visuals were way better. I still suspect some stuff from compat profile is missing, and textures look worse with Mesa. Since you are using Intel (Mesa), I'd expect a similar result in the sense of compat vs core profile.

It would be good to compare to Nvidia blob anyway (not in regards to the lighting effect, but quality of textures in general).

BielBdeLuna commented 6 years ago

there are three ways, none of them is my favourite:

assets created anew should be done taking into account the new gamma workflow and so they shouldn't display such errors.

In Nvidia cards and on windows that error also occurs. If you deactivate HDR and shadowmaps (then you should have the old renderer and it should display fine, because the old renderer uses incorrect gamma math )

shmerl commented 6 years ago

If you deactivate HDR and shadowmaps (then you should have the old renderer and it should display fine, because the old renderer uses incorrect gamma math )

How exactly it can be done? I suppose some entries in config file?

BielBdeLuna commented 6 years ago
r_useHDR 0
r_useShadowMapping 0
shmerl commented 6 years ago

Thanks, trying that now.

shmerl commented 6 years ago

Yep, that did it and it looks much better with game assets. Thanks for your help!

shmerl commented 6 years ago

Hm, I'm a bit confused now. I see that

set r_useHDR "0"
set r_useShadowMapping "0"

Are already in my D3BFGConfig.cfg

And even if I remove them from there, they reappear. Are they default?

Also, do values in autoexec.cfg have priority over D3BFGConfig.cfg?

BielBdeLuna commented 6 years ago

both might be 1 by default

shmerl commented 6 years ago

Strange, somehow even when I remove those values from everywhere, they reappear in D3BFGConfig.cfg on next restart with values 0.

BielBdeLuna commented 6 years ago

maybe you have to use the "+seta" as an argument after the game executable?

shmerl commented 6 years ago

No, no parameters passed. Also, I noticed that that gray haze isn't really gone when they are set to 0. It still looks better than before, and now it seems I can't reproduce previous state.

Ah, I also entered them once in console that way. May be it saves it somehow in the profile?

BielBdeLuna commented 6 years ago

you see that the whole screen turns somewhat darker when you go from HDR 1 to 0 isn't it?

shmerl commented 6 years ago

Yes, it does. I just tested in console setting it back to 1, and it turns brighter indeed.

shmerl commented 6 years ago

I suspect commands entered in console are somehow saved, and forced on next restart.

BielBdeLuna commented 6 years ago

then if you try it with the flashlight on you should see the difference in the light texture as well, do you see it?

shmerl commented 6 years ago

Without HDR the gray haze is less pronounced, but it's still there. With HDR it's very visible.

shmerl commented 6 years ago

And I can confirm, that console entered commands are preserved somehow, overriding what's set in config files even on next restart. That explains the confusion.

BielBdeLuna commented 6 years ago

the gray haze is there because the game developers wanted it there! it is there in vanilla doom3 flashlight also.

shmerl commented 6 years ago

Really? I didn't realize that. It's supposed to be some dust or something? I don't see it here for example: https://youtu.be/ccXnKj3a6Ps?t=591

BielBdeLuna commented 6 years ago

yes, the effects of lights over dust particles (expressed the doom3 way) so it's not an error! you could say that RBdoom3BFG displays the texture wrong but, the game developers wanted that texture there.

shmerl commented 6 years ago

Yep, I see what you mean (just looked closely in another video). I suppose the haze looks bad because of antialisaing not working properly.

Look at quality here: https://www.youtube.com/watch?v=nPBgQCrHJ-Y&t=508

It's way better than visuals that I get with Mesa.

shmerl commented 6 years ago

I figured what the issue was. With HDR enabled, MSAA simply didn't work, and textures looked pretty bad. Without HDR it works OK.

While anitaliasing improved, I still get a feeling that with Mesa, textures look worse than with Nvidia blob.

shmerl commented 6 years ago

Does this mod work on Linux by the way? http://www.moddb.com/mods/doom-3-bfg-hi-def

dukenukemx commented 6 years ago

Just tried dsalt's changes and the game works but I see what people are saying about that flash light, cause wow that's ugly. set r_useHDR "0" does fix it, but it also makes the game dark as hell, so no point really using it.

Been a number of years since I played Doom 3 but the texture look a bit ugly for some reason.

BielBdeLuna commented 6 years ago

if it annoys you, and you can live without it you can skin it out with a custom skin and apply to it a nodraw texture

shmerl commented 6 years ago

Setting set r_useHDR "0" doesn't make it too dark for me, actually without it, it looks too bright. May be play with gamma correction somehow?

dukenukemx commented 6 years ago

I left HDR on and just cranked up the brightness so I don't even need to use the flash light. I just want 2004 quality textures, cause the textures in this game are just so ugly. There is no way that Doom 3 looked like that from my memory, though in 2004 I was tweaking the shit out of that game. I really want Doom 3 BFG Hi def 3.0 for Linux.

shmerl commented 6 years ago

I agree, something is seriously off with textures here. I've red somewhere that in general, Doom 3 BFG degraded textures in comparison with original Doom 3, so it's probably not specific to open engines, but problem with assets themselves.

That mod I linked above, supposedly should restore high resolution textures, but it didn't do anything for me.

dukenukemx commented 6 years ago

How did you install the mod?

shmerl commented 6 years ago

I just copied it into the game directory like they recommend (aligning base path). But there is probably something else I'm missing.

dukenukemx commented 6 years ago

Tried just copying the base directory and the game will load a save but then go back to the menu. Something isn't working right.