Material for photogrammetry environment? real time casted shadows over unlit material?

Ok, I tried the following but I can’t get to it:



half3 Emissive = GetMaterialEmissive(PixelMaterialInputs);
	#if MATERIALBLENDING_SOLID || MATERIALBLENDING_MASKED
		float2 NDC = MaterialParameters.ScreenPosition.xy / MaterialParameters.ScreenPosition.w;
		float2 ScreenUV = NDC * ResolvedView.ScreenPositionScaleBias.xy + ResolvedView.ScreenPositionScaleBias.wz;
		float4 BoneDynamicShadowFactors = GetPerPixelLightAttenuation(ScreenUV);	
		Emissive *= BoneDynamicShadowFactors;
	#endif		


Basically I took the code that I understood as DynamicShadow code and duplicated it inside a different IF just after the Emissive declaration, and after that I multiply the Emissive for my DynamicShadowFactors, but when I compile this UE crash, if I reopen the project without deleting “Intermediate” and “Saved” folders and without commenting my lines, UE keeps crashing (I’m on UE 4.14 BTW)

Am I multiplying Emissive by the right variable?

Is there another “Shadow” variable that I should be using instead of that one?

It’s important to know that I only need Dynamic shadows, if Baked shadows are a subproduct it’s ok, but the important shadows are the Dynamic ones.

Thanks for all the help!