How to avoid resave niagara when shaderversion.ush changed?

As problems says, changed shaderversion.ush will make all niagara precompiling for bSystemScriptsAreSynchronized and bEmitterScriptsAreSynchronized can be false.

Niagara Script save CachedScriptVMId and CachedScriptVM, hash of shaderversion.ush is part of ReferencedCompileHashes in CachedScriptVMId.

The only way to eliminate precompile is to save all niagara assets. But it’s not a trivial thing in our team contain huge niagara assets. Change shaderversion.ush offen is useful to refresh DDC of material not niagara.

Any good advices to solve this problem?

Steps to Reproduce

  1. Changed shaderverion.ush by cmd ‘r.InvalidateCachedShaders’.
  2. Add ‘LogNiagara=all’
  3. PIE play with a level with niagara inside.

You will find a lot of compiling system logs.

Hi there, and thanks for the question!

The main goal with having the compilation backed by DDC is that we can avoid the compilation in this scenario. From your question, I’m assuming that this is working as intended as you’re asking about trying to eliminate the ‘precompile’ as opposed to the actual compile. If that is indeed true, then as things stand right now we are currently limited with what we can do as we end up having to do a non-trivial amount of work to generate the DDC key for Niagara systems (the most significant being the cost of generating the list of rapid iteration parameters).

We understand that while resaving assets will improve things, it’s far from a perfect solution as the gains you get from doing the resave only last as long as things remain static, and that’s largely not true in a development environment. We’ve got a number of plans to address this issue, but don’t have any firm time frame for when we’ll get to them.

Yes, eliminate the ‘precompile’. For precompile one niagara system may cost 0.xx s, but when PIE maybe hundreds niagara systems need to precompile lead to time cost can not be ignored.

I’m trying not to modify shaderverion.ush as much as possible. Thanks for your reply

Hopefully we’ll be able to make some more progress on eliminating the precompile cost entirely, we understand that it can be quite a drain on people’s time and patience!