2021-04-27 21:11:58 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "Scene/SceneCapturePhotoSet.h"
|
2021-05-18 11:54:40 -04:00
|
|
|
#include "EngineUtils.h"
|
2022-05-16 06:50:35 -04:00
|
|
|
#include "Misc/ScopedSlowTask.h"
|
2021-04-27 21:11:58 -04:00
|
|
|
|
|
|
|
|
using namespace UE::Geometry;
|
|
|
|
|
|
2022-05-16 06:50:35 -04:00
|
|
|
#define LOCTEXT_NAMESPACE "SceneCapture"
|
|
|
|
|
|
2022-07-18 11:21:15 -04:00
|
|
|
FSceneCapturePhotoSet::FSceneCapturePhotoSet()
|
|
|
|
|
{
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
// These defaults are chosen so an unfamiliar user doesn't need to call the configuration functions to get a result
|
|
|
|
|
ForEachCaptureType([this](ERenderCaptureType CaptureType)
|
|
|
|
|
{
|
|
|
|
|
bool bIsDisabled = (
|
|
|
|
|
CaptureType == ERenderCaptureType::DeviceDepth ||
|
|
|
|
|
CaptureType == ERenderCaptureType::Roughness ||
|
|
|
|
|
CaptureType == ERenderCaptureType::Specular ||
|
|
|
|
|
CaptureType == ERenderCaptureType::Metallic);
|
|
|
|
|
PhotoSetStatus[CaptureType] = bIsDisabled ? ECaptureTypeStatus::Disabled : ECaptureTypeStatus::Pending;
|
|
|
|
|
|
|
|
|
|
RenderCaptureConfig[CaptureType] = GetDefaultRenderCaptureConfig(CaptureType);
|
|
|
|
|
});
|
2022-07-18 11:21:15 -04:00
|
|
|
}
|
|
|
|
|
|
2021-04-27 21:11:58 -04:00
|
|
|
void FSceneCapturePhotoSet::SetCaptureSceneActors(UWorld* World, const TArray<AActor*>& Actors)
|
|
|
|
|
{
|
2023-01-12 11:09:29 -05:00
|
|
|
if (this->TargetWorld != World || this->VisibleActors != Actors)
|
|
|
|
|
{
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
ForEachCaptureType([this](ERenderCaptureType CaptureType)
|
|
|
|
|
{
|
|
|
|
|
if (PhotoSetStatus[CaptureType] != ECaptureTypeStatus::Disabled)
|
|
|
|
|
{
|
|
|
|
|
PhotoSetStatus[CaptureType] = ECaptureTypeStatus::Pending;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2023-01-12 11:09:29 -05:00
|
|
|
// Empty the photo sets because they rendered different actors
|
|
|
|
|
EmptyAllPhotoSets();
|
|
|
|
|
|
|
|
|
|
// Empty the spatial photo parameters because these are computed from the bounding box of the actors
|
|
|
|
|
PhotoSetParams.Empty();
|
|
|
|
|
}
|
2021-04-27 21:11:58 -04:00
|
|
|
this->TargetWorld = World;
|
|
|
|
|
this->VisibleActors = Actors;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-12 11:09:29 -05:00
|
|
|
TArray<AActor*> FSceneCapturePhotoSet::GetCaptureSceneActors()
|
|
|
|
|
{
|
|
|
|
|
return VisibleActors;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UWorld* FSceneCapturePhotoSet::GetCaptureTargetWorld()
|
|
|
|
|
{
|
|
|
|
|
return TargetWorld;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FSceneCapturePhotoSet::SetSpatialPhotoParams(const TArray<FSpatialPhotoParams>& SpatialParams)
|
|
|
|
|
{
|
|
|
|
|
// TODO Discard/reset on a per array element level rather than discarding everything when any viewpoint changed
|
|
|
|
|
if (PhotoSetParams != SpatialParams)
|
|
|
|
|
{
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
ForEachCaptureType([this](ERenderCaptureType CaptureType)
|
|
|
|
|
{
|
|
|
|
|
if (PhotoSetStatus[CaptureType] != ECaptureTypeStatus::Disabled)
|
|
|
|
|
{
|
|
|
|
|
PhotoSetStatus[CaptureType] = ECaptureTypeStatus::Pending;
|
|
|
|
|
}
|
|
|
|
|
});
|
2023-01-12 11:09:29 -05:00
|
|
|
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
EmptyAllPhotoSets();
|
2023-01-12 11:09:29 -05:00
|
|
|
PhotoSetParams = SpatialParams;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TArray<FSpatialPhotoParams>& FSceneCapturePhotoSet::GetSpatialPhotoParams() const
|
|
|
|
|
{
|
|
|
|
|
return PhotoSetParams;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-27 21:11:58 -04:00
|
|
|
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
void FSceneCapturePhotoSet::SetCaptureConfig(ERenderCaptureType CaptureType, const FRenderCaptureConfig& NewConfig)
|
2022-07-18 11:21:15 -04:00
|
|
|
{
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
if (RenderCaptureConfig[CaptureType] != NewConfig)
|
2023-01-12 11:09:29 -05:00
|
|
|
{
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
if (PhotoSetStatus[CaptureType] != ECaptureTypeStatus::Disabled)
|
2023-01-12 11:09:29 -05:00
|
|
|
{
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
PhotoSetStatus[CaptureType] = ECaptureTypeStatus::Pending;
|
2023-01-12 11:09:29 -05:00
|
|
|
}
|
|
|
|
|
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
EmptyPhotoSet(CaptureType);
|
|
|
|
|
RenderCaptureConfig[CaptureType] = NewConfig;
|
2022-07-18 11:21:15 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FRenderCaptureConfig FSceneCapturePhotoSet::GetCaptureConfig(ERenderCaptureType CaptureType) const
|
|
|
|
|
{
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
return RenderCaptureConfig[CaptureType];
|
2022-07-18 11:21:15 -04:00
|
|
|
}
|
2021-04-27 21:11:58 -04:00
|
|
|
|
2022-11-14 05:09:53 -05:00
|
|
|
void FSceneCapturePhotoSet::DisableAllCaptureTypes()
|
|
|
|
|
{
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
ForEachCaptureType([this](ERenderCaptureType CaptureType)
|
|
|
|
|
{
|
|
|
|
|
SetCaptureTypeEnabled(CaptureType, false);
|
|
|
|
|
});
|
2022-11-14 05:09:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
void FSceneCapturePhotoSet::SetCaptureTypeEnabled(ERenderCaptureType CaptureType, bool bEnable)
|
2021-04-27 21:11:58 -04:00
|
|
|
{
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
if (bEnable)
|
2023-01-12 11:09:29 -05:00
|
|
|
{
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
if (PhotoSetStatus[CaptureType] == ECaptureTypeStatus::Disabled)
|
2023-01-12 11:09:29 -05:00
|
|
|
{
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
PhotoSetStatus[CaptureType] = ECaptureTypeStatus::Pending;
|
2023-01-12 11:09:29 -05:00
|
|
|
}
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
}
|
|
|
|
|
else
|
2023-01-12 11:09:29 -05:00
|
|
|
{
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
PhotoSetStatus[CaptureType] = ECaptureTypeStatus::Disabled;
|
|
|
|
|
EmptyPhotoSet(CaptureType);
|
2022-11-14 05:09:53 -05:00
|
|
|
}
|
2021-04-27 21:11:58 -04:00
|
|
|
}
|
|
|
|
|
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
FSceneCapturePhotoSet::ECaptureTypeStatus FSceneCapturePhotoSet::GetCaptureTypeStatus(ERenderCaptureType CaptureType) const
|
2022-07-18 11:21:15 -04:00
|
|
|
{
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
return PhotoSetStatus[CaptureType];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FSceneCapturePhotoSet::FStatus FSceneCapturePhotoSet::GetSceneCaptureStatus() const
|
|
|
|
|
{
|
|
|
|
|
return PhotoSetStatus;
|
2022-07-18 11:21:15 -04:00
|
|
|
}
|
|
|
|
|
|
2023-01-12 11:09:29 -05:00
|
|
|
void FSceneCapturePhotoSet::Compute()
|
|
|
|
|
{
|
2023-07-26 11:49:00 -04:00
|
|
|
bWasCancelled = false;
|
|
|
|
|
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
int NumPending = 0;
|
|
|
|
|
ForEachCaptureType([this, &NumPending](ERenderCaptureType CaptureType)
|
|
|
|
|
{
|
|
|
|
|
NumPending += static_cast<int>(PhotoSetStatus[CaptureType] == ECaptureTypeStatus::Pending);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (NumPending == 0)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TRACE_CPUPROFILER_EVENT_SCOPE(CapturePhotoSet);
|
|
|
|
|
FScopedSlowTask Progress(static_cast<float>(NumPending), LOCTEXT("CapturingScene", "Capturing Scene..."));
|
|
|
|
|
Progress.MakeDialog(bAllowCancel);
|
|
|
|
|
|
2023-01-12 11:09:29 -05:00
|
|
|
check(this->TargetWorld != nullptr);
|
|
|
|
|
|
|
|
|
|
// Unregister all components to remove unwanted proxies from the scene. This was previously the only way to "hide" nanite meshes, now optional.
|
|
|
|
|
TSet<AActor*> VisibleActorsSet(VisibleActors);
|
|
|
|
|
TArray<AActor*> ActorsToRegister;
|
|
|
|
|
if (bEnforceVisibilityViaUnregister)
|
|
|
|
|
{
|
|
|
|
|
for (TActorIterator<AActor> Actor(TargetWorld); Actor; ++Actor)
|
|
|
|
|
{
|
|
|
|
|
if (!VisibleActorsSet.Contains(*Actor))
|
|
|
|
|
{
|
|
|
|
|
Actor->UnregisterAllComponents();
|
|
|
|
|
ActorsToRegister.Add(*Actor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ON_SCOPE_EXIT
|
|
|
|
|
{
|
|
|
|
|
// Workaround for Nanite scene proxies visibility
|
|
|
|
|
// Reregister all components we previously unregistered
|
|
|
|
|
for (AActor* Actor : ActorsToRegister)
|
|
|
|
|
{
|
|
|
|
|
Actor->RegisterAllComponents();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FWorldRenderCapture RenderCapture;
|
|
|
|
|
RenderCapture.SetWorld(TargetWorld);
|
|
|
|
|
RenderCapture.SetVisibleActors(VisibleActors);
|
|
|
|
|
if (bWriteDebugImages)
|
|
|
|
|
{
|
|
|
|
|
RenderCapture.SetEnableWriteDebugImage(true, 0, DebugImagesFolderName);
|
|
|
|
|
}
|
|
|
|
|
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
auto CapturePhoto3f = [this, &RenderCapture](ERenderCaptureType CaptureType, const FSpatialPhotoParams& Params)
|
2023-01-12 11:09:29 -05:00
|
|
|
{
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
FSpatialPhoto3f NewPhoto;
|
|
|
|
|
NewPhoto.Frame = Params.Frame;
|
|
|
|
|
NewPhoto.NearPlaneDist = Params.NearPlaneDist;
|
|
|
|
|
NewPhoto.HorzFOVDegrees = Params.HorzFOVDegrees;
|
|
|
|
|
NewPhoto.Dimensions = Params.Dimensions;
|
2023-01-12 11:09:29 -05:00
|
|
|
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
// TODO Do something with the success boolean returned by RenderCapture.CaptureFromPosition
|
|
|
|
|
FImageAdapter Image(&NewPhoto.Image);
|
|
|
|
|
FRenderCaptureConfig Config = GetCaptureConfig(CaptureType);
|
2023-01-12 11:09:29 -05:00
|
|
|
RenderCapture.SetDimensions(Params.Dimensions);
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
RenderCapture.CaptureFromPosition(CaptureType, NewPhoto.Frame, NewPhoto.HorzFOVDegrees, NewPhoto.NearPlaneDist, Image, Config);
|
|
|
|
|
GetPhotoSet3f(CaptureType).Add(MoveTemp(NewPhoto));
|
|
|
|
|
};
|
2023-01-12 11:09:29 -05:00
|
|
|
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
auto CapturePhoto1f = [this, &RenderCapture](ERenderCaptureType CaptureType, const FSpatialPhotoParams& Params)
|
|
|
|
|
{
|
|
|
|
|
FSpatialPhoto1f NewPhoto;
|
|
|
|
|
NewPhoto.Frame = Params.Frame;
|
|
|
|
|
NewPhoto.NearPlaneDist = Params.NearPlaneDist;
|
|
|
|
|
NewPhoto.HorzFOVDegrees = Params.HorzFOVDegrees;
|
|
|
|
|
NewPhoto.Dimensions = Params.Dimensions;
|
|
|
|
|
|
|
|
|
|
// TODO Do something with the success boolean returned by RenderCapture.CaptureFromPosition
|
|
|
|
|
FImageAdapter Image(&NewPhoto.Image);
|
|
|
|
|
FRenderCaptureConfig Config = GetCaptureConfig(CaptureType);
|
|
|
|
|
RenderCapture.SetDimensions(Params.Dimensions);
|
|
|
|
|
RenderCapture.CaptureFromPosition(CaptureType, NewPhoto.Frame, NewPhoto.HorzFOVDegrees, NewPhoto.NearPlaneDist, Image, Config);
|
|
|
|
|
GetPhotoSet1f(CaptureType).Add(MoveTemp(NewPhoto));
|
|
|
|
|
|
|
|
|
|
if (CaptureType == ERenderCaptureType::DeviceDepth)
|
2023-01-12 11:09:29 -05:00
|
|
|
{
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
PhotoViewMatricies.Add(RenderCapture.GetLastCaptureViewMatrices());
|
|
|
|
|
}
|
|
|
|
|
};
|
2023-01-12 11:09:29 -05:00
|
|
|
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
// Iterate by channel computing all the photos rather than by photo/viewpoint computing all the channels.
|
|
|
|
|
// Note: This ordering means that some captures may have computed even if the computation is cancelled.
|
|
|
|
|
auto CapturePhotoSet = [this, &Progress](
|
|
|
|
|
TFunctionRef<void(ERenderCaptureType, const FSpatialPhotoParams&)> CapturePhoto,
|
|
|
|
|
ERenderCaptureType CaptureType,
|
|
|
|
|
const FText& TaskMessage)
|
|
|
|
|
{
|
|
|
|
|
if (PhotoSetStatus[CaptureType] == ECaptureTypeStatus::Pending)
|
|
|
|
|
{
|
|
|
|
|
Progress.EnterProgressFrame(1.f);
|
|
|
|
|
FScopedSlowTask PhotoSetProgress(PhotoSetParams.Num(), TaskMessage);
|
|
|
|
|
|
|
|
|
|
EmptyPhotoSet(CaptureType);
|
|
|
|
|
for (const FSpatialPhotoParams& Params : PhotoSetParams)
|
|
|
|
|
{
|
|
|
|
|
if (Progress.ShouldCancel())
|
|
|
|
|
{
|
|
|
|
|
UE_LOG(LogGeometry, Display, TEXT("FSceneCapturePhotoSet: The pending '%s' step was cancelled"), *TaskMessage.ToString());
|
|
|
|
|
bWasCancelled = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PhotoSetProgress.EnterProgressFrame(1.f);
|
|
|
|
|
CapturePhoto(CaptureType, Params);
|
|
|
|
|
Progress.TickProgress();
|
2023-01-12 11:09:29 -05:00
|
|
|
}
|
|
|
|
|
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
PhotoSetStatus[CaptureType] = ECaptureTypeStatus::Computed;
|
|
|
|
|
}
|
|
|
|
|
};
|
2023-01-12 11:09:29 -05:00
|
|
|
|
2023-07-26 04:48:13 -04:00
|
|
|
CapturePhotoSet(CapturePhoto1f, ERenderCaptureType::DeviceDepth, LOCTEXT("CapturingScene_DeviceDepth", "Capturing Device Depth"));
|
|
|
|
|
CapturePhotoSet(CapturePhoto3f, ERenderCaptureType::BaseColor, LOCTEXT("CapturingScene_BaseColor", "Capturing Base Color"));
|
|
|
|
|
CapturePhotoSet(CapturePhoto3f, ERenderCaptureType::WorldNormal, LOCTEXT("CapturingScene_WorldNormal", "Capturing World Normal"));
|
|
|
|
|
CapturePhotoSet(CapturePhoto3f, ERenderCaptureType::CombinedMRS, LOCTEXT("CapturingScene_CombinedMRS", "Capturing Packed MRS"));
|
|
|
|
|
CapturePhotoSet(CapturePhoto1f, ERenderCaptureType::Metallic, LOCTEXT("CapturingScene_Metallic", "Capturing Metallic"));
|
|
|
|
|
CapturePhotoSet(CapturePhoto1f, ERenderCaptureType::Roughness, LOCTEXT("CapturingScene_Roughness", "Capturing Roughness"));
|
|
|
|
|
CapturePhotoSet(CapturePhoto1f, ERenderCaptureType::Specular, LOCTEXT("CapturingScene_Specular", "Capturing Specular"));
|
|
|
|
|
CapturePhotoSet(CapturePhoto3f, ERenderCaptureType::Emissive, LOCTEXT("CapturingScene_Emissive", "Capturing Emissive"));
|
|
|
|
|
CapturePhotoSet(CapturePhoto1f, ERenderCaptureType::Opacity, LOCTEXT("CapturingScene_Opacity", "Capturing Opacity"));
|
|
|
|
|
CapturePhotoSet(CapturePhoto3f, ERenderCaptureType::SubsurfaceColor, LOCTEXT("CapturingScene_SubsurfaceColor", "Capturing Subsurface Color"));
|
2023-01-12 11:09:29 -05:00
|
|
|
}
|
2021-04-27 21:11:58 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
void FSceneCapturePhotoSet::AddStandardExteriorCapturesFromBoundingBox(
|
|
|
|
|
FImageDimensions PhotoDimensions,
|
|
|
|
|
double HorizontalFOVDegrees,
|
|
|
|
|
double NearPlaneDist,
|
|
|
|
|
bool bFaces,
|
|
|
|
|
bool bUpperCorners,
|
2022-06-08 23:39:09 -04:00
|
|
|
bool bLowerCorners,
|
|
|
|
|
bool bUpperEdges,
|
|
|
|
|
bool bSideEdges)
|
2021-04-27 21:11:58 -04:00
|
|
|
{
|
|
|
|
|
TArray<FVector3d> Directions;
|
|
|
|
|
|
|
|
|
|
if (bFaces)
|
|
|
|
|
{
|
|
|
|
|
Directions.Add(FVector3d::UnitX());
|
|
|
|
|
Directions.Add(-FVector3d::UnitX());
|
|
|
|
|
Directions.Add(FVector3d::UnitY());
|
|
|
|
|
Directions.Add(-FVector3d::UnitY());
|
|
|
|
|
Directions.Add(FVector3d::UnitZ());
|
|
|
|
|
Directions.Add(-FVector3d::UnitZ());
|
|
|
|
|
}
|
|
|
|
|
if (bUpperCorners)
|
|
|
|
|
{
|
|
|
|
|
Directions.Add(Normalized(FVector3d(1, 1, -1)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(-1, 1, -1)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(1, -1, -1)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(-1, -1, -1)));
|
|
|
|
|
}
|
|
|
|
|
if (bLowerCorners)
|
|
|
|
|
{
|
|
|
|
|
Directions.Add(Normalized(FVector3d(1, 1, 1)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(-1, 1, 1)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(1, -1, 1)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(-1, -1, 1)));
|
|
|
|
|
}
|
2022-06-08 23:39:09 -04:00
|
|
|
if (bUpperEdges)
|
|
|
|
|
{
|
|
|
|
|
Directions.Add(Normalized(FVector3d(-1, 0, -1)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(1, 0, -1)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(0, -1, -1)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(0, 1, -1)));
|
|
|
|
|
}
|
|
|
|
|
if (bSideEdges)
|
|
|
|
|
{
|
|
|
|
|
Directions.Add(Normalized(FVector3d(1, 1, 0)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(-1, 1, 0)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(1, -1, 0)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(-1, -1, 0)));
|
|
|
|
|
}
|
2023-01-12 11:09:29 -05:00
|
|
|
PRAGMA_DISABLE_DEPRECATION_WARNINGS
|
2021-04-27 21:11:58 -04:00
|
|
|
AddExteriorCaptures(PhotoDimensions, HorizontalFOVDegrees, NearPlaneDist, Directions);
|
2023-01-12 11:09:29 -05:00
|
|
|
PRAGMA_ENABLE_DEPRECATION_WARNINGS
|
2021-04-27 21:11:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FSceneCapturePhotoSet::AddExteriorCaptures(
|
|
|
|
|
FImageDimensions PhotoDimensions,
|
|
|
|
|
double HorizontalFOVDegrees,
|
|
|
|
|
double NearPlaneDist,
|
|
|
|
|
const TArray<FVector3d>& Directions)
|
|
|
|
|
{
|
|
|
|
|
check(this->TargetWorld != nullptr);
|
2023-01-31 14:12:46 -05:00
|
|
|
|
|
|
|
|
bWasCancelled = false;
|
|
|
|
|
|
2022-05-16 06:50:35 -04:00
|
|
|
FScopedSlowTask Progress(Directions.Num(), LOCTEXT("ComputingViewpoints", "Computing Viewpoints..."));
|
|
|
|
|
Progress.MakeDialog(bAllowCancel);
|
2021-04-27 21:11:58 -04:00
|
|
|
|
2022-06-08 23:39:09 -04:00
|
|
|
// Unregister all components to remove unwanted proxies from the scene. This was previously the only way to "hide" nanite meshes, now optional.
|
2021-05-18 11:54:40 -04:00
|
|
|
TSet<AActor*> VisibleActorsSet(VisibleActors);
|
|
|
|
|
TArray<AActor*> ActorsToRegister;
|
2022-06-08 23:39:09 -04:00
|
|
|
if (bEnforceVisibilityViaUnregister)
|
2021-05-18 11:54:40 -04:00
|
|
|
{
|
2022-06-08 23:39:09 -04:00
|
|
|
for (TActorIterator<AActor> Actor(TargetWorld); Actor; ++Actor)
|
2021-05-18 11:54:40 -04:00
|
|
|
{
|
2022-06-08 23:39:09 -04:00
|
|
|
if (!VisibleActorsSet.Contains(*Actor))
|
|
|
|
|
{
|
|
|
|
|
Actor->UnregisterAllComponents();
|
|
|
|
|
ActorsToRegister.Add(*Actor);
|
|
|
|
|
}
|
2021-05-18 11:54:40 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-16 06:50:35 -04:00
|
|
|
ON_SCOPE_EXIT
|
|
|
|
|
{
|
|
|
|
|
// Workaround for Nanite scene proxies visibility
|
|
|
|
|
// Reregister all components we previously unregistered
|
|
|
|
|
for (AActor* Actor : ActorsToRegister)
|
|
|
|
|
{
|
|
|
|
|
Actor->RegisterAllComponents();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-04-27 21:11:58 -04:00
|
|
|
FWorldRenderCapture RenderCapture;
|
|
|
|
|
RenderCapture.SetWorld(TargetWorld);
|
|
|
|
|
RenderCapture.SetVisibleActors(VisibleActors);
|
|
|
|
|
RenderCapture.SetDimensions(PhotoDimensions);
|
2021-05-28 02:46:59 -04:00
|
|
|
if (bWriteDebugImages)
|
|
|
|
|
{
|
|
|
|
|
RenderCapture.SetEnableWriteDebugImage(true, 0, DebugImagesFolderName);
|
|
|
|
|
}
|
2021-04-27 21:11:58 -04:00
|
|
|
|
|
|
|
|
// this tells us origin and radius - could be view-dependent...
|
|
|
|
|
FSphere RenderSphere = RenderCapture.ComputeContainingRenderSphere(HorizontalFOVDegrees);
|
|
|
|
|
|
|
|
|
|
int32 NumDirections = Directions.Num();
|
|
|
|
|
for (int32 di = 0; di < NumDirections; ++di)
|
|
|
|
|
{
|
2022-05-16 06:50:35 -04:00
|
|
|
Progress.EnterProgressFrame(1.f);
|
|
|
|
|
if (Progress.ShouldCancel())
|
|
|
|
|
{
|
|
|
|
|
bWasCancelled = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-27 21:11:58 -04:00
|
|
|
FVector3d ViewDirection = Directions[di];
|
|
|
|
|
ViewDirection.Normalize();
|
|
|
|
|
|
2022-11-14 05:09:53 -05:00
|
|
|
FSpatialPhotoParams Params;
|
|
|
|
|
Params.NearPlaneDist = NearPlaneDist;
|
|
|
|
|
Params.HorzFOVDegrees = HorizontalFOVDegrees;
|
|
|
|
|
Params.Dimensions = PhotoDimensions;
|
2022-07-18 11:21:15 -04:00
|
|
|
// TODO Align the frame with the renderer coordinate system then remove the axis swapping in WorldRenderCapture.cpp
|
2022-11-14 05:09:53 -05:00
|
|
|
Params.Frame.AlignAxis(0, ViewDirection);
|
|
|
|
|
Params.Frame.ConstrainedAlignAxis(2, FVector3d::UnitZ(), Params.Frame.X());
|
|
|
|
|
Params.Frame.Origin = RenderSphere.Center;
|
|
|
|
|
Params.Frame.Origin -= RenderSphere.W * Params.Frame.X();
|
2021-04-27 21:11:58 -04:00
|
|
|
|
2022-11-14 05:09:53 -05:00
|
|
|
auto CaptureImageTypeFunc_3f = [this, &Progress, &RenderCapture, &Params, &NumDirections]
|
|
|
|
|
(ERenderCaptureType CaptureType, FSpatialPhotoSet3f& PhotoSet)
|
2021-04-27 21:11:58 -04:00
|
|
|
{
|
2022-11-14 05:09:53 -05:00
|
|
|
// Test NumDirections to avoid recomputing photo sets. Search :SceneCaptureWithExistingCaptures
|
|
|
|
|
if (PhotoSet.Num() < NumDirections)
|
|
|
|
|
{
|
|
|
|
|
FSpatialPhoto3f NewPhoto;
|
|
|
|
|
NewPhoto.Frame = Params.Frame;
|
|
|
|
|
NewPhoto.NearPlaneDist = Params.NearPlaneDist;
|
|
|
|
|
NewPhoto.HorzFOVDegrees = Params.HorzFOVDegrees;
|
|
|
|
|
NewPhoto.Dimensions = Params.Dimensions;
|
|
|
|
|
|
|
|
|
|
// TODO Do something with the success boolean returned by RenderCapture.CaptureFromPosition
|
|
|
|
|
FImageAdapter Image(&NewPhoto.Image);
|
|
|
|
|
FRenderCaptureConfig Config = GetCaptureConfig(CaptureType);
|
|
|
|
|
RenderCapture.CaptureFromPosition(CaptureType, NewPhoto.Frame, NewPhoto.HorzFOVDegrees, NewPhoto.NearPlaneDist, Image, Config);
|
|
|
|
|
PhotoSet.Add(MoveTemp(NewPhoto));
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-16 06:50:35 -04:00
|
|
|
Progress.TickProgress();
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
};
|
|
|
|
|
|
2022-11-14 05:09:53 -05:00
|
|
|
auto CaptureImageTypeFunc_1f = [this, &Progress, &RenderCapture, &Params, &NumDirections]
|
|
|
|
|
(ERenderCaptureType CaptureType, FSpatialPhotoSet1f& PhotoSet)
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
{
|
2022-11-14 05:09:53 -05:00
|
|
|
// Test NumDirections to avoid recomputing photo sets. Search :SceneCaptureWithExistingCaptures
|
|
|
|
|
if (PhotoSet.Num() < NumDirections)
|
|
|
|
|
{
|
|
|
|
|
FSpatialPhoto1f NewPhoto;
|
|
|
|
|
NewPhoto.Frame = Params.Frame;
|
|
|
|
|
NewPhoto.NearPlaneDist = Params.NearPlaneDist;
|
|
|
|
|
NewPhoto.HorzFOVDegrees = Params.HorzFOVDegrees;
|
|
|
|
|
NewPhoto.Dimensions = Params.Dimensions;
|
|
|
|
|
|
|
|
|
|
// TODO Do something with the success boolean returned by RenderCapture.CaptureFromPosition
|
|
|
|
|
FImageAdapter Image(&NewPhoto.Image);
|
|
|
|
|
FRenderCaptureConfig Config = GetCaptureConfig(CaptureType);
|
|
|
|
|
RenderCapture.CaptureFromPosition(CaptureType, NewPhoto.Frame, NewPhoto.HorzFOVDegrees, NewPhoto.NearPlaneDist, Image, Config);
|
|
|
|
|
PhotoSet.Add(MoveTemp(NewPhoto));
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-16 06:50:35 -04:00
|
|
|
Progress.TickProgress();
|
2021-04-27 21:11:58 -04:00
|
|
|
};
|
|
|
|
|
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
if (PhotoSetStatus[ERenderCaptureType::DeviceDepth] == ECaptureTypeStatus::Pending)
|
2022-07-18 11:21:15 -04:00
|
|
|
{
|
|
|
|
|
CaptureImageTypeFunc_1f(ERenderCaptureType::DeviceDepth, DeviceDepthPhotoSet);
|
2023-01-12 11:09:29 -05:00
|
|
|
if (PhotoViewMatricies.Num() < NumDirections)
|
|
|
|
|
{
|
|
|
|
|
PhotoViewMatricies.Add(RenderCapture.GetLastCaptureViewMatrices());
|
|
|
|
|
}
|
2022-07-18 11:21:15 -04:00
|
|
|
}
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
if (PhotoSetStatus[ERenderCaptureType::BaseColor] == ECaptureTypeStatus::Pending)
|
2021-04-27 21:11:58 -04:00
|
|
|
{
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
CaptureImageTypeFunc_3f(ERenderCaptureType::BaseColor, BaseColorPhotoSet);
|
2021-04-27 21:11:58 -04:00
|
|
|
}
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
if (PhotoSetStatus[ERenderCaptureType::Roughness] == ECaptureTypeStatus::Pending)
|
2021-04-27 21:11:58 -04:00
|
|
|
{
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
CaptureImageTypeFunc_1f(ERenderCaptureType::Roughness, RoughnessPhotoSet);
|
2021-04-27 21:11:58 -04:00
|
|
|
}
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
if (PhotoSetStatus[ERenderCaptureType::Specular] == ECaptureTypeStatus::Pending)
|
2021-04-27 21:11:58 -04:00
|
|
|
{
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
CaptureImageTypeFunc_1f(ERenderCaptureType::Specular, SpecularPhotoSet);
|
2021-04-27 21:11:58 -04:00
|
|
|
}
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
if (PhotoSetStatus[ERenderCaptureType::Metallic] == ECaptureTypeStatus::Pending)
|
2021-04-27 21:11:58 -04:00
|
|
|
{
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
CaptureImageTypeFunc_1f(ERenderCaptureType::Metallic, MetallicPhotoSet);
|
2021-04-27 21:11:58 -04:00
|
|
|
}
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
if (PhotoSetStatus[ERenderCaptureType::CombinedMRS] == ECaptureTypeStatus::Pending)
|
2021-05-26 03:02:11 -04:00
|
|
|
{
|
|
|
|
|
CaptureImageTypeFunc_3f(ERenderCaptureType::CombinedMRS, PackedMRSPhotoSet);
|
|
|
|
|
}
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
if (PhotoSetStatus[ERenderCaptureType::WorldNormal] == ECaptureTypeStatus::Pending)
|
2021-04-27 21:11:58 -04:00
|
|
|
{
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
CaptureImageTypeFunc_3f(ERenderCaptureType::WorldNormal, WorldNormalPhotoSet);
|
2021-04-27 21:11:58 -04:00
|
|
|
}
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
if (PhotoSetStatus[ERenderCaptureType::Emissive] == ECaptureTypeStatus::Pending)
|
2021-04-27 21:11:58 -04:00
|
|
|
{
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
CaptureImageTypeFunc_3f(ERenderCaptureType::Emissive, EmissivePhotoSet);
|
2021-04-27 21:11:58 -04:00
|
|
|
}
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
if (PhotoSetStatus[ERenderCaptureType::Opacity] == ECaptureTypeStatus::Pending)
|
2023-01-05 05:19:44 -05:00
|
|
|
{
|
|
|
|
|
CaptureImageTypeFunc_1f(ERenderCaptureType::Opacity, OpacityPhotoSet);
|
|
|
|
|
}
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
if (PhotoSetStatus[ERenderCaptureType::SubsurfaceColor] == ECaptureTypeStatus::Pending)
|
2023-01-05 05:19:44 -05:00
|
|
|
{
|
|
|
|
|
CaptureImageTypeFunc_3f(ERenderCaptureType::SubsurfaceColor, SubsurfaceColorPhotoSet);
|
|
|
|
|
}
|
2022-07-18 11:21:15 -04:00
|
|
|
|
2022-11-14 05:09:53 -05:00
|
|
|
// AddExteriorCaptures can be called on an FSceneCapturePhotoSet which already has some capture types computed
|
|
|
|
|
// and in this case we should not modify the existing photo sets/cached photo set parameters.
|
|
|
|
|
// See :SceneCaptureWithExistingCaptures
|
|
|
|
|
if (PhotoSetParams.Num() < NumDirections)
|
|
|
|
|
{
|
|
|
|
|
PhotoSetParams.Add(Params);
|
|
|
|
|
}
|
2023-01-12 11:09:29 -05:00
|
|
|
} // end directions loop
|
2021-04-27 21:11:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FSceneCapturePhotoSet::OptimizePhotoSets()
|
|
|
|
|
{
|
|
|
|
|
// todo:
|
|
|
|
|
// 1) crop photos to regions with actual pixels
|
|
|
|
|
// 2) pack into fewer photos (eg pack spec/rough/metallic)
|
|
|
|
|
// 3) RLE encoding or other compression
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FSceneCapturePhotoSet::FSceneSample::FSceneSample()
|
|
|
|
|
{
|
|
|
|
|
HaveValues = FRenderCaptureTypeFlags::None();
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
BaseColor = FVector3f(0, 0, 0);
|
|
|
|
|
Roughness = 0.0f;
|
|
|
|
|
Specular = 0.0f;
|
|
|
|
|
Metallic = 0.0f;
|
|
|
|
|
Emissive = FVector3f(0, 0, 0);
|
2023-01-05 05:19:44 -05:00
|
|
|
Opacity = 0.0f;
|
|
|
|
|
SubsurfaceColor = FVector3f(0, 0, 0);
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
WorldNormal = FVector3f(0, 0, 1);
|
2022-07-18 11:21:15 -04:00
|
|
|
DeviceDepth = 0.0f;
|
2021-04-27 21:11:58 -04:00
|
|
|
}
|
|
|
|
|
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
FVector3f FSceneCapturePhotoSet::FSceneSample::GetValue3f(ERenderCaptureType CaptureType) const
|
2021-04-27 21:11:58 -04:00
|
|
|
{
|
|
|
|
|
switch (CaptureType)
|
|
|
|
|
{
|
|
|
|
|
case ERenderCaptureType::BaseColor:
|
|
|
|
|
return BaseColor;
|
|
|
|
|
case ERenderCaptureType::WorldNormal:
|
|
|
|
|
return WorldNormal;
|
|
|
|
|
case ERenderCaptureType::Roughness:
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
return Roughness * FVector3f::One();
|
2021-04-27 21:11:58 -04:00
|
|
|
case ERenderCaptureType::Metallic:
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
return Metallic * FVector3f::One();
|
2021-04-27 21:11:58 -04:00
|
|
|
case ERenderCaptureType::Specular:
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
return Specular * FVector3f::One();
|
2021-04-27 21:11:58 -04:00
|
|
|
case ERenderCaptureType::Emissive:
|
|
|
|
|
return Emissive;
|
2023-01-05 05:19:44 -05:00
|
|
|
case ERenderCaptureType::Opacity:
|
|
|
|
|
return Opacity * FVector3f::One();
|
|
|
|
|
case ERenderCaptureType::SubsurfaceColor:
|
|
|
|
|
return SubsurfaceColor;
|
2022-07-18 11:21:15 -04:00
|
|
|
case ERenderCaptureType::DeviceDepth:
|
|
|
|
|
return DeviceDepth * FVector3f::One();
|
2021-04-27 21:11:58 -04:00
|
|
|
default:
|
2022-11-14 05:09:53 -05:00
|
|
|
ensure(false);
|
2021-04-27 21:11:58 -04:00
|
|
|
}
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
return FVector3f::Zero();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FVector4f FSceneCapturePhotoSet::FSceneSample::GetValue4f(ERenderCaptureType CaptureType) const
|
|
|
|
|
{
|
|
|
|
|
switch (CaptureType)
|
|
|
|
|
{
|
|
|
|
|
case ERenderCaptureType::BaseColor:
|
|
|
|
|
return FVector4f(BaseColor.X, BaseColor.Y, BaseColor.Z, 1.0f);
|
|
|
|
|
case ERenderCaptureType::WorldNormal:
|
|
|
|
|
return FVector4f(WorldNormal.X, WorldNormal.Y, WorldNormal.Z, 1.0f);
|
|
|
|
|
case ERenderCaptureType::Roughness:
|
|
|
|
|
return FVector4f(Roughness, Roughness, Roughness, 1.0f);
|
|
|
|
|
case ERenderCaptureType::Metallic:
|
|
|
|
|
return FVector4f(Metallic, Metallic, Metallic, 1.0f);
|
|
|
|
|
case ERenderCaptureType::Specular:
|
|
|
|
|
return FVector4f(Specular, Specular, Specular, 1.0f);
|
2021-05-26 03:02:11 -04:00
|
|
|
case ERenderCaptureType::CombinedMRS:
|
|
|
|
|
return FVector4f(Metallic, Roughness, Specular, 1.0f);
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
case ERenderCaptureType::Emissive:
|
|
|
|
|
return FVector4f(Emissive.X, Emissive.Y, Emissive.Z, 1.0f);
|
2023-01-05 05:19:44 -05:00
|
|
|
case ERenderCaptureType::Opacity:
|
|
|
|
|
return FVector4f(Opacity, Opacity, Opacity, 1.0f);
|
|
|
|
|
case ERenderCaptureType::SubsurfaceColor:
|
|
|
|
|
return FVector4f(SubsurfaceColor.X, SubsurfaceColor.Y, SubsurfaceColor.Z, 1.0f);
|
2022-07-18 11:21:15 -04:00
|
|
|
case ERenderCaptureType::DeviceDepth:
|
|
|
|
|
return FVector4f(DeviceDepth, DeviceDepth, DeviceDepth, 1.0f);
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
default:
|
2022-11-14 05:09:53 -05:00
|
|
|
ensure(false);
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
}
|
2021-04-27 21:11:58 -04:00
|
|
|
return FVector4f::Zero();
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-16 05:13:25 -04:00
|
|
|
bool FSceneCapturePhotoSet::ComputeSampleLocation(
|
|
|
|
|
const FVector3d& Position,
|
|
|
|
|
const FVector3d& Normal,
|
2022-07-18 11:21:15 -04:00
|
|
|
const float ValidSampleDepthThreshold,
|
2022-05-16 05:13:25 -04:00
|
|
|
TFunctionRef<bool(const FVector3d&, const FVector3d&)> VisibilityFunction,
|
|
|
|
|
int& PhotoIndex,
|
|
|
|
|
FVector2d& PhotoCoords) const
|
|
|
|
|
{
|
2022-06-13 10:27:34 -04:00
|
|
|
double DotTolerance = -0.1; // dot should be negative for normal pointing towards photo
|
|
|
|
|
|
2023-01-12 11:09:29 -05:00
|
|
|
if (ValidSampleDepthThreshold > 0)
|
|
|
|
|
{
|
|
|
|
|
check(DeviceDepthPhotoSet.Num() == PhotoSetParams.Num());
|
|
|
|
|
check(PhotoViewMatricies.Num() == PhotoSetParams.Num());
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-13 10:27:34 -04:00
|
|
|
PhotoIndex = IndexConstants::InvalidID;
|
|
|
|
|
PhotoCoords = FVector2d(0., 0.);
|
|
|
|
|
|
|
|
|
|
double MinDot = 1.0;
|
|
|
|
|
|
|
|
|
|
int32 NumPhotos = PhotoSetParams.Num();
|
2022-06-13 11:19:07 -04:00
|
|
|
for (int32 Index = 0; Index < NumPhotos; ++Index)
|
2022-06-13 10:27:34 -04:00
|
|
|
{
|
2022-06-13 11:19:07 -04:00
|
|
|
const FSpatialPhotoParams& Params = PhotoSetParams[Index];
|
2022-06-13 10:27:34 -04:00
|
|
|
check(Params.Dimensions.IsSquare());
|
|
|
|
|
|
2022-07-18 11:21:15 -04:00
|
|
|
FFrame3d RenderFrame(Params.Frame.Origin, Params.Frame.Y(), Params.Frame.Z(), Params.Frame.X());
|
|
|
|
|
|
|
|
|
|
FVector3d ViewDirection = RenderFrame.Z();
|
2022-06-13 10:27:34 -04:00
|
|
|
double ViewDot = ViewDirection.Dot(Normal);
|
|
|
|
|
if (ViewDot > DotTolerance || ViewDot > MinDot)
|
|
|
|
|
{
|
2022-07-18 11:21:15 -04:00
|
|
|
// The sample is facing away from the photo, or we found a photo more aligned with this sample
|
2022-06-13 10:27:34 -04:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-18 11:21:15 -04:00
|
|
|
FFrame3d ViewPlane = RenderFrame;
|
2022-06-13 10:27:34 -04:00
|
|
|
ViewPlane.Origin += Params.NearPlaneDist * ViewDirection;
|
|
|
|
|
|
|
|
|
|
double ViewPlaneWidthWorld = Params.NearPlaneDist * FMathd::Tan(Params.HorzFOVDegrees * 0.5 * FMathd::DegToRad);
|
|
|
|
|
double ViewPlaneHeightWorld = ViewPlaneWidthWorld;
|
|
|
|
|
|
2022-07-18 11:21:15 -04:00
|
|
|
// Shoot a ray from the camera position toward the sample position and find the hit point on photo plane
|
|
|
|
|
constexpr int NormalAxisIndex = 2;
|
|
|
|
|
FVector3d RayOrigin = RenderFrame.Origin;
|
2022-06-13 10:27:34 -04:00
|
|
|
FVector3d RayDir = Normalized(Position - RayOrigin);
|
|
|
|
|
FVector3d HitPoint;
|
2022-07-18 11:21:15 -04:00
|
|
|
bool bHit = ViewPlane.RayPlaneIntersection(RayOrigin, RayDir, NormalAxisIndex, HitPoint);
|
2022-06-13 10:27:34 -04:00
|
|
|
if (bHit)
|
|
|
|
|
{
|
2022-07-18 11:21:15 -04:00
|
|
|
FVector2d DeviceXY;
|
|
|
|
|
DeviceXY.X = (HitPoint - ViewPlane.Origin).Dot(ViewPlane.X()) / ViewPlaneWidthWorld;
|
|
|
|
|
DeviceXY.Y = (HitPoint - ViewPlane.Origin).Dot(ViewPlane.Y()) / ViewPlaneHeightWorld;
|
|
|
|
|
if (FMathd::Abs(DeviceXY.X) < 1 && FMathd::Abs(DeviceXY.Y) < 1)
|
2022-06-13 10:27:34 -04:00
|
|
|
{
|
2022-07-18 11:21:15 -04:00
|
|
|
// Shoot a ray from the sample position toward the camera position checking occlusion
|
|
|
|
|
bool bVisible = VisibilityFunction(Position, RayOrigin);
|
|
|
|
|
if (bVisible)
|
2022-06-13 10:27:34 -04:00
|
|
|
{
|
2022-07-18 11:21:15 -04:00
|
|
|
FVector2d UVCoords = FRenderCaptureCoordinateConverter2D::DeviceToUV(DeviceXY);
|
|
|
|
|
if (ValidSampleDepthThreshold > 0)
|
|
|
|
|
{
|
|
|
|
|
// Look up the device depth from the depth photo set, these values are from 0 (far plane) to
|
|
|
|
|
// 1 (near plane). We skip points which would unproject to the far plane, which is positioned at
|
|
|
|
|
// infinity, we also do not interpolate the depth values, doing so is not a good approximation
|
|
|
|
|
// of the underlying scene
|
|
|
|
|
float DeviceZ = DeviceDepthPhotoSet.Get(Index).Image.NearestSampleUV(UVCoords);
|
|
|
|
|
if (DeviceZ > 0)
|
|
|
|
|
{
|
|
|
|
|
// Compute the pixel position in world space to use it to compute a depth according to the render
|
|
|
|
|
FVector3d PixelPositionDevice{DeviceXY, DeviceZ};
|
2023-01-12 11:09:29 -05:00
|
|
|
FVector4d PixelPositionWorld = PhotoViewMatricies[Index].GetInvViewProjectionMatrix().TransformPosition(PixelPositionDevice);
|
2022-07-18 11:21:15 -04:00
|
|
|
PixelPositionWorld /= PixelPositionWorld.W;
|
|
|
|
|
|
|
|
|
|
// Compare the depth of the sample with the depth of the pixel and consider the sample invalid
|
|
|
|
|
// if these do not match closely enough. This fixes artefacts which occur when sample ray just
|
|
|
|
|
// misses an obstruction and hits a pixel where the color was set by a slightly different ray,
|
|
|
|
|
// through the pixel center, which does hit the obstruction. This problem occurs because the
|
|
|
|
|
// depth capture was obtained by renderering the the source meshes but the visiblity function
|
|
|
|
|
// works on the target mesh
|
|
|
|
|
float PixelDepth = (RayOrigin - FVector3d(PixelPositionWorld)).Length();
|
|
|
|
|
float SampleDepth = (RayOrigin - Position).Length();
|
|
|
|
|
if (FMath::Abs(PixelDepth - SampleDepth) < ValidSampleDepthThreshold)
|
|
|
|
|
{
|
|
|
|
|
PhotoCoords.X = UVCoords.X * (double)Params.Dimensions.GetWidth();
|
|
|
|
|
PhotoCoords.Y = UVCoords.Y * (double)Params.Dimensions.GetHeight();
|
|
|
|
|
PhotoIndex = Index;
|
|
|
|
|
MinDot = ViewDot;
|
|
|
|
|
}
|
|
|
|
|
} // Test DeviceZ > 0
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PhotoCoords.X = UVCoords.X * (double)Params.Dimensions.GetWidth();
|
|
|
|
|
PhotoCoords.Y = UVCoords.Y * (double)Params.Dimensions.GetHeight();
|
|
|
|
|
PhotoIndex = Index;
|
|
|
|
|
MinDot = ViewDot;
|
|
|
|
|
}
|
|
|
|
|
} // Test bVisible
|
|
|
|
|
} // Test UVCoords in (-1,1)x(-1,1)
|
|
|
|
|
} // Hit photo plane
|
|
|
|
|
} // Photo loop
|
2022-06-13 10:27:34 -04:00
|
|
|
|
|
|
|
|
return PhotoIndex != IndexConstants::InvalidID;
|
2022-05-16 05:13:25 -04:00
|
|
|
}
|
GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.
ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.
MergeActors:
- Expose above improvements to IApproximateActors
#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2
[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
|
|
|
|
2021-04-27 21:11:58 -04:00
|
|
|
bool FSceneCapturePhotoSet::ComputeSample(
|
|
|
|
|
const FRenderCaptureTypeFlags& SampleChannels,
|
|
|
|
|
const FVector3d& Position,
|
|
|
|
|
const FVector3d& Normal,
|
|
|
|
|
TFunctionRef<bool(const FVector3d&, const FVector3d&)> VisibilityFunction,
|
|
|
|
|
FSceneSample& DefaultsInResultsOut) const
|
|
|
|
|
{
|
|
|
|
|
// This could be much more efficient if (eg) we knew that all the photo sets have
|
|
|
|
|
// the same captures, then the query only has to be done once and can be used to sample each specific photo
|
2022-05-16 05:13:25 -04:00
|
|
|
// This is implemented in the other ComputeSample overload
|
2021-04-27 21:11:58 -04:00
|
|
|
|
|
|
|
|
if (SampleChannels.bBaseColor)
|
|
|
|
|
{
|
|
|
|
|
DefaultsInResultsOut.BaseColor =
|
|
|
|
|
BaseColorPhotoSet.ComputeSample(Position, Normal, VisibilityFunction, DefaultsInResultsOut.BaseColor);
|
|
|
|
|
DefaultsInResultsOut.HaveValues.bBaseColor = true;
|
|
|
|
|
}
|
|
|
|
|
if (SampleChannels.bRoughness)
|
|
|
|
|
{
|
|
|
|
|
DefaultsInResultsOut.Roughness =
|
|
|
|
|
RoughnessPhotoSet.ComputeSample(Position, Normal, VisibilityFunction, DefaultsInResultsOut.Roughness);
|
|
|
|
|
DefaultsInResultsOut.HaveValues.bRoughness = true;
|
|
|
|
|
}
|
|
|
|
|
if (SampleChannels.bSpecular)
|
|
|
|
|
{
|
|
|
|
|
DefaultsInResultsOut.Specular =
|
|
|
|
|
SpecularPhotoSet.ComputeSample(Position, Normal, VisibilityFunction, DefaultsInResultsOut.Specular);
|
|
|
|
|
DefaultsInResultsOut.HaveValues.bSpecular = true;
|
|
|
|
|
}
|
|
|
|
|
if (SampleChannels.bMetallic)
|
|
|
|
|
{
|
|
|
|
|
DefaultsInResultsOut.Metallic =
|
|
|
|
|
MetallicPhotoSet.ComputeSample(Position, Normal, VisibilityFunction, DefaultsInResultsOut.Metallic);
|
|
|
|
|
DefaultsInResultsOut.HaveValues.bMetallic = true;
|
|
|
|
|
}
|
2021-05-26 03:02:11 -04:00
|
|
|
if (SampleChannels.bCombinedMRS)
|
|
|
|
|
{
|
|
|
|
|
FVector3f MRSValue(DefaultsInResultsOut.Metallic, DefaultsInResultsOut.Roughness, DefaultsInResultsOut.Specular);
|
|
|
|
|
MRSValue = PackedMRSPhotoSet.ComputeSample(Position, Normal, VisibilityFunction, MRSValue);
|
|
|
|
|
DefaultsInResultsOut.Metallic = MRSValue.X;
|
|
|
|
|
DefaultsInResultsOut.Roughness = MRSValue.Y;
|
|
|
|
|
DefaultsInResultsOut.Specular = MRSValue.Z;
|
|
|
|
|
DefaultsInResultsOut.HaveValues.bMetallic = true;
|
|
|
|
|
DefaultsInResultsOut.HaveValues.bRoughness = true;
|
|
|
|
|
DefaultsInResultsOut.HaveValues.bSpecular = true;
|
|
|
|
|
}
|
2021-04-27 21:11:58 -04:00
|
|
|
if (SampleChannels.bEmissive)
|
|
|
|
|
{
|
|
|
|
|
DefaultsInResultsOut.Emissive =
|
|
|
|
|
EmissivePhotoSet.ComputeSample(Position, Normal, VisibilityFunction, DefaultsInResultsOut.Emissive);
|
|
|
|
|
DefaultsInResultsOut.HaveValues.bEmissive = true;
|
|
|
|
|
}
|
2023-01-05 05:19:44 -05:00
|
|
|
if (SampleChannels.bOpacity)
|
|
|
|
|
{
|
|
|
|
|
DefaultsInResultsOut.Opacity =
|
|
|
|
|
OpacityPhotoSet.ComputeSample(Position, Normal, VisibilityFunction, DefaultsInResultsOut.Opacity);
|
|
|
|
|
DefaultsInResultsOut.HaveValues.bOpacity = true;
|
|
|
|
|
}
|
|
|
|
|
if (SampleChannels.bSubsurfaceColor)
|
|
|
|
|
{
|
|
|
|
|
DefaultsInResultsOut.SubsurfaceColor =
|
|
|
|
|
SubsurfaceColorPhotoSet.ComputeSample(Position, Normal, VisibilityFunction, DefaultsInResultsOut.SubsurfaceColor);
|
|
|
|
|
DefaultsInResultsOut.HaveValues.bSubsurfaceColor = true;
|
|
|
|
|
}
|
2021-04-27 21:11:58 -04:00
|
|
|
if (SampleChannels.bWorldNormal)
|
|
|
|
|
{
|
|
|
|
|
DefaultsInResultsOut.WorldNormal =
|
|
|
|
|
WorldNormalPhotoSet.ComputeSample(Position, Normal, VisibilityFunction, DefaultsInResultsOut.WorldNormal);
|
|
|
|
|
DefaultsInResultsOut.HaveValues.bWorldNormal = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
2021-05-28 02:46:59 -04:00
|
|
|
}
|
|
|
|
|
|
2022-06-08 23:39:09 -04:00
|
|
|
|
|
|
|
|
void FSceneCapturePhotoSet::SetEnableVisibilityByUnregisterMode(bool bEnable)
|
|
|
|
|
{
|
|
|
|
|
bEnforceVisibilityViaUnregister = bEnable;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-12 11:09:29 -05:00
|
|
|
void FSceneCapturePhotoSet::EmptyAllPhotoSets()
|
|
|
|
|
{
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
ForEachCaptureType([this](ERenderCaptureType CaptureType)
|
|
|
|
|
{
|
|
|
|
|
EmptyPhotoSet(CaptureType);
|
|
|
|
|
});
|
2023-01-12 11:09:29 -05:00
|
|
|
}
|
|
|
|
|
|
2021-05-28 02:46:59 -04:00
|
|
|
void FSceneCapturePhotoSet::SetEnableWriteDebugImages(bool bEnable, FString FolderName)
|
|
|
|
|
{
|
|
|
|
|
bWriteDebugImages = bEnable;
|
|
|
|
|
if (FolderName.Len() > 0)
|
|
|
|
|
{
|
|
|
|
|
DebugImagesFolderName = FolderName;
|
|
|
|
|
}
|
2022-05-16 06:50:35 -04:00
|
|
|
}
|
|
|
|
|
|
Fix crashes in BakeRC tool, improved the scene capture progress bar, improved and simplified the scene capture cancellation behavior
* Fixed a crash that occurred in the baking step when cancelling a scene capture which was triggered by changing an option which invalidated all photo sets (i.e., render capture resolution or capture anti aliasing). This was occurring because the baking step proceeded after the scene capture cancellation and the needed photosets were empty.
* Fixed a crash which can happen if you have no channel enabled, change cleanup tolerance from 0 to 1 and then enable the BaseColor channel. This was fixed by changing the behavior of the Cleanup Threshold property, if its positive the DeviceDepth capture is enabled and its disabled otherwise, previously we also required that another channel was enabled which led to the crash in the baking step. The new semantics are easier to understand in the code and and is probably an improvement to the UX as well since the Cleanup Threshold property behavior does not depend on other properties.
* Improved the scene capture cancellation: Users can now cancel the scene capture when the tool is starting up which is better UX since if they picked slow settings they don't intend to reuse, the capture can be cancelled, also, the code is simpler. Changed the behavior of the BakeRC tool properties so that after cancellation the completed captures with the desired settings are enabled. The old behavior where cancellation was documented to restore old results was broken and cannot be made to work unless we store the old results in a separate scene capture but for high capture resolutions that would require a lot of memory. When the SceneCapture is cancelled the channels which were pending and didn't complete are logged in the Output Log in case the user forgets which ones were enabled.
* Simplified the code in various places: Added `operator[](ERenderCaptureType)` to structs with per-capture data, and use it to simplify many places where we previously checked channels individually. Added conversion functions from tool properties/geometry script parameters to the render capture parameters. Removed old confusing logic that determined if a capture had been updated by tracking the number of photos in each photoset with a new system based on a new per-capture pending state. Deprecated a bunch of functions which are no longer useful or which used the wrong types (e.g., `FRenderCaptureUpdate` was added because I hadn't noticed `FRenderCaptureTypeFlags`). Changed the defaults in `FSceneCapturePhotoSet` so that the DeviceDepth capture is off, its an advanced feature and the defaults are intended to make the class friendly to new developers
#rb lonnie.li
[CL 26568190 by matija kecman in 5.3 branch]
2023-07-25 05:08:58 -04:00
|
|
|
FSpatialPhotoSet1f& FSceneCapturePhotoSet::GetPhotoSet1f(ERenderCaptureType CaptureType)
|
|
|
|
|
{
|
|
|
|
|
switch (CaptureType)
|
|
|
|
|
{
|
|
|
|
|
case ERenderCaptureType::Roughness:
|
|
|
|
|
return RoughnessPhotoSet;
|
|
|
|
|
case ERenderCaptureType::Metallic:
|
|
|
|
|
return MetallicPhotoSet;
|
|
|
|
|
case ERenderCaptureType::Specular:
|
|
|
|
|
return SpecularPhotoSet;
|
|
|
|
|
case ERenderCaptureType::Opacity:
|
|
|
|
|
return OpacityPhotoSet;
|
|
|
|
|
case ERenderCaptureType::DeviceDepth:
|
|
|
|
|
return DeviceDepthPhotoSet;
|
|
|
|
|
default:
|
|
|
|
|
ensure(false);
|
|
|
|
|
}
|
|
|
|
|
return RoughnessPhotoSet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FSpatialPhotoSet3f& FSceneCapturePhotoSet::GetPhotoSet3f(ERenderCaptureType CaptureType)
|
|
|
|
|
{
|
|
|
|
|
switch (CaptureType)
|
|
|
|
|
{
|
|
|
|
|
case ERenderCaptureType::BaseColor:
|
|
|
|
|
return BaseColorPhotoSet;
|
|
|
|
|
case ERenderCaptureType::CombinedMRS:
|
|
|
|
|
return PackedMRSPhotoSet;
|
|
|
|
|
case ERenderCaptureType::WorldNormal:
|
|
|
|
|
return WorldNormalPhotoSet;
|
|
|
|
|
case ERenderCaptureType::Emissive:
|
|
|
|
|
return EmissivePhotoSet;
|
|
|
|
|
case ERenderCaptureType::SubsurfaceColor:
|
|
|
|
|
return SubsurfaceColorPhotoSet;
|
|
|
|
|
default:
|
|
|
|
|
ensure(false);
|
|
|
|
|
}
|
|
|
|
|
return BaseColorPhotoSet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FSceneCapturePhotoSet::EmptyPhotoSet(ERenderCaptureType CaptureType)
|
|
|
|
|
{
|
|
|
|
|
// Set the functions to empty the photo sets
|
|
|
|
|
switch (CaptureType)
|
|
|
|
|
{
|
|
|
|
|
case ERenderCaptureType::BaseColor:
|
|
|
|
|
BaseColorPhotoSet.Empty();
|
|
|
|
|
break;
|
|
|
|
|
case ERenderCaptureType::WorldNormal:
|
|
|
|
|
WorldNormalPhotoSet.Empty();
|
|
|
|
|
break;
|
|
|
|
|
case ERenderCaptureType::Roughness:
|
|
|
|
|
RoughnessPhotoSet.Empty();
|
|
|
|
|
break;
|
|
|
|
|
case ERenderCaptureType::Metallic:
|
|
|
|
|
MetallicPhotoSet.Empty();
|
|
|
|
|
break;
|
|
|
|
|
case ERenderCaptureType::Specular:
|
|
|
|
|
SpecularPhotoSet.Empty();
|
|
|
|
|
break;
|
|
|
|
|
case ERenderCaptureType::Emissive:
|
|
|
|
|
EmissivePhotoSet.Empty();
|
|
|
|
|
break;
|
|
|
|
|
case ERenderCaptureType::CombinedMRS:
|
|
|
|
|
PackedMRSPhotoSet.Empty();
|
|
|
|
|
break;
|
|
|
|
|
case ERenderCaptureType::Opacity:
|
|
|
|
|
OpacityPhotoSet.Empty();
|
|
|
|
|
break;
|
|
|
|
|
case ERenderCaptureType::SubsurfaceColor:
|
|
|
|
|
SubsurfaceColorPhotoSet.Empty();
|
|
|
|
|
break;
|
|
|
|
|
case ERenderCaptureType::DeviceDepth:
|
|
|
|
|
// For the device depth photo set we have two containers to empty
|
|
|
|
|
DeviceDepthPhotoSet.Empty();
|
|
|
|
|
PhotoViewMatricies.Empty();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ensure(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-12 11:09:29 -05:00
|
|
|
TArray<FSpatialPhotoParams> UE::Geometry::ComputeStandardExteriorSpatialPhotoParameters(
|
|
|
|
|
UWorld* World,
|
|
|
|
|
const TArray<AActor*>& Actors,
|
|
|
|
|
FImageDimensions PhotoDimensions,
|
|
|
|
|
double HorizontalFOVDegrees,
|
|
|
|
|
double NearPlaneDist,
|
|
|
|
|
bool bFaces,
|
|
|
|
|
bool bUpperCorners,
|
|
|
|
|
bool bLowerCorners,
|
|
|
|
|
bool bUpperEdges,
|
|
|
|
|
bool bSideEdges)
|
|
|
|
|
{
|
|
|
|
|
if (!World || Actors.IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TArray<FVector3d> Directions;
|
|
|
|
|
if (bFaces)
|
|
|
|
|
{
|
|
|
|
|
Directions.Add(FVector3d::UnitX());
|
|
|
|
|
Directions.Add(-FVector3d::UnitX());
|
|
|
|
|
Directions.Add(FVector3d::UnitY());
|
|
|
|
|
Directions.Add(-FVector3d::UnitY());
|
|
|
|
|
Directions.Add(FVector3d::UnitZ());
|
|
|
|
|
Directions.Add(-FVector3d::UnitZ());
|
|
|
|
|
}
|
|
|
|
|
if (bUpperCorners)
|
|
|
|
|
{
|
|
|
|
|
Directions.Add(Normalized(FVector3d(1, 1, -1)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(-1, 1, -1)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(1, -1, -1)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(-1, -1, -1)));
|
|
|
|
|
}
|
|
|
|
|
if (bLowerCorners)
|
|
|
|
|
{
|
|
|
|
|
Directions.Add(Normalized(FVector3d(1, 1, 1)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(-1, 1, 1)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(1, -1, 1)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(-1, -1, 1)));
|
|
|
|
|
}
|
|
|
|
|
if (bUpperEdges)
|
|
|
|
|
{
|
|
|
|
|
Directions.Add(Normalized(FVector3d(-1, 0, -1)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(1, 0, -1)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(0, -1, -1)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(0, 1, -1)));
|
|
|
|
|
}
|
|
|
|
|
// TODO We are missing bLowerEdges!
|
|
|
|
|
if (bSideEdges)
|
|
|
|
|
{
|
|
|
|
|
Directions.Add(Normalized(FVector3d(1, 1, 0)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(-1, 1, 0)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(1, -1, 0)));
|
|
|
|
|
Directions.Add(Normalized(FVector3d(-1, -1, 0)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Compute a sphere bounding the give actors so we can use it to position the render capture viewpoints
|
|
|
|
|
// Note: We use FWorldRenderCapture to do this but we are not going to render anything in this function
|
|
|
|
|
FSphere RenderSphere;
|
|
|
|
|
{
|
|
|
|
|
FWorldRenderCapture RenderCapture;
|
|
|
|
|
RenderCapture.SetVisibleActors(Actors);
|
|
|
|
|
RenderSphere = RenderCapture.ComputeContainingRenderSphere(HorizontalFOVDegrees);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TArray<FSpatialPhotoParams> Result;
|
|
|
|
|
|
|
|
|
|
int32 NumDirections = Directions.Num();
|
|
|
|
|
for (int32 di = 0; di < NumDirections; ++di)
|
|
|
|
|
{
|
|
|
|
|
FVector3d ViewDirection = Directions[di];
|
|
|
|
|
ViewDirection.Normalize();
|
|
|
|
|
|
|
|
|
|
FSpatialPhotoParams Params;
|
|
|
|
|
Params.NearPlaneDist = NearPlaneDist;
|
|
|
|
|
Params.HorzFOVDegrees = HorizontalFOVDegrees;
|
|
|
|
|
Params.Dimensions = PhotoDimensions;
|
|
|
|
|
// TODO Align the frame with the renderer coordinate system then remove the axis swapping in WorldRenderCapture.cpp
|
|
|
|
|
Params.Frame.AlignAxis(0, ViewDirection);
|
|
|
|
|
Params.Frame.ConstrainedAlignAxis(2, FVector3d::UnitZ(), Params.Frame.X());
|
|
|
|
|
Params.Frame.Origin = RenderSphere.Center;
|
|
|
|
|
Params.Frame.Origin -= RenderSphere.W * Params.Frame.X();
|
|
|
|
|
|
|
|
|
|
Result.Add(Params);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-05-16 06:50:35 -04:00
|
|
|
#undef LOCTEXT_NAMESPACE
|