Welcome, Guest.
Username: Password: Remember me

TOPIC: Prevent ReShade form Recompiling for each 3D model

Prevent ReShade form Recompiling for each 3D model 1 year 6 months ago #1

I started playing Project Zomboid again and suddenly had the crazy idea to try ReShade + SweetFX on this (predominantly) 2D OpenGL game with really good results: s15.postimg.org/hglasxtfv/Project_Zomboi...5_05_28_02_30_48.jpg

I used the ReShade (0.18.4) + SweetFX combo from here: sfx.thelazy.net/downloads/


Now there is a problem though, the game has recently updated to using 3D models and each time the game either loads a 3D player-, zombie-, or corpse-model, the message "Compile effect ... Successful!" appears in the upper left corner. I know you can get rid of the message itself, but the problem is that the SweetFX settings are briefly disabled for a split second each time the game loads a new 3D model somewhere around you, thus causing annoying flickering. Any ideas how I can prevent this from happening? :huh: I wouldn't mind, if all the effects weren't applied to the 3D models at all if that's what it takes.

Thank you for helping out! :cheer:
Last Edit: 1 year 6 months ago by Aaron Grey.
The administrator has disabled public write access.

Prevent ReShade form Recompiling for each 3D model 1 year 6 months ago #2

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2452
  • Thank you received: 1391
Could you post a log with this happening (preferably also writing down one or two timestamps when such a recompile due to a model load appears)? =)
Cheers, crosire =)
Last Edit: 1 year 6 months ago by crosire.
The administrator has disabled public write access.

Prevent ReShade form Recompiling for each 3D model 1 year 6 months ago #3

I deleted my last log and made a fresh one that's just a minute long or so. It features the tutorial where you have a few recompiles at the very beginning.

So the structure of the tutorial is basically like this:

1) Game loads up in the very beginning.

2) I start the tutorial from the menu and the game loads one or two 3D models in the very beginning, presumably the player model and perhaps something else which is leading to the first recompiles.

3) Then there is another recompile at 14:15:52, when a zombie moan is made off-screen. You cannot find this zombie anywhere on the map, it is supposed to be just the soundbyte anyway but it seems the Zomboid devs made this by very briefly spawning a zombie in and out or something like that.

4) A really good bit where I know exactly what's happening in-game comes at 14:16:15: It happens 3 times in total, first when a real zombie is spawned into the map, the second time it happens when you actually see that zombie and the third time it happens when you kill it (at which point its 3D corpse model replaces it).

4) From 14:17:35 onwards the game rapidly starts spawning more and more and more zombie models and keeps them coming at you indefinitely until you die. I pressed escape just 3 or 4 seconds after they rapidly started spawning in, so the log wouldn't be endlessly long but basically what you see in the last seconds is what keeps happening at a very rapid pace as more and more zombies are spawned - and naturally the picture flickers pretty spastically during all that time.

Full log:
pastebin.com/BvR2jwx7

Thank you so much for looking into it, that's very nice of you :)
Last Edit: 1 year 6 months ago by Aaron Grey.
The administrator has disabled public write access.

Prevent ReShade form Recompiling for each 3D model 1 year 6 months ago #4

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2452
  • Thank you received: 1391
Looks like it's not directly related to the 3D model loading, but due to the game resetting the OpenGL context after each frame. That currently forces ReShade to perform cleanup, so it destroys all effects, only to reload them shortly after in the next frame or a few frames later. Might need to find a better solution for handling single OpenGL context games, without breaking the system for modern games, which usually use multiple contexts spread across multiple threads.
Cheers, crosire =)
The administrator has disabled public write access.

Prevent ReShade form Recompiling for each 3D model 1 year 6 months ago #5

Hmm I think I understood what you're saying: So the cleanup process is basically constantly running even though I cannot visuall detect this redundant process in-game, however the process shows itself as flickering if the 3D models are loaded. Ideally a game like Zomboid schouldn't be making so many clean-ups in the first place though, is that what you're saying? Is there possibly some kind of quick and dirty hack you can think of that I might try out - something that simply "locks" and prevents ReShade from performing any sort of clean-up entirely after the effects have been loaded once?
Last Edit: 1 year 6 months ago by Aaron Grey.
The administrator has disabled public write access.

Prevent ReShade form Recompiling for each 3D model 1 year 6 months ago #6

  • v00d00m4n
  • v00d00m4n's Avatar
  • Offline
  • Posts: 44
  • Thank you received: 3
how about adding simple switch define шт reshade.fx that will tell reshade to use alternate behavior for such cases?

Something like

#define dont_refresh_on_context_reset_hack = true

?

So for most games it will keep working like it does now and for some poorly coded games like this alternate behavior can be forced by single line?
Last Edit: 1 year 6 months ago by v00d00m4n.
The administrator has disabled public write access.

Prevent ReShade form Recompiling for each 3D model 1 year 6 months ago #7

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2452
  • Thank you received: 1391
@Aaron Grey: Yes, that's pretty much it. OpenGL doesn't really forbid you to do it the way the games does it. It's valid, but it's rather ugly. Might work by doing a check on how many OpenGL contexts the game created and only clean up if there are more than one and otherwise leave it be until the end.
@v00d00m4n: I don't like hacky things. There are always better ways to do it properly. =)
Cheers, crosire =)
The administrator has disabled public write access.
The following user(s) said Thank You: Aaron Grey

Prevent ReShade form Recompiling for each 3D model 1 year 6 months ago #8

Well Project Zomboid is still in alpha stage so it may change in the very distant future :)
Last Edit: 1 year 6 months ago by Aaron Grey.
The administrator has disabled public write access.

Prevent ReShade form Recompiling for each 3D model 1 year 6 months ago #9

Any idea how this might be solved yet? :side: I'd love to get it to work so I can uplad my preset on sfx.thelazy and make a guide on how to set it up on in the steam community forum.
The administrator has disabled public write access.