Avicr
(Avicr)
December 22, 2016, 8:18pm
43
No problem. I know what you’re talking about, your WaveWorks expressions get stripped in 4.12.5, I’ll just copy/paste my part of the email dialog with NVIDIA in October:
"First, it took me a while to figure out why WaveWorks is not working in the packaged game, after seeing that there are MaterialExpressions missing in the ocean shader (that’s using WaveWorks) when debugging packaged game,
I searched UE4 release notes and found this: “New: Material expression objects that are not required in cooked build will now be stripped from cooked packages.”. Since I clearly needed all stripped expressions in ocean material, there had to be a problem.
Indeed it was, in the file (UE4 project) “MaterialExpressions.cpp” there are multiple new overriding methods that start with “NeedsLoadFor…” these return true is something (like material expression, material function call etc.) is needed in a certain context (Client, Server) or false if is not.
My problem was caused by “bool UMaterialExpression::NeedsLoadForClient() const” that stripped my WaveWorks expression because it assumes that “Expressions that reference texture objects need to be cooked” the WaveWorks expression does not DIRECTLY reference texture object and therefore it gets stripped and breaks the material,
which triggers a series of events that totally disable WaveWorks.
Quick fix is to just always return true in these functions. I ended up adding “bool NeverStrip;” to UMaterialExpression and then returning true if(expression has texture reference or NeverStrip is true), so that you can check that in the material editor for situations like this."
Follow the above and it should fix your 4.12.5 problem.
I have fixed the wave works material expression being cooked out by returning true in NeedsLoadForClient(), but the wave works asset still will not show in a cooked build. The cooked build crashes after a “random” amount of time somewhere in either an nvidia dll, or D3D11 itself. This leads me to believe some wave works RHI or other render resource is not being setup correctly during cooked build execution. Any other tips you can provide?