Flickering Decal

Hello,

I’m using decals to place over my objects in my game but my DecalActors flicker inside the editor window and when I’m playing the game, See gif below. I tried creating an instance of the Splat material and adding a physics material to it, after that I set those inside the project settings surface options. It seemed to have worked for a little while until it stopped working so now I’m not sure what is causing this.

193209-1tocb5.gif

This may be related to an issue I’ve just discovered in the MeshDecal.usf engine shader. Basically the MeshDecal shader needs to be brought up to speed with fixes already applied to the VelocityShader.usf. My work of the shader has become a little more complicated but I think the main factor is this line.

		WorldPosition.xyz += GetMaterialWorldPositionOffset(VertexParameters);

change to:

	// Isolate instructions used for world position offset on xbox 360, 
	// As these cause the optimizer to generate different position calculating instructions in each pass, resulting in self-z-fighting.
	// This is only necessary for shaders used in passes that have depth testing enabled.
	ISOLATE
	{
		WorldPosition.xyz += GetMaterialWorldPositionOffset(VertexParameters);
	}

I upgraded my graphics card from an older 550ti to a new gtx1060. UE4 runs much better now and I have not seen those flickers since.

Joti, it’s still possible that this is a bug in the engine but for now I will mark this as solved and If I see them again I will edit this but for now it seems to have been the solution for me.