PC versions of recent game releases (e.g. Forza Horizon 5, Starfield, Uncharted 4, etc.) have a feature where it compiles the shaders in runtime on first time boot before the gameplay, and it tracks how far the progress of the runtime shader compiling goes.
Lies of P is a UE4 game, and it has aforementioned feature of tracking progress of compiling shader before going into the gameplay proper. How is this done? Is there a way to do it in my own project?
I don’t mind getting my hands dirty with C++ and use delegate or exposed variables that keep track of the runtime shader compilation. But I haven’t found any lead on how to achieve it.
the simplest answer is overriding the AssetManager. though as far as I know the AssetManager does not broadcast progress, but is designed to broadcast to Bound Delegates on completion/failure. if you override the AssetManager (by inheriting from it which is C++ exclusive) you can have it update a % based on finishing loading each thing it has been asked to load.
keep in mind that the compiled shaders once completed live on GPU VRAM so if you intend to load all of your shaders on start up you will be setting an absolute minimum for GPU VRAM of your application, and depending on the “resolution” of your texture files in the materials that make up the shader that number can get high quickly.
P.S. using “X of Y things completed” as a % completed is why it can seam the Editor will “freeze” on startup at 75% and 95% because the things it is doing at those steps is actually quite intensive and often times big things, so it appears that it has frozen because humans want a number that was increasing at a rate to continue increasing at that rate (the Editor launching is “fast” from 0-74%, and then often it has a slow down during 75% then in my experience will jump to like 80% after a few seconds to a minute, is fast again until 94%, and then depending on your GPU could take a few seconds to maybe a couple minutes, then will just be done)
this is also similar to why “Windows time” became such a meme in XP through Windows 7/8 where it would use time to complete first task multiplied by number of remaining task as the amount of “time” to complete all queued tasks, and the OS programmers ASSUMED that all tasks would be evenly distributed which any amount of time in making installers/batch-files would tell them that is so much BS we get the meme of “Windows Time” ( 0:0:30,…, 2:20:10, done)