Strange behavior of material (blend mode opaque) placed on instanced static mesh

Hi,

I have very strange rendering of material (blend mode opaque and Masked) placed on instanced static mesh.
Please look at video → link text

When I generated instances in instanced static mesh it looks like Antialiasing is activated after I move the camera.

If I set blend mode to Additive or Translucent it works fine.

Where is the problem ?

Thanks

The blurring is caused by the motion blur effect in UE4. Translucent materials do not cause motion blur in the same way, which is why changing your material to be translucent causes the effect to diminish.

You can disable motion blur by placing a postprocess volume in your world, setting it to Unbounded, and setting motion blur to 0.

Looks like you don’t know what I mean. I don’t mean blur effect itself. I am talking about not fully rendered grid until I will start move with camera.

Ah. Can you post a picture of your material’s node graph?

My guess is this is what is happening: You are hiding or unhiding some kind grid which is made out of a bunch of instanced static meshes and a material.

Is that right?

If so, I can tell you what is causing the artifacts. It is from the temporal AA that UE4 uses. Temporal AA gathers data across multiple frames to accomplish smooth subpixel rendering. However, if something is not moving on screen, it is discards the old data more slowly. This has some side effects. One of them is that if something completely vanishes or reappears instantly, the temporal AA will not respond to it correctly, because it does not think it is moving. Once you move the camera, the temporal AA discards older pixels, which will then converge on a clean result.

There are a few ways you can work around this. One way is to have your grid animate a little bit when you unhide it. For example, have it move on the Z axis a centimeters in a short animation after unhiding it. Another way would be to have 2 materials for your grid: one of them is translucent and has ‘responsive AA’ enabled, and then after a short period of time after unhiding the grid, you swap that material out for a regular opaque one.

Another way, if you are brave and a bit knowledgeable, would be to dig into the .usf shaders for vertex velocity buffers and temporal AA, and add your own code to flush the stale pixels out when you hide/unhide your grid.

There are probably other ways to accomplish this that I’m unaware of as well.

Hi thanks for answer. Here is my material nodes (very simple) and settings.

Basically what I am doing is :

FActorSpawnParameters xSpawnInfo;
xSpawnInfo.SpawnCollisionHandlingOverride =  ESpawnActorCollisionHandlingMethod::Undefined;
xSpawnInfo.Owner = pxFloor;
xSpawnInfo.Name = "FullGrid";
xSpawnInfo.Instigator = nullptr;
xSpawnInfo.bDeferConstruction = false;

// Position
FVector xLocation;
xLocation.X = ASC_Grid::s_fASSUMED_CELL_SIZE * 0.5f;
xLocation.Y = ASC_Grid::s_fASSUMED_CELL_SIZE * 0.5f;
xLocation.Z = 0.1f;

if (m_pxFullGrid == nullptr)
{
	m_pxFullGrid = pxWorld->SpawnActor<ASC_Grid>(ASC_Grid::StaticClass(),    xLocation,       FRotator::ZeroRotator, xSpawnInfo);
}

if (m_pxFullGrid && m_pxFullGrid->InstancedStaticMeshComponent)
{
	FTransform xCellTransform = m_pxFullGrid->GetTransform();
	const int32 iXNumCells = FMath::CeilToInt(pxFloor->GetComponentsBoundingBox().GetSize().X * 0.01f);
	const int32 iYNumCells = FMath::CeilToInt(pxFloor->GetComponentsBoundingBox().GetSize().Y * 0.01f);

	for (int32 i = 0; i < iYNumCells; ++i)
	{
		for (int32 j = 0; j < iXNumCells; ++j)
		{
			xCellTransform.SetLocation(FVector(ASC_Grid::s_fASSUMED_CELL_SIZE * j, ASC_Grid::s_fASSUMED_CELL_SIZE * i, 0.0f));
			m_pxFullGrid->InstancedStaticMeshComponent->AddInstance(xCellTransform);
		}
	}

	FString szPathName = "/Game/StarCrooks/Materials/Grid/GridCell";
	UMaterial* pxCellMaterial = Cast<UMaterial>(StaticLoadObject(UMaterial::StaticClass(), NULL, *szPathName));
	if (pxCellMaterial)
	{
		pxCellMaterial->bUsedWithInstancedStaticMeshes = true;
		m_pxFullGrid->InstancedStaticMeshComponent->SetMaterial(0, pxCellMaterial);
	}

	return true;
}

Ok. My guess is that it’s caused by temporal AA. You might want to try one of my suggestions from above, such as a brief animation after spawning the grid, or swapping out materials after a few frames of it being visible.

Thanks. I will try to swap the materials but I am a little bit scared that I will see some strange flesh during swap material in real time.