Your comments

I also got errors in an other shader: Undeclared identifier: sceneZ ( and then partZ ).

I fixed the issue by copy & paste the declaration of sceneZ and partZ before it is used in the code.

Sadly this fix is destroyed whenever I compile the shader.



The Introductions to Materials in UE4 look useful. Probably other UE4 material tutorials are helpful too.