Extended RGB sensor (#1950)

* Exposed DOF and Exposure in Python for  RGB sensor

* Fixed blueprint waypoint functions

* Added Tonemapper settings

* Exposed camera temperature and tint

* Updated Changelog
This commit is contained in:
Marc Garcia Puig 2019-08-03 00:40:05 +09:00 committed by bernat
parent 3161253fa1
commit 865eccb863
9 changed files with 715 additions and 18 deletions

View File

@ -2,6 +2,7 @@
* Better steering in manual control
* Added Doxygen documentation online with automatic updates through Jenkins pipeline
* Fixed client_bounding_boxes.py example script
* Exposed in the API: camera, exposure, depth of field, tone mapper and color attributes for the RGB sensor
## CARLA 0.9.6

2
Jenkinsfile vendored
View File

@ -81,7 +81,7 @@ pipeline {
sh 'make deploy ARGS="--replace-latest --docker-push"'
}
}
stage('Doxygen') {
when { anyOf { branch "master"; buildingTag() } }
steps {

View File

@ -108,7 +108,7 @@ namespace element {
/// Returns a pair containing:
/// - @b first: distance to the nearest point in this line from the
/// begining of the shape.
/// beginning of the shape.
/// - @b second: Euclidean distance from the nearest point in this line to
/// p.
/// @param p point to calculate the distance
@ -137,7 +137,7 @@ namespace element {
/// Returns a pair containing:
/// - @b first: distance to the nearest point in this arc from the
/// begining of the shape.
/// beginning of the shape.
/// - @b second: Euclidean distance from the nearest point in this arc to p.
/// @param p point to calculate the distance
std::pair<float, float> DistanceTo(const geom::Location &p) const override {

View File

@ -229,7 +229,7 @@ static void AddVariationsForSensor(FActorDefinition &Def)
Tick.Id = TEXT("sensor_tick");
Tick.Type = EActorAttributeType::Float;
Tick.RecommendedValues = { TEXT("0.0f") };
Tick.RecommendedValues = { TEXT("0.0") };
Tick.bRestrictToRecommended = false;
Def.Variations.Emplace(Tick);
@ -301,13 +301,15 @@ void UActorBlueprintFunctionLibrary::MakeCameraDefinition(
FillIdAndTags(Definition, TEXT("sensor"), TEXT("camera"), Id);
AddRecommendedValuesForSensorRoleNames(Definition);
AddVariationsForSensor(Definition);
// FOV.
// FOV
FActorVariation FOV;
FOV.Id = TEXT("fov");
FOV.Type = EActorAttributeType::Float;
FOV.RecommendedValues = { TEXT("90.0") };
FOV.bRestrictToRecommended = false;
// Resolution.
// Resolution
FActorVariation ResX;
ResX.Id = TEXT("image_size_x");
ResX.Type = EActorAttributeType::Int;
@ -329,6 +331,7 @@ void UActorBlueprintFunctionLibrary::MakeCameraDefinition(
PostProccess.RecommendedValues = { TEXT("true") };
PostProccess.bRestrictToRecommended = false;
// Gamma
FActorVariation Gamma;
Gamma.Id = TEXT("gamma");
Gamma.Type = EActorAttributeType::Float;
@ -354,8 +357,212 @@ void UActorBlueprintFunctionLibrary::MakeCameraDefinition(
MBMinObjectScreenSize.RecommendedValues = { TEXT("0.1") };
MBMinObjectScreenSize.bRestrictToRecommended = false;
Definition.Variations.Append(
{PostProccess, Gamma, MBIntesity, MBMaxDistortion, MBMinObjectScreenSize});
// More info at:
// https://docs.unrealengine.com/en-US/Engine/Rendering/PostProcessEffects/AutomaticExposure/index.html
// https://docs.unrealengine.com/en-US/Engine/Rendering/PostProcessEffects/DepthOfField/CinematicDOFMethods/index.html
// https://docs.unrealengine.com/en-US/Engine/Rendering/PostProcessEffects/ColorGrading/index.html
// Exposure
FActorVariation ExposureMode;
ExposureMode.Id = TEXT("exposure_mode");
ExposureMode.Type = EActorAttributeType::String;
ExposureMode.RecommendedValues = { TEXT("manual"), TEXT("histogram") };
ExposureMode.bRestrictToRecommended = true;
// Logarithmic adjustment for the exposure. Only used if a tonemapper is
// specified.
// 0 : no adjustment
// -1 : 2x darker
// -2 : 4x darker
// 1 : 2x brighter
// 2 : 4x brighter.
FActorVariation ExposureCompensation;
ExposureCompensation.Id = TEXT("exposure_compensation");
ExposureCompensation.Type = EActorAttributeType::Float;
ExposureCompensation.RecommendedValues = { TEXT("3.0") };
ExposureCompensation.bRestrictToRecommended = false;
// - Manual ------------------------------------------------
// The formula used to compute the camera exposure scale is:
// Exposure = 1 / (1.2 * 2^(log2( N²/t * 100/S )))
// The camera shutter speed in seconds.
FActorVariation ShutterSpeed; // (1/t)
ShutterSpeed.Id = TEXT("shutter_speed");
ShutterSpeed.Type = EActorAttributeType::Float;
ShutterSpeed.RecommendedValues = { TEXT("60.0") };
ShutterSpeed.bRestrictToRecommended = false;
// The camera sensor sensitivity.
FActorVariation ISO; // S
ISO.Id = TEXT("iso");
ISO.Type = EActorAttributeType::Float;
ISO.RecommendedValues = { TEXT("1200.0") };
ISO.bRestrictToRecommended = false;
// Defines the size of the opening for the camera lens.
// Using larger numbers will reduce the DOF effect.
FActorVariation Aperture; // N
Aperture.Id = TEXT("fstop");
Aperture.Type = EActorAttributeType::Float;
Aperture.RecommendedValues = { TEXT("1.4") };
Aperture.bRestrictToRecommended = false;
// - Histogram ---------------------------------------------
// The minimum brightness for auto exposure that limits the lower
// brightness the eye can adapt within
FActorVariation ExposureMinBright;
ExposureMinBright.Id = TEXT("exposure_min_bright");
ExposureMinBright.Type = EActorAttributeType::Float;
ExposureMinBright.RecommendedValues = { TEXT("0.1") };
ExposureMinBright.bRestrictToRecommended = false;
// The maximum brightness for auto exposure that limits the upper
// brightness the eye can adapt within
FActorVariation ExposureMaxBright;
ExposureMaxBright.Id = TEXT("exposure_max_bright");
ExposureMaxBright.Type = EActorAttributeType::Float;
ExposureMaxBright.RecommendedValues = { TEXT("2.0") };
ExposureMaxBright.bRestrictToRecommended = false;
// The speed at which the adaptation occurs from a dark environment
// to a bright environment.
FActorVariation ExposureSpeedUp;
ExposureSpeedUp.Id = TEXT("exposure_speed_up");
ExposureSpeedUp.Type = EActorAttributeType::Float;
ExposureSpeedUp.RecommendedValues = { TEXT("3.0") };
ExposureSpeedUp.bRestrictToRecommended = false;
// The speed at which the adaptation occurs from a bright environment
// to a dark environment.
FActorVariation ExposureSpeedDown;
ExposureSpeedDown.Id = TEXT("exposure_speed_down");
ExposureSpeedDown.Type = EActorAttributeType::Float;
ExposureSpeedDown.RecommendedValues = { TEXT("1.0") };
ExposureSpeedDown.bRestrictToRecommended = false;
// Calibration constant for 18% Albedo.
FActorVariation CalibrationConstant;
CalibrationConstant.Id = TEXT("calibration_constant");
CalibrationConstant.Type = EActorAttributeType::Float;
CalibrationConstant.RecommendedValues = { TEXT("16.0") };
CalibrationConstant.bRestrictToRecommended = false;
// Distance in which the Depth of Field effect should be sharp,
// in unreal units (cm)
FActorVariation FocalDistance;
FocalDistance.Id = TEXT("focal_distance");
FocalDistance.Type = EActorAttributeType::Float;
FocalDistance.RecommendedValues = { TEXT("1000.0") };
FocalDistance.bRestrictToRecommended = false;
// Depth blur km for 50%
FActorVariation DepthBlurAmount;
DepthBlurAmount.Id = TEXT("blur_amount");
DepthBlurAmount.Type = EActorAttributeType::Float;
DepthBlurAmount.RecommendedValues = { TEXT("1.0") };
DepthBlurAmount.bRestrictToRecommended = false;
// Depth blur radius in pixels at 1920x
FActorVariation DepthBlurRadius;
DepthBlurRadius.Id = TEXT("blur_radius");
DepthBlurRadius.Type = EActorAttributeType::Float;
DepthBlurRadius.RecommendedValues = { TEXT("0.0") };
DepthBlurRadius.bRestrictToRecommended = false;
// Defines the opening of the camera lens, Aperture is 1.0/fstop,
// typical lens go down to f/1.2 (large opening),
// larger numbers reduce the DOF effect
FActorVariation MaxAperture;
MaxAperture.Id = TEXT("min_fstop");
MaxAperture.Type = EActorAttributeType::Float;
MaxAperture.RecommendedValues = { TEXT("1.2") };
MaxAperture.bRestrictToRecommended = false;
// Defines the number of blades of the diaphragm within the
// lens (between 4 and 16)
FActorVariation BladeCount;
BladeCount.Id = TEXT("blade_count");
BladeCount.Type = EActorAttributeType::Int;
BladeCount.RecommendedValues = { TEXT("5") };
BladeCount.bRestrictToRecommended = false;
// - Tonemapper Settings -----------------------------------
// You can adjust these tonemapper controls to emulate other
// types of film stock for your project
FActorVariation FilmSlope;
FilmSlope.Id = TEXT("slope");
FilmSlope.Type = EActorAttributeType::Float;
FilmSlope.RecommendedValues = { TEXT("0.88") };
FilmSlope.bRestrictToRecommended = false;
FActorVariation FilmToe;
FilmToe.Id = TEXT("toe");
FilmToe.Type = EActorAttributeType::Float;
FilmToe.RecommendedValues = { TEXT("0.55") };
FilmToe.bRestrictToRecommended = false;
FActorVariation FilmShoulder;
FilmShoulder.Id = TEXT("shoulder");
FilmShoulder.Type = EActorAttributeType::Float;
FilmShoulder.RecommendedValues = { TEXT("0.26") };
FilmShoulder.bRestrictToRecommended = false;
FActorVariation FilmBlackClip;
FilmBlackClip.Id = TEXT("black_clip");
FilmBlackClip.Type = EActorAttributeType::Float;
FilmBlackClip.RecommendedValues = { TEXT("0.0") };
FilmBlackClip.bRestrictToRecommended = false;
FActorVariation FilmWhiteClip;
FilmWhiteClip.Id = TEXT("white_clip");
FilmWhiteClip.Type = EActorAttributeType::Float;
FilmWhiteClip.RecommendedValues = { TEXT("0.04") };
FilmWhiteClip.bRestrictToRecommended = false;
// Color
FActorVariation Temperature;
Temperature.Id = TEXT("temp");
Temperature.Type = EActorAttributeType::Float;
Temperature.RecommendedValues = { TEXT("6500.0") };
Temperature.bRestrictToRecommended = false;
FActorVariation Tint;
Tint.Id = TEXT("tint");
Tint.Type = EActorAttributeType::Float;
Tint.RecommendedValues = { TEXT("0.0") };
Tint.bRestrictToRecommended = false;
Definition.Variations.Append({
ExposureMode,
ExposureCompensation,
ShutterSpeed,
ISO,
Aperture,
PostProccess,
Gamma,
MBIntesity,
MBMaxDistortion,
MBMinObjectScreenSize,
ExposureMinBright,
ExposureMaxBright,
ExposureSpeedUp,
ExposureSpeedDown,
CalibrationConstant,
FocalDistance,
MaxAperture,
BladeCount,
DepthBlurAmount,
DepthBlurRadius,
FilmSlope,
FilmToe,
FilmShoulder,
FilmBlackClip,
FilmWhiteClip,
Temperature,
Tint});
}
Success = CheckActorDefinition(Definition);
@ -410,7 +617,8 @@ void UActorBlueprintFunctionLibrary::MakeLidarDefinition(
LowerFOV.Type = EActorAttributeType::Float;
LowerFOV.RecommendedValues = { TEXT("-30.0") };
Definition.Variations.Append({Channels, Range, PointsPerSecond, Frequency, UpperFOV, LowerFOV});
Definition.Variations.Append(
{Channels, Range, PointsPerSecond, Frequency, UpperFOV, LowerFOV});
Success = CheckActorDefinition(Definition);
}
@ -832,6 +1040,61 @@ void UActorBlueprintFunctionLibrary::SetCamera(
RetrieveActorAttributeToFloat("motion_blur_max_distortion", Description.Variations, 5.0f));
Camera->SetMotionBlurMinObjectScreenSize(
RetrieveActorAttributeToFloat("motion_blur_min_object_screen_size", Description.Variations, 0.5f));
// Exposure
if (RetrieveActorAttributeToString("exposure_mode", Description.Variations, "manual") == "histogram")
{
Camera->SetExposureMethod(EAutoExposureMethod::AEM_Histogram);
}
else
{
Camera->SetExposureMethod(EAutoExposureMethod::AEM_Manual);
}
Camera->SetExposureCompensation(
RetrieveActorAttributeToFloat("exposure_compensation", Description.Variations, 3.0f));
Camera->SetShutterSpeed(
RetrieveActorAttributeToFloat("shutter_speed", Description.Variations, 60.0f));
Camera->SetISO(
RetrieveActorAttributeToFloat("iso", Description.Variations, 1200.0f));
Camera->SetAperture(
RetrieveActorAttributeToFloat("fstop", Description.Variations, 1.4f));
Camera->SetExposureMinBrightness(
RetrieveActorAttributeToFloat("exposure_min_bright", Description.Variations, 0.1f));
Camera->SetExposureMaxBrightness(
RetrieveActorAttributeToFloat("exposure_max_bright", Description.Variations, 2.0f));
Camera->SetExposureSpeedUp(
RetrieveActorAttributeToFloat("exposure_speed_up", Description.Variations, 3.0f));
Camera->SetExposureSpeedDown(
RetrieveActorAttributeToFloat("exposure_speed_down", Description.Variations, 1.0f));
Camera->SetExposureCalibrationConstant(
RetrieveActorAttributeToFloat("calibration_constant", Description.Variations, 16.0f));
Camera->SetFocalDistance(
RetrieveActorAttributeToFloat("focal_distance", Description.Variations, 1000.0f));
Camera->SetDepthBlurAmount(
RetrieveActorAttributeToFloat("blur_amount", Description.Variations, 0.0f));
Camera->SetDepthBlurRadius(
RetrieveActorAttributeToFloat("blur_radius", Description.Variations, 1.0f));
Camera->SetDepthOfFieldMinFstop(
RetrieveActorAttributeToFloat("min_fstop", Description.Variations, 1.2f));
Camera->SetBladeCount(
RetrieveActorAttributeToInt("blade_count", Description.Variations, 5));
Camera->SetFilmSlope(
RetrieveActorAttributeToFloat("slope", Description.Variations, 0.88f));
Camera->SetFilmToe(
RetrieveActorAttributeToFloat("toe", Description.Variations, 0.55f));
Camera->SetFilmShoulder(
RetrieveActorAttributeToFloat("shoulder", Description.Variations, 0.26f));
Camera->SetFilmBlackClip(
RetrieveActorAttributeToFloat("black_clip", Description.Variations, 0.0f));
Camera->SetFilmWhiteClip(
RetrieveActorAttributeToFloat("white_clip", Description.Variations, 0.04f));
Camera->SetWhiteTemp(
RetrieveActorAttributeToFloat("temp", Description.Variations, 6500.0f));
Camera->SetWhiteTint(
RetrieveActorAttributeToFloat("tint", Description.Variations, 0.0f));
}
}

View File

@ -192,7 +192,7 @@ void AOpenDriveActor::BuildRoutes(FString MapName)
CurrentWp = Successors.front();
} while (CurrentWp.road_id == Wp.road_id);
// connect the last wp of the current toad to the first wp of the following road
// connect the last wp of the current road to the first wp of the following road
const auto FollowingWp = map->GetSuccessors(CurrentWp);
if (!FollowingWp.empty())
{

View File

@ -80,7 +80,7 @@ TArray<FWaypoint> UOpenDriveMap::GenerateWaypoints(float ApproxDistance) const
}
check(HasMap());
using namespace UOpenDriveMap_Private;
return TransformToTArray<FWaypoint>(Map->GenerateWaypoints(1e2f * ApproxDistance));
return TransformToTArray<FWaypoint>(Map->GenerateWaypoints(ApproxDistance / 1e2f));
}
TArray<FWaypointConnection> UOpenDriveMap::GenerateTopology() const
@ -136,5 +136,5 @@ TArray<FWaypoint> UOpenDriveMap::GetNext(FWaypoint Waypoint, float Distance) con
}
check(HasMap());
using namespace UOpenDriveMap_Private;
return TransformToTArray<FWaypoint>(Map->GetNext(Waypoint.Waypoint, 1e2f * Distance));
return TransformToTArray<FWaypoint>(Map->GetNext(Waypoint.Waypoint, Distance / 1e2f));
}

View File

@ -89,6 +89,246 @@ float ASceneCaptureSensor::GetFOVAngle() const
return CaptureComponent2D->FOVAngle;
}
void ASceneCaptureSensor::SetExposureMethod(EAutoExposureMethod Method)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.AutoExposureMethod = Method;
}
EAutoExposureMethod ASceneCaptureSensor::GetExposureMethod() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.AutoExposureMethod;
}
void ASceneCaptureSensor::SetExposureCompensation(float Compensation)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.AutoExposureBias = Compensation;
}
float ASceneCaptureSensor::GetExposureCompensation() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.AutoExposureBias;
}
void ASceneCaptureSensor::SetShutterSpeed(float Speed)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.CameraShutterSpeed = Speed;
}
float ASceneCaptureSensor::GetShutterSpeed() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.CameraShutterSpeed;
}
void ASceneCaptureSensor::SetISO(float ISO)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.CameraISO = ISO;
}
float ASceneCaptureSensor::GetISO() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.CameraISO;
}
void ASceneCaptureSensor::SetAperture(float Aperture)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.DepthOfFieldFstop = Aperture;
}
float ASceneCaptureSensor::GetAperture() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.DepthOfFieldFstop;
}
void ASceneCaptureSensor::SetFocalDistance(float Distance)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.DepthOfFieldFocalDistance = Distance;
}
float ASceneCaptureSensor::GetFocalDistance() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.DepthOfFieldFocalDistance;
}
void ASceneCaptureSensor::SetDepthBlurAmount(float Amount)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.DepthOfFieldDepthBlurAmount = Amount;
}
float ASceneCaptureSensor::GetDepthBlurAmount() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.DepthOfFieldDepthBlurAmount;
}
void ASceneCaptureSensor::SetDepthBlurRadius(float Radius)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.DepthOfFieldDepthBlurRadius = Radius;
}
float ASceneCaptureSensor::GetDepthBlurRadius() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.DepthOfFieldDepthBlurRadius;
}
void ASceneCaptureSensor::SetDepthOfFieldMinFstop(float MinFstop)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.DepthOfFieldMinFstop = MinFstop;
}
float ASceneCaptureSensor::GetDepthOfFieldMinFstop() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.DepthOfFieldMinFstop;
}
void ASceneCaptureSensor::SetBladeCount(int Count)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.DepthOfFieldBladeCount = Count;
}
int ASceneCaptureSensor::GetBladeCount() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.DepthOfFieldBladeCount;
}
void ASceneCaptureSensor::SetFilmSlope(float Slope)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.FilmSlope = Slope;
}
float ASceneCaptureSensor::GetFilmSlope() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.FilmSlope;
}
void ASceneCaptureSensor::SetFilmToe(float Toe)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.FilmToe = Toe; // FilmToeAmount?
}
float ASceneCaptureSensor::GetFilmToe() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.FilmToe;
}
void ASceneCaptureSensor::SetFilmShoulder(float Shoulder)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.FilmShoulder = Shoulder;
}
float ASceneCaptureSensor::GetFilmShoulder() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.FilmShoulder;
}
void ASceneCaptureSensor::SetFilmBlackClip(float BlackClip)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.FilmBlackClip = BlackClip;
}
float ASceneCaptureSensor::GetFilmBlackClip() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.FilmBlackClip;
}
void ASceneCaptureSensor::SetFilmWhiteClip(float WhiteClip)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.FilmWhiteClip = WhiteClip;
}
float ASceneCaptureSensor::GetFilmWhiteClip() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.FilmWhiteClip;
}
void ASceneCaptureSensor::SetExposureMinBrightness(float Brightness)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.AutoExposureMinBrightness = Brightness;
}
float ASceneCaptureSensor::GetExposureMinBrightness() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.AutoExposureMinBrightness;
}
void ASceneCaptureSensor::SetExposureMaxBrightness(float Brightness)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.AutoExposureMaxBrightness = Brightness;
}
float ASceneCaptureSensor::GetExposureMaxBrightness() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.AutoExposureMaxBrightness;
}
void ASceneCaptureSensor::SetExposureSpeedDown(float Speed)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.AutoExposureSpeedDown = Speed;
}
float ASceneCaptureSensor::GetExposureSpeedDown() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.AutoExposureSpeedDown;
}
void ASceneCaptureSensor::SetExposureSpeedUp(float Speed)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.AutoExposureSpeedUp = Speed;
}
float ASceneCaptureSensor::GetExposureSpeedUp() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.AutoExposureSpeedUp;
}
void ASceneCaptureSensor::SetExposureCalibrationConstant(float Constant)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.AutoExposureCalibrationConstant = Constant;
}
float ASceneCaptureSensor::GetExposureCalibrationConstant() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.AutoExposureCalibrationConstant;
}
void ASceneCaptureSensor::SetMotionBlurIntensity(float Intensity)
{
check(CaptureComponent2D != nullptr);
@ -125,6 +365,30 @@ float ASceneCaptureSensor::GetMotionBlurMinObjectScreenSize() const
return CaptureComponent2D->PostProcessSettings.MotionBlurPerObjectSize;
}
void ASceneCaptureSensor::SetWhiteTemp(float Temp)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.WhiteTemp = Temp;
}
float ASceneCaptureSensor::GetWhiteTemp() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.WhiteTemp;
}
void ASceneCaptureSensor::SetWhiteTint(float Tint)
{
check(CaptureComponent2D != nullptr);
CaptureComponent2D->PostProcessSettings.WhiteTint = Tint;
}
float ASceneCaptureSensor::GetWhiteTint() const
{
check(CaptureComponent2D != nullptr);
return CaptureComponent2D->PostProcessSettings.WhiteTint;
}
void ASceneCaptureSensor::BeginPlay()
{
using namespace SceneCaptureSensor_local_ns;
@ -178,8 +442,12 @@ void ASceneCaptureSensor::BeginPlay()
void ASceneCaptureSensor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
// Add the view information every tick. Its only used for one tick and then removed by the streamer.
IStreamingManager::Get().AddViewInformation( CaptureComponent2D->GetComponentLocation(), ImageWidth, ImageWidth / FMath::Tan( CaptureComponent2D->FOVAngle ) );
// Add the view information every tick. Its only used for one tick and then
// removed by the streamer.
IStreamingManager::Get().AddViewInformation(
CaptureComponent2D->GetComponentLocation(),
ImageWidth,
ImageWidth / FMath::Tan(CaptureComponent2D->FOVAngle));
}
void ASceneCaptureSensor::EndPlay(const EEndPlayReason::Type EndPlayReason)
@ -198,18 +466,52 @@ namespace SceneCaptureSensor_local_ns {
{
auto &PostProcessSettings = CaptureComponent2D.PostProcessSettings;
// Set motion blur settings (defaults)
// Depth of field
PostProcessSettings.bOverride_DepthOfFieldMethod = true;
PostProcessSettings.DepthOfFieldMethod = EDepthOfFieldMethod::DOFM_CircleDOF;
PostProcessSettings.bOverride_DepthOfFieldFocalDistance = true;
PostProcessSettings.bOverride_DepthOfFieldDepthBlurAmount = true;
PostProcessSettings.bOverride_DepthOfFieldDepthBlurRadius = true;
// Exposure
PostProcessSettings.bOverride_AutoExposureMethod = true;
PostProcessSettings.AutoExposureMethod = EAutoExposureMethod::AEM_Manual;
PostProcessSettings.bOverride_AutoExposureBias = true;
PostProcessSettings.bOverride_AutoExposureMinBrightness = true;
PostProcessSettings.bOverride_AutoExposureMaxBrightness = true;
PostProcessSettings.bOverride_AutoExposureSpeedUp = true;
PostProcessSettings.bOverride_AutoExposureSpeedDown = true;
PostProcessSettings.bOverride_AutoExposureCalibrationConstant = true;
// Camera
PostProcessSettings.bOverride_CameraShutterSpeed = true;
PostProcessSettings.bOverride_CameraISO = true;
PostProcessSettings.bOverride_DepthOfFieldFstop = true;
PostProcessSettings.bOverride_DepthOfFieldMinFstop = true;
PostProcessSettings.bOverride_DepthOfFieldBladeCount = true;
// Film (Tonemapper)
PostProcessSettings.bOverride_FilmSlope = true;
PostProcessSettings.bOverride_FilmToe = true;
PostProcessSettings.bOverride_FilmShoulder = true;
PostProcessSettings.bOverride_FilmWhiteClip = true;
PostProcessSettings.bOverride_FilmBlackClip = true;
// Motion blur
PostProcessSettings.bOverride_MotionBlurAmount = true;
PostProcessSettings.MotionBlurAmount = 0.45f;
PostProcessSettings.bOverride_MotionBlurMax = true;
PostProcessSettings.MotionBlurMax = 0.35f;
PostProcessSettings.bOverride_MotionBlurPerObjectSize = true;
PostProcessSettings.MotionBlurPerObjectSize = 0.1f;
// Color Grading
PostProcessSettings.bOverride_WhiteTemp = true;
PostProcessSettings.bOverride_WhiteTint = true;
}
// Remove the show flags that might interfere with post-processing effects
// like
// depth and semantic segmentation.
// like depth and semantic segmentation.
static void ConfigureShowFlags(FEngineShowFlags &ShowFlags, bool bPostProcessing)
{
if (bPostProcessing)

View File

@ -79,6 +79,126 @@ public:
return TargetGamma;
}
UFUNCTION(BlueprintCallable)
void SetExposureMethod(EAutoExposureMethod Method);
UFUNCTION(BlueprintCallable)
EAutoExposureMethod GetExposureMethod() const;
UFUNCTION(BlueprintCallable)
void SetExposureCompensation(float Compensation);
UFUNCTION(BlueprintCallable)
float GetExposureCompensation() const;
UFUNCTION(BlueprintCallable)
void SetShutterSpeed(float Speed);
UFUNCTION(BlueprintCallable)
float GetShutterSpeed() const;
UFUNCTION(BlueprintCallable)
void SetISO(float ISO);
UFUNCTION(BlueprintCallable)
float GetISO() const;
UFUNCTION(BlueprintCallable)
void SetAperture(float Aperture);
UFUNCTION(BlueprintCallable)
float GetAperture() const;
UFUNCTION(BlueprintCallable)
void SetFocalDistance(float Distance);
UFUNCTION(BlueprintCallable)
float GetFocalDistance() const;
UFUNCTION(BlueprintCallable)
void SetDepthBlurAmount(float Amount);
UFUNCTION(BlueprintCallable)
float GetDepthBlurAmount() const;
UFUNCTION(BlueprintCallable)
void SetDepthBlurRadius(float Radius);
UFUNCTION(BlueprintCallable)
float GetDepthBlurRadius() const;
UFUNCTION(BlueprintCallable)
void SetBladeCount(int Count);
UFUNCTION(BlueprintCallable)
int GetBladeCount() const;
UFUNCTION(BlueprintCallable)
void SetDepthOfFieldMinFstop(float MinFstop);
UFUNCTION(BlueprintCallable)
float GetDepthOfFieldMinFstop() const;
UFUNCTION(BlueprintCallable)
void SetFilmSlope(float Slope);
UFUNCTION(BlueprintCallable)
float GetFilmSlope() const;
UFUNCTION(BlueprintCallable)
void SetFilmToe(float Toe);
UFUNCTION(BlueprintCallable)
float GetFilmToe() const;
UFUNCTION(BlueprintCallable)
void SetFilmShoulder(float Shoulder);
UFUNCTION(BlueprintCallable)
float GetFilmShoulder() const;
UFUNCTION(BlueprintCallable)
void SetFilmBlackClip(float BlackClip);
UFUNCTION(BlueprintCallable)
float GetFilmBlackClip() const;
UFUNCTION(BlueprintCallable)
void SetFilmWhiteClip(float WhiteClip);
UFUNCTION(BlueprintCallable)
float GetFilmWhiteClip() const;
UFUNCTION(BlueprintCallable)
void SetExposureMinBrightness(float Brightness);
UFUNCTION(BlueprintCallable)
float GetExposureMinBrightness() const;
UFUNCTION(BlueprintCallable)
void SetExposureMaxBrightness(float Brightness);
UFUNCTION(BlueprintCallable)
float GetExposureMaxBrightness() const;
UFUNCTION(BlueprintCallable)
void SetExposureSpeedDown(float Speed);
UFUNCTION(BlueprintCallable)
float GetExposureSpeedDown() const;
UFUNCTION(BlueprintCallable)
void SetExposureSpeedUp(float Speed);
UFUNCTION(BlueprintCallable)
float GetExposureSpeedUp() const;
UFUNCTION(BlueprintCallable)
void SetExposureCalibrationConstant(float Constant);
UFUNCTION(BlueprintCallable)
float GetExposureCalibrationConstant() const;
UFUNCTION(BlueprintCallable)
void SetMotionBlurIntensity(float Intensity);
@ -97,6 +217,18 @@ public:
UFUNCTION(BlueprintCallable)
float GetMotionBlurMinObjectScreenSize() const;
UFUNCTION(BlueprintCallable)
void SetWhiteTemp(float Temp);
UFUNCTION(BlueprintCallable)
float GetWhiteTemp() const;
UFUNCTION(BlueprintCallable)
void SetWhiteTint(float Tint);
UFUNCTION(BlueprintCallable)
float GetWhiteTint() const;
/// Use for debugging purposes only.
UFUNCTION(BlueprintCallable)
bool ReadPixels(TArray<FColor> &BitMap) const