CARLA
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
AShaderBasedSensor Class Reference

A sensor that produces data by applying post-process materials (shaders) to a scene capture image. More...

#include <ShaderBasedSensor.h>

+ Inheritance diagram for AShaderBasedSensor:
+ Collaboration diagram for AShaderBasedSensor:

Public Member Functions

bool AddPostProcessingMaterial (const FString &Path)
 Load the UMaterialInstanceDynamic at the given Path and append it to the list of shaders with Weight. More...
 
void AddShader (const FSensorShader &Shader)
 Add a post-processing shader. More...
 
 AShaderBasedSensor (const FObjectInitializer &ObjectInitializer)
 
void Set (const FActorDescription &ActorDescription) override
 
void SetFloatShaderParameter (uint8_t ShaderIndex, const FName &ParameterName, float Value)
 
- Public Member Functions inherited from ASceneCaptureSensor
bool ArePostProcessingEffectsEnabled () const
 
 ASceneCaptureSensor (const FObjectInitializer &ObjectInitializer)
 
void Enable16BitFormat (bool Enable=false)
 
void EnablePostProcessingEffects (bool Enable=true)
 
void EnqueueRenderSceneImmediate ()
 Immediate enqueues render commands of the scene at the current time. More...
 
float GetAperture () const
 
int GetBladeCount () const
 
float GetBloomIntensity () const
 
USceneCaptureComponent2DGetCaptureComponent2D ()
 
UTextureRenderTarget2D * GetCaptureRenderTarget ()
 
float GetChromAberrIntensity () const
 
float GetChromAberrOffset () const
 
float GetDepthBlurAmount () const
 
float GetDepthBlurRadius () const
 
float GetDepthOfFieldMinFstop () const
 
float GetExposureCalibrationConstant () const
 
float GetExposureCompensation () const
 
float GetExposureMaxBrightness () const
 
EAutoExposureMethod GetExposureMethod () const
 
float GetExposureMinBrightness () const
 
float GetExposureSpeedDown () const
 
float GetExposureSpeedUp () const
 
float GetFilmBlackClip () const
 
float GetFilmShoulder () const
 
float GetFilmSlope () const
 
float GetFilmToe () const
 
float GetFilmWhiteClip () const
 
float GetFocalDistance () const
 
float GetFOVAngle () const
 
uint32 GetImageHeight () const
 
uint32 GetImageWidth () const
 
float GetISO () const
 
float GetLensFlareIntensity () const
 
float GetMotionBlurIntensity () const
 
float GetMotionBlurMaxDistortion () const
 
float GetMotionBlurMinObjectScreenSize () const
 
float GetShutterSpeed () const
 
float GetTargetGamma () const
 
float GetWhiteTemp () const
 
float GetWhiteTint () const
 
bool Is16BitFormatEnabled () const
 
bool ReadPixels (TArray< FColor > &BitMap) const
 Use for debugging purposes only. More...
 
void SaveCaptureToDisk (const FString &FilePath) const
 Use for debugging purposes only. More...
 
void SetAperture (float Aperture)
 
void SetBladeCount (int Count)
 
void SetBloomIntensity (float Intensity)
 
void SetChromAberrIntensity (float Intensity)
 
void SetChromAberrOffset (float ChromAberrOffset)
 
void SetDepthBlurAmount (float Amount)
 
void SetDepthBlurRadius (float Radius)
 
void SetDepthOfFieldMinFstop (float MinFstop)
 
void SetExposureCalibrationConstant (float Constant)
 
void SetExposureCompensation (float Compensation)
 
void SetExposureMaxBrightness (float Brightness)
 
void SetExposureMethod (EAutoExposureMethod Method)
 
void SetExposureMinBrightness (float Brightness)
 
void SetExposureSpeedDown (float Speed)
 
void SetExposureSpeedUp (float Speed)
 
void SetFilmBlackClip (float BlackClip)
 
void SetFilmShoulder (float Shoulder)
 
void SetFilmSlope (float Slope)
 
void SetFilmToe (float Toe)
 
void SetFilmWhiteClip (float WhiteClip)
 
void SetFocalDistance (float Distance)
 
void SetFOVAngle (float FOVAngle)
 
void SetImageSize (uint32 Width, uint32 Height)
 
void SetISO (float ISO)
 
void SetLensFlareIntensity (float Intensity)
 
void SetMotionBlurIntensity (float Intensity)
 
void SetMotionBlurMaxDistortion (float MaxDistortion)
 
void SetMotionBlurMinObjectScreenSize (float ScreenSize)
 
void SetShutterSpeed (float Speed)
 
void SetTargetGamma (float InTargetGamma)
 
void SetWhiteTemp (float Temp)
 
void SetWhiteTint (float Tint)
 
void WaitForRenderThreadToFinish ()
 Blocks until the render thread has finished all it's tasks. More...
 
- Public Member Functions inherited from ASensor
 ASensor (const FObjectInitializer &ObjectInitializer)
 
boost::optional< FActorAttributeGetAttribute (const FString Name)
 
const UCarlaEpisodeGetEpisode () const
 
URandomEngineGetRandomEngine ()
 
int32 GetSeed () const
 
auto GetToken () const
 Return the token that allows subscribing to this sensor's stream. More...
 
bool IsStreamReady ()
 
FDataStream MoveDataStream ()
 
virtual void OnFirstClientConnected ()
 
virtual void OnLastClientDisconnected ()
 
void PostPhysTickInternal (UWorld *World, ELevelTick TickType, float DeltaSeconds)
 
void SetDataStream (FDataStream InStream)
 Replace the FDataStream associated with this sensor. More...
 
void SetEpisode (const UCarlaEpisode &InEpisode)
 
void SetSeed (int32 InSeed)
 
void Tick (const float DeltaTime) final
 

Protected Member Functions

void SetUpSceneCaptureComponent (USceneCaptureComponent2D &SceneCapture) override
 
- Protected Member Functions inherited from ASceneCaptureSensor
virtual void BeginPlay () override
 
void CaptureSceneExtended ()
 
virtual void EndPlay (const EEndPlayReason::Type EndPlayReason) override
 
virtual void PostPhysTick (UWorld *World, ELevelTick TickType, float DeltaTime) override
 
virtual void PrePhysTick (float DeltaSeconds) override
 
virtual void SendGBufferTextures (FGBufferRequest &GBuffer)
 
template<typename T >
void SendGBufferTexturesInternal (T &Self, FGBufferRequest &GBufferData)
 
- Protected Member Functions inherited from ASensor
void EndPlay (EEndPlayReason::Type EndPlayReason) override
 
template<typename SensorT >
FAsyncDataStream GetDataStream (const SensorT &Self)
 Return the FDataStream associated with this sensor. More...
 
void PostActorCreated () override
 

Private Attributes

TArray< FShaderFloatParameterValueFloatShaderParams
 
TArray< UMaterial * > MaterialsFound
 
TArray< FSensorShaderShaders
 

Additional Inherited Members

- Public Attributes inherited from ASceneCaptureSensor
struct {
   FCameraGBufferUint8   CustomDepth
 
   FCameraGBufferUint8   CustomStencil
 
   FCameraGBufferUint8   GBufferA
 
   FCameraGBufferUint8   GBufferB
 
   FCameraGBufferUint8   GBufferC
 
   FCameraGBufferUint8   GBufferD
 
   FCameraGBufferUint8   GBufferE
 
   FCameraGBufferUint8   GBufferF
 
   FCameraGBufferUint8   SceneColor
 
   FCameraGBufferUint8   SceneDepth
 
   FCameraGBufferUint8   SceneStencil
 
   FCameraGBufferUint8   SSAO
 
   FCameraGBufferUint8   Velocity
 
CameraGBuffers
 
- Protected Attributes inherited from ASceneCaptureSensor
bool bEnable16BitFormat = false
 Whether to change render target format to PF_A16B16G16R16, offering 16bit / channel. More...
 
bool bEnablePostProcessingEffects = true
 Whether to render the post-processing effects present in the scene. More...
 
USceneCaptureComponent2D_CARLACaptureComponent2D = nullptr
 Scene capture component. More...
 
UTextureRenderTarget2D * CaptureRenderTarget = nullptr
 Render target necessary for scene capture. More...
 
uint32 ImageHeight = 600u
 Image height in pixels. More...
 
uint32 ImageWidth = 800u
 Image width in pixels. More...
 
float TargetGamma = 2.4f
 
- Protected Attributes inherited from ASensor
bool bIsActive = false
 
URandomEngineRandomEngine = nullptr
 Random Engine used to provide noise for sensor output. More...
 
int32 Seed = 123456789
 Seed of the pseudo-random engine. More...
 

Detailed Description

A sensor that produces data by applying post-process materials (shaders) to a scene capture image.

Warning
Shaders must be added before BeginPlay.

Definition at line 48 of file ShaderBasedSensor.h.

Constructor & Destructor Documentation

◆ AShaderBasedSensor()

AShaderBasedSensor::AShaderBasedSensor ( const FObjectInitializer &  ObjectInitializer)
inline

Definition at line 54 of file ShaderBasedSensor.h.

Member Function Documentation

◆ AddPostProcessingMaterial()

bool AShaderBasedSensor::AddPostProcessingMaterial ( const FString &  Path)

Load the UMaterialInstanceDynamic at the given Path and append it to the list of shaders with Weight.

Returns
Whether it succeeded.

Definition at line 15 of file ShaderBasedSensor.cpp.

References MaterialsFound.

Referenced by ADepthCamera::ADepthCamera(), ADVSCamera::ADVSCamera(), AInstanceSegmentationCamera::AInstanceSegmentationCamera(), ANormalsCamera::ANormalsCamera(), AOpticalFlowCamera::AOpticalFlowCamera(), ASceneCaptureCamera::ASceneCaptureCamera(), and ASemanticSegmentationCamera::ASemanticSegmentationCamera().

+ Here is the caller graph for this function:

◆ AddShader()

void AShaderBasedSensor::AddShader ( const FSensorShader Shader)
inline

Add a post-processing shader.

Definition at line 72 of file ShaderBasedSensor.h.

Referenced by SetUpSceneCaptureComponent().

+ Here is the caller graph for this function:

◆ Set()

void AShaderBasedSensor::Set ( const FActorDescription ActorDescription)
overridevirtual

Reimplemented from ASceneCaptureSensor.

Definition at line 48 of file ShaderBasedSensor.cpp.

References UActorBlueprintFunctionLibrary::SetCamera().

+ Here is the call graph for this function:

◆ SetFloatShaderParameter()

void AShaderBasedSensor::SetFloatShaderParameter ( uint8_t  ShaderIndex,
const FName &  ParameterName,
float  Value 
)

Definition at line 54 of file ShaderBasedSensor.cpp.

References FloatShaderParams.

Referenced by UActorBlueprintFunctionLibrary::SetCamera().

+ Here is the caller graph for this function:

◆ SetUpSceneCaptureComponent()

void AShaderBasedSensor::SetUpSceneCaptureComponent ( USceneCaptureComponent2D SceneCapture)
overrideprotectedvirtual

Reimplemented from ASceneCaptureSensor.

Definition at line 25 of file ShaderBasedSensor.cpp.

References AddShader(), FloatShaderParams, MaterialsFound, and Shaders.

+ Here is the call graph for this function:

Member Data Documentation

◆ FloatShaderParams

TArray<FShaderFloatParameterValue> AShaderBasedSensor::FloatShaderParams
private

Definition at line 92 of file ShaderBasedSensor.h.

Referenced by SetFloatShaderParameter(), and SetUpSceneCaptureComponent().

◆ MaterialsFound

TArray<UMaterial*> AShaderBasedSensor::MaterialsFound
private

Definition at line 86 of file ShaderBasedSensor.h.

Referenced by AddPostProcessingMaterial(), and SetUpSceneCaptureComponent().

◆ Shaders

TArray<FSensorShader> AShaderBasedSensor::Shaders
private

Definition at line 89 of file ShaderBasedSensor.h.

Referenced by SetUpSceneCaptureComponent().


The documentation for this class was generated from the following files: