[Fix] Invisible spline meshes in instance segmentation (UE4) (#8714)

* Added explicit support for SplineMeshSceneProxy (e.g. PowerPoles) in TaggedComponent, rendering them visible in the instance segmentation.

* Described bug fix in changelog.
This commit is contained in:
Thies de Graaff 2025-03-12 13:11:36 +01:00 committed by GitHub
parent 6292059fd0
commit f45dd6943c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 48 additions and 1 deletions

View File

@ -30,6 +30,7 @@
* carla.ad subpackages are now directly importable and are not directly importable anymore (e.g. import ad)
* Fixed segfault in traffic manager when trying to access not available vehicles
* Fixed invalid comparission in python examples/rss
* Fixed invisible spline meshes in instance segmentation
## CARLA 0.9.15

View File

@ -123,7 +123,12 @@ FPrimitiveSceneProxy * UTaggedComponent::CreateSceneProxy(UStaticMeshComponent *
return NULL;
}
return new FTaggedStaticMeshSceneProxy(StaticMeshComponent, true, TaggedMID);
USplineMeshComponent* SplineMeshComponent = Cast<USplineMeshComponent>(StaticMeshComponent);
if (SplineMeshComponent) {
return new FTaggedSplineMeshSceneProxy(SplineMeshComponent, TaggedMID);
} else {
return new FTaggedStaticMeshSceneProxy(StaticMeshComponent, true, TaggedMID);
}
}
FPrimitiveSceneProxy * UTaggedComponent::CreateSceneProxy(USkeletalMeshComponent * SkeletalMeshComponent)
@ -242,6 +247,34 @@ FPrimitiveViewRelevance FTaggedStaticMeshSceneProxy::GetViewRelevance(const FSce
return ViewRelevance;
}
//
// FTaggedSplineMeshSceneProxy
//
FTaggedSplineMeshSceneProxy::FTaggedSplineMeshSceneProxy(USplineMeshComponent * Component, UMaterialInstance * MaterialInstance) :
FSplineMeshSceneProxy(Component)
{
TaggedMaterialInstance = MaterialInstance;
// Replace materials with tagged material
bVerifyUsedMaterials = false;
for (FLODInfo& LODInfo : LODs) {
for (FLODInfo::FSectionInfo& SectionInfo : LODInfo.Sections) {
SectionInfo.Material = TaggedMaterialInstance;
}
}
}
FPrimitiveViewRelevance FTaggedSplineMeshSceneProxy::GetViewRelevance(const FSceneView * View) const
{
FPrimitiveViewRelevance ViewRelevance = FSplineMeshSceneProxy::GetViewRelevance(View);
ViewRelevance.bDrawRelevance = ViewRelevance.bDrawRelevance && !View->Family->EngineShowFlags.NotDrawTaggedComponents;
ViewRelevance.bShadowRelevance = false;
return ViewRelevance;
}
//
// FTaggedSkeletalMeshSceneProxy
//

View File

@ -4,6 +4,7 @@
#include "Materials/MaterialInstanceDynamic.h"
#include "Engine/InstancedStaticMesh.h"
#include "Components/HierarchicalInstancedStaticMeshComponent.h"
#include "SplineMeshSceneProxy.h"
#include "Landscape.h"
#include "LandscapeRender.h"
#include "LandscapeMaterialInstanceConstant.h"
@ -59,6 +60,18 @@ private:
UMaterialInstance * TaggedMaterialInstance;
};
class FTaggedSplineMeshSceneProxy : public FSplineMeshSceneProxy
{
public:
FTaggedSplineMeshSceneProxy(USplineMeshComponent * Component, UMaterialInstance * MaterialInstance);
virtual FPrimitiveViewRelevance GetViewRelevance(const FSceneView * View) const override;
private:
UMaterialInstance * TaggedMaterialInstance;
};
class FTaggedSkeletalMeshSceneProxy : public FSkeletalMeshSceneProxy
{
public: