Hey everyone,
I’m using a decal to project a simple circle texture onto level geometry. Everything’s fine, until the decal is moved around the world:
(Please watch video on YouTube, not here, and set to HD - otherwise, you won’t notice the artifacts):
The decals are flickering, and I’m noticing a very short fade-in time when creating them. Does anyone know how to change that, or is aware of any more fitting way of projecting the texture?
Here’s my current setup:
DecalTexture (Simple texture with alpha)
DecalMaterial (Simple material coloring the white texture, applying its alpha, and blending the decal in translucent mode)
Character with DecalComponent (Rotated downwards, so the texture is projected onto the world)
The decal size is adjusted to fit the character size at run-time:
void ARTSCharacter::BeginPlay()
{
Super::BeginPlay();
// ...
SelectionCircleDecalComponent->DecalSize = FVector(
GetCapsuleComponent()->GetCollisionShape().Capsule.HalfHeight * 2,
GetCapsuleComponent()->GetCollisionShape().Capsule.Radius * 2,
GetCapsuleComponent()->GetCollisionShape().Capsule.Radius * 2);
}
Then, it’s moved along with the character every frame:
void ARTSCharacter::Tick(float DeltaSeconds)
{
// ...
if (bSelected)
{
SelectionCircleDecalComponent->SetWorldLocation(GetActorLocation());
}
}
EDIT: This is an open-source project. You can take a look at all assets and code at GitHub - npruehs/ue4-rts: Real-time strategy plugin and showcase for Unreal Engine 4.