diff --git a/Source/RapyutaSimulationPlugins/Private/Sensors/RRROS2CameraComponent.cpp b/Source/RapyutaSimulationPlugins/Private/Sensors/RRROS2CameraComponent.cpp index 8acabc7f..fc1d0a18 100644 --- a/Source/RapyutaSimulationPlugins/Private/Sensors/RRROS2CameraComponent.cpp +++ b/Source/RapyutaSimulationPlugins/Private/Sensors/RRROS2CameraComponent.cpp @@ -2,6 +2,8 @@ #include "Sensors/RRROS2CameraComponent.h" +#include "BufferVisualizationData.h" + URRROS2CameraComponent::URRROS2CameraComponent() { // component initialization @@ -20,6 +22,14 @@ void URRROS2CameraComponent::PreInitializePublisher(UROS2NodeComponent* InROS2No SceneCaptureComponent->FOVAngle = CameraComponent->FieldOfView; SceneCaptureComponent->OrthoWidth = CameraComponent->OrthoWidth; + if (CameraType == EROS2CameraType::DEPTH) + { + FWeightedBlendable blendable(1.0f, GetBufferVisualizationData().GetMaterial(TEXT("SceneDepth"))); + CameraComponent->PostProcessSettings.WeightedBlendables.Array.Add(blendable); + SceneCaptureComponent->PostProcessSettings = CameraComponent->PostProcessSettings; + SceneCaptureComponent->CaptureSource = ESceneCaptureSource::SCS_FinalColorHDR; + } + RenderTarget = NewObject(this, UTextureRenderTarget2D::StaticClass()); RenderTarget->InitCustomFormat(Width, Height, EPixelFormat::PF_B8G8R8A8, true); SceneCaptureComponent->TextureTarget = RenderTarget; diff --git a/Source/RapyutaSimulationPlugins/Public/Sensors/RRROS2CameraComponent.h b/Source/RapyutaSimulationPlugins/Public/Sensors/RRROS2CameraComponent.h index 8ecc2fc3..77978e78 100644 --- a/Source/RapyutaSimulationPlugins/Public/Sensors/RRROS2CameraComponent.h +++ b/Source/RapyutaSimulationPlugins/Public/Sensors/RRROS2CameraComponent.h @@ -32,6 +32,13 @@ struct FRenderRequest FRenderCommandFence RenderFence; }; +UENUM(BlueprintType) +enum class EROS2CameraType : uint8 +{ + RGB UMETA(DisplayName = "RGB"), + DEPTH UMETA(DisplayName = "Depth") +}; + /** * @brief ROS 2 Camera component. Uses USceneCaptureComponent2D. * @@ -103,6 +110,9 @@ class RAPYUTASIMULATIONPLUGINS_API URRROS2CameraComponent : public URRROS2BaseSe UPROPERTY(EditAnywhere, BlueprintReadWrite) int32 QueueSize = 2; + UPROPERTY(EditAnywhere, BlueprintReadWrite) + EROS2CameraType CameraType = EROS2CameraType::RGB; + // ROS /** * @brief Update ROS 2 Msg structure from #RenderRequestQueue