Necromunda: Hired Gun

Necromunda: Hired Gun

View Stats:
heh Jun 1, 2021 @ 10:03am
[UE4] Shader Compilation Stutter
I have played it for a bit, its decent. Gunplay kinda feels like RAGE2 and is pretty good.
But there is noticeable shader compilation stutter. I dont get why dev teams still compile them at runtime and cause cpu stalls. UE4 is probably the engine that stutters the most since its vanilla streaming / shader compilation system is awful.

I know its only happening when approaching new areas / enemies / whatever. It will probably be smooth once you've finished the game and shader cache has been built up. But you can't expect people to go through this stuttery mess.

Theres a few possible approaches to mitigate this issue:
- pre-compile shaders in the main menu (like it is in WARZONE)
- render everything in the scene with at least 1 primitive per mesh
- compile them in a separate thread and give the driver at least 500ms before making use of it, e.g. before calling SetShader related stuff / before drawing them

Please fix this so I can finally enjoy the game.
< >
Showing 1-11 of 11 comments
heh Jun 4, 2021 @ 9:51am 
Push
Streum_Smiton Jun 4, 2021 @ 10:00am 
Thanks for the detailed feedback, we know about this issue and already have done some work on PSO precaching in our local builds. I can't promise it will be ready for the next patch or anything but we are actively looking into it.
heh Jun 5, 2021 @ 7:00am 
Glad to hear this! Thanks a lot.
Snobby Hobo Jun 5, 2021 @ 7:12am 
Originally posted by flooo:
Glad to hear this! Thanks a lot.
This is an interesting one. Is there any inherent advantage to not compiling the shaders beforehand? Do the shaders live in the RAM from the moment of compilation onwards or can they be externalized also? The documentation on this is actually pretty unclear.
heh Jun 5, 2021 @ 11:22am 
Originally posted by Incredibly average:
Originally posted by flooo:
Glad to hear this! Thanks a lot.
This is an interesting one. Is there any inherent advantage to not compiling the shaders beforehand? Do the shaders live in the RAM from the moment of compilation onwards or can they be externalized also? The documentation on this is actually pretty unclear.

I can see no real benefit in not pre-compiling them before loading into a level / sitting in the main menu. It most likely is just extra work most devs don't want to do. Especially for small teams. On consoles they usually ship them pre-compiled with the game package. But on PCs they need to be compiled separately since theres a big variety of different GPU models / driver versions.

AMD / Nvidias shader cache helps to mitigate this issue since its storing shaders on disk after they have been compiled so they don't need to do this another time. But this still results in stuttering upon entering a new area / spawning new enemies / effects etc.
Last edited by heh; Jun 5, 2021 @ 11:26am
Grim@FU_BARRACUDA Jun 5, 2021 @ 11:31am 
Originally posted by Streum_Smiton:
Thanks for the detailed feedback, we know about this issue and already have done some work on PSO precaching in our local builds. I can't promise it will be ready for the next patch or anything but we are actively looking into it.

Hmm thats good News i thought you were already done with your Game.
Snobby Hobo Jun 5, 2021 @ 11:40am 
Originally posted by flooo:
Originally posted by Incredibly average:
This is an interesting one. Is there any inherent advantage to not compiling the shaders beforehand? Do the shaders live in the RAM from the moment of compilation onwards or can they be externalized also? The documentation on this is actually pretty unclear.

I can see no real benefit in not pre-compiling them before loading into a level / sitting in the main menu. It most likely is just extra work most devs don't want to do. Especially for small teams. On consoles they usually ship them pre-compiled with the game package. But on PCs they need to be compiled separately since theres a big variety of different GPU models / driver versions.

AMD / Nvidias shader cache helps to mitigate this issue since its storing shaders on disk after they have been compiled so they don't need to do this another time. But this still results in stuttering upon entering a new area / spawning new enemies / effects etc.

Don't get me wrong as I don't know much about how the UE interfaces with the rendering API, but compiling beforehand should be a completely trivial task right? At least in both Vulkan and OpenGL it is (it's really just calling the appropriate binary to compile something).

If there's no benefit to not precompiling this honestly should have been done in every case then. Especially if I'm right and it's practically no additional work.
heh Jun 5, 2021 @ 12:21pm 
Originally posted by Incredibly average:
Originally posted by flooo:

I can see no real benefit in not pre-compiling them before loading into a level / sitting in the main menu. It most likely is just extra work most devs don't want to do. Especially for small teams. On consoles they usually ship them pre-compiled with the game package. But on PCs they need to be compiled separately since theres a big variety of different GPU models / driver versions.

AMD / Nvidias shader cache helps to mitigate this issue since its storing shaders on disk after they have been compiled so they don't need to do this another time. But this still results in stuttering upon entering a new area / spawning new enemies / effects etc.

Don't get me wrong as I don't know much about how the UE interfaces with the rendering API, but compiling beforehand should be a completely trivial task right? At least in both Vulkan and OpenGL it is (it's really just calling the appropriate binary to compile something).

If there's no benefit to not precompiling this honestly should have been done in every case then. Especially if I'm right and it's practically no additional work.

Yes it basically just calls the compiler on each shader to turn them from a high level shader language into gpu readable code.
Not sure about the actual implementation time since it may vary from engine to engine and I never had to bother with this.

It may take up to 10 minutes when pre-compiling them all at once in the main menu. That may be a downside for some. Or level load times might be longer. But I'd rather wait 10 minutes upon the first game launch than having to mess with intermittent stutters.
Boner Queef Jun 5, 2021 @ 12:29pm 
Thanks for this thread fyi. I came here to post about this but you already covered it way better than I could have. For me, this is unplayable in it's current state but I'll be glad to return once it's been patched up.
Meddy83 Jun 5, 2021 @ 12:40pm 
Agree please fix that permanent micro stuttering
Snobby Hobo Jun 5, 2021 @ 12:58pm 
Originally posted by flooo:
Originally posted by Incredibly average:

Don't get me wrong as I don't know much about how the UE interfaces with the rendering API, but compiling beforehand should be a completely trivial task right? At least in both Vulkan and OpenGL it is (it's really just calling the appropriate binary to compile something).

If there's no benefit to not precompiling this honestly should have been done in every case then. Especially if I'm right and it's practically no additional work.

Yes it basically just calls the compiler on each shader to turn them from a high level shader language into gpu readable code.
Not sure about the actual implementation time since it may vary from engine to engine and I never had to bother with this.

It may take up to 10 minutes when pre-compiling them all at once in the main menu. That may be a downside for some. Or level load times might be longer. But I'd rather wait 10 minutes upon the first game launch than having to mess with intermittent stutters.

I agree. I've never had to compile large batches of shaders myself so I wouldn't know how long it'd take. But I too would prefer this compilation step during some setup rather than face stuttering in game.
< >
Showing 1-11 of 11 comments
Per page: 1530 50

Date Posted: Jun 1, 2021 @ 10:03am
Posts: 11