How get rid of this noise on Procedural Meshes?

So, I have created some meshes with UProceduralMeshComponent, it seems to be correctly connected, but it has this noise mainly on sides of the mesh, is it normal? or there is a way to get rid of them?

image

void ADungeonMesh::Initialize(UShape* Shape, float Height, float ZOffset)
{
	const auto NormalVerts = CreateVertices(Shape, Height, ZOffset);
	TArray<FVector> Normals = {};
	TArray<int> Triangles = {};

	for (const auto Direction : Direction3DFunctions::GetDirections())
	{
		switch (Direction)
		{
		case EDirection3D::Top:
			{
				Triangles.Append({
					FNamedVertices::GetTopDownRight(),
					FNamedVertices::GetTopDownLeft(),
					FNamedVertices::GetTopUpLeft(),
					FNamedVertices::GetTopDownRight(),
					FNamedVertices::GetTopUpLeft(),
					FNamedVertices::GetTopUpRight(),
				});
				break;
			}
		case EDirection3D::Right:
			{
				Triangles.Append({
					FNamedVertices::GetRightDownLeft(),
					FNamedVertices::GetRightUpLeft(),
					FNamedVertices::GetRightDownRight(),
					FNamedVertices::GetRightDownRight(),
					FNamedVertices::GetRightUpLeft(),
					FNamedVertices::GetRightUpRight(),
				});
				break;
			}
		case EDirection3D::Bottom:
			{
				Triangles.Append({
					FNamedVertices::GetBottomDownLeft(),
					FNamedVertices::GetBottomDownRight(),
					FNamedVertices::GetBottomUpLeft(),
					FNamedVertices::GetBottomDownRight(),
					FNamedVertices::GetBottomUpRight(),
					FNamedVertices::GetBottomUpLeft(),
				});
				break;
			}
		case EDirection3D::Left:
			{
				Triangles.Append({
					FNamedVertices::GetLeftDownLeft(),
					FNamedVertices::GetLeftUpLeft(),
					FNamedVertices::GetLeftDownRight(),
					FNamedVertices::GetLeftDownRight(),
					FNamedVertices::GetLeftUpLeft(),
					FNamedVertices::GetLeftUpRight(),
				});
				break;
			}
		case EDirection3D::Back:
			{
				Triangles.Append({
					FNamedVertices::GetBackDownLeft(),
					FNamedVertices::GetBackUpLeft(),
					FNamedVertices::GetBackDownRight(),
					FNamedVertices::GetBackDownRight(),
					FNamedVertices::GetBackUpLeft(),
					FNamedVertices::GetBackUpRight(),
				});
				break;
			}
		case EDirection3D::Front:
			{
				Triangles.Append({
					FNamedVertices::GetFrontBottomLeft(),
					FNamedVertices::GetFrontTopLeft(),
					FNamedVertices::GetFrontBottomRight(),
					FNamedVertices::GetFrontBottomRight(),
					FNamedVertices::GetFrontTopLeft(),
					FNamedVertices::GetFrontTopRight(),
				});
				break;
			}
		}
	}

	Mesh->CreateMeshSection(0, NormalVerts.Vertices, Triangles, NormalVerts.Normals
	                        , {}, {},
	                        TArray<FProcMeshTangent>(),
	                        true);
}

FNormalVertices ADungeonMesh::CreateVertices(const UShape* Shape, const float Height,

                                             const float ZOffset
)
{
	TArray<FVector> Vertices = {};
	TArray<FVector> Normals = {};

	// Bottom
	Vertices.Append({
		FVector(Shape->Position.X, Shape->Position.Y, 0 + ZOffset),
		FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y, 0 + ZOffset),
		FVector(Shape->Position.X, Shape->Position.Y + Shape->Size.Y, 0 + ZOffset),
		FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y + Shape->Size.Y,
		        0 + ZOffset),
	});
	Normals.Append({
		FVector::DownVector,
		FVector::DownVector,
		FVector::DownVector,
		FVector::DownVector
	});

	// Front
	Vertices.Append({
		FVector(Shape->Position.X, Shape->Position.Y, 0 + ZOffset),
		FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y, 0 + ZOffset),
		FVector(Shape->Position.X, Shape->Position.Y, Height + ZOffset),
		FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y, Height + ZOffset),
	});
	Normals.Append({
		FVector::BackwardVector,
		FVector::BackwardVector,
		FVector::BackwardVector,
		FVector::BackwardVector,
	});

	// Left
	Vertices.Append({
		FVector(Shape->Position.X, Shape->Position.Y + Shape->Size.Y, 0 + ZOffset),
		FVector(Shape->Position.X, Shape->Position.Y, 0 + ZOffset),
		FVector(Shape->Position.X, Shape->Position.Y + Shape->Size.Y, Height + ZOffset),
		FVector(Shape->Position.X, Shape->Position.Y, Height + ZOffset),
	});
	Normals.Append({
		FVector::LeftVector,
		FVector::LeftVector,
		FVector::LeftVector,
		FVector::LeftVector
	});

	// Back
	Vertices.Append({
		FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y + Shape->Size.Y, 0 + ZOffset),
		FVector(Shape->Position.X, Shape->Position.Y + Shape->Size.Y, 0 + ZOffset),
		FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y + Shape->Size.Y,
		        Height + ZOffset),
		FVector(Shape->Position.X, Shape->Position.Y + Shape->Size.Y, Height + ZOffset),
	});
	Normals.Append({
		FVector::ForwardVector,
		FVector::ForwardVector,
		FVector::ForwardVector,
		FVector::ForwardVector,
	});

	// Right
	Vertices.Append({
		FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y, 0 + ZOffset),
		FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y + Shape->Size.Y, 0 + ZOffset),
		FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y, Height + ZOffset),
		FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y + Shape->Size.Y,
		        Height + ZOffset),
	});
	Normals.Append({
		FVector::RightVector,
		FVector::RightVector,
		FVector::RightVector,
		FVector::RightVector,
	});

	// Top
	Vertices.Append({
		FVector(Shape->Position.X, Shape->Position.Y, Height + ZOffset),
		FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y, Height + ZOffset),
		FVector(Shape->Position.X, Shape->Position.Y + Shape->Size.Y, Height + ZOffset),
		FVector(Shape->Position.X + Shape->Size.X, Shape->Position.Y + Shape->Size.Y,
		        Height + ZOffset),
	});
	Normals.Append({
		FVector::UpVector,
		FVector::UpVector,
		FVector::UpVector,
		FVector::UpVector,
	});

	return FNormalVertices{Normals, Vertices};
}

The noise is probably caused by lumen. Object scale may also play a role in shadow artifacts with virtual shadows maps.

Try turning off lumen and see if the noise disappears.
You can also try switching virtual shadow maps to shadow maps for a test to see if it smooths out.

I have messed around the normals and it seems to have softened the problem, still not sure if the normals is 100% correct now, but it was probably wrong

Still I have this gradient effect, were walls/floors far away are darker, is it also normal or the result from misconfigured normals, lighting or the lack of a material?

The darker portions near the lower part where the walls meet the floor is due to ambient occlusion.

I’m talking about more about this effect on the ground for example

Where the bottom part is bright and the top part is gray

I would test it in an unlit preview. It may be that normals are causing a smoothing effect.

Though the way it fades mid wall might suggest that it’s some sort of screen space effect (maybe ssao?)

That’s the unlint result

Actually I’m starting to think that’s a Editor only thing, because when I went back to the game camera, the gradient fades away, sorry for that :sweat_smile:, thank you for you help.

Yeah, actually no, the gradient still there, it was just that I was too far away

image

It’s probably just because it has no material applied, I have dropped a random material and now the gradient is way less visible

image

Try adding in a default cube with the same material. Scale it up and see if the effect is the same on it (the non procedural mesh)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.