2021-04-29 18:12:32 -04:00
// Copyright Epic Games, Inc. All Rights Reserved.
# include "GeometryProcessing/ApproximateActorsImpl.h"
# include "Scene/MeshSceneAdapter.h"
2021-06-13 00:35:22 -04:00
# include "DynamicMesh/DynamicMesh3.h"
# include "DynamicMesh/MeshNormals.h"
# include "DynamicMesh/MeshTangents.h"
2021-04-29 18:12:32 -04:00
# include "MeshSimplification.h"
# include "MeshConstraintsUtil.h"
# include "Implicit/Solidify.h"
# include "Implicit/Morphology.h"
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
# include "Operations/RemoveOccludedTriangles.h"
2021-04-29 18:12:32 -04:00
# include "ParameterizationOps/ParameterizeMeshOp.h"
# include "Parameterization/MeshUVPacking.h"
# include "MeshQueries.h"
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
# include "ProjectionTargets.h"
# include "Selections/MeshFaceSelection.h"
2021-04-29 18:12:32 -04:00
# include "AssetUtils/CreateStaticMeshUtil.h"
# include "AssetUtils/CreateTexture2DUtil.h"
# include "AssetUtils/CreateMaterialUtil.h"
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
# include "AssetUtils/Texture2DUtil.h"
2021-04-29 18:12:32 -04:00
# include "UObject/UObjectGlobals.h" // for CreatePackage
# include "ImageUtils.h"
# include "Image/ImageInfilling.h"
# include "Sampling/MeshGenericWorldPositionBaker.h"
# include "Scene/SceneCapturePhotoSet.h"
# include "AssetUtils/Texture2DBuilder.h"
# include "Materials/Material.h"
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
# include "Materials/MaterialInstanceConstant.h"
2021-04-29 18:12:32 -04:00
2021-06-02 16:08:31 -04:00
# include "Engine/MeshMerging.h"
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
# include "Async/Async.h"
2021-04-29 18:12:32 -04:00
# include "Misc/ScopedSlowTask.h"
2021-05-20 20:54:29 -04:00
# include "RenderCaptureInterface.h"
2021-04-29 18:12:32 -04:00
using namespace UE : : Geometry ;
using namespace UE : : AssetUtils ;
2021-06-04 12:43:35 -04:00
DEFINE_LOG_CATEGORY_STATIC ( LogApproximateActors , Log , All ) ;
2021-04-29 18:12:32 -04:00
# define LOCTEXT_NAMESPACE "ApproximateActorsImpl"
2021-05-20 20:54:29 -04:00
static TAutoConsoleVariable < int32 > CVarApproximateActorsRDOCCapture (
TEXT ( " ApproximateActors.RenderCapture " ) ,
0 ,
TEXT ( " Determines whether or not to trigger a render capture. \n " )
TEXT ( " 0: Turned Off \n " )
TEXT ( " 1: Turned On " ) ,
ECVF_Default ) ;
2021-04-29 18:12:32 -04:00
struct FGeneratedResultTextures
{
2021-05-26 03:37:14 -04:00
UTexture2D * BaseColorMap = nullptr ;
UTexture2D * RoughnessMap = nullptr ;
UTexture2D * MetallicMap = nullptr ;
UTexture2D * SpecularMap = nullptr ;
UTexture2D * PackedMRSMap = nullptr ;
UTexture2D * EmissiveMap = nullptr ;
UTexture2D * NormalMap = nullptr ;
2021-04-29 18:12:32 -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
static TUniquePtr < FSceneCapturePhotoSet > CapturePhotoSet (
const TArray < AActor * > & Actors ,
const IGeometryProcessing_ApproximateActors : : FOptions & Options
)
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Captures ) ;
double FieldOfView = Options . FieldOfViewDegrees ;
double NearPlaneDist = Options . NearPlaneDist ;
FImageDimensions CaptureDimensions ( Options . RenderCaptureImageSize , Options . RenderCaptureImageSize ) ;
TUniquePtr < FSceneCapturePhotoSet > SceneCapture = MakeUnique < FSceneCapturePhotoSet > ( ) ;
2021-05-26 03:37:14 -04:00
SceneCapture - > SetCaptureTypeEnabled ( ERenderCaptureType : : BaseColor , Options . bBakeBaseColor ) ;
SceneCapture - > SetCaptureTypeEnabled ( ERenderCaptureType : : WorldNormal , Options . bBakeNormalMap ) ;
SceneCapture - > SetCaptureTypeEnabled ( ERenderCaptureType : : Emissive , Options . bBakeEmissive ) ;
bool bMetallic = Options . bBakeMetallic ;
bool bRoughness = Options . bBakeRoughness ;
bool bSpecular = Options . bBakeSpecular ;
if ( Options . bUsePackedMRS & & ( bMetallic | | bRoughness | | bSpecular ) )
{
SceneCapture - > SetCaptureTypeEnabled ( ERenderCaptureType : : CombinedMRS , true ) ;
SceneCapture - > SetCaptureTypeEnabled ( ERenderCaptureType : : Roughness , false ) ;
SceneCapture - > SetCaptureTypeEnabled ( ERenderCaptureType : : Metallic , false ) ;
SceneCapture - > SetCaptureTypeEnabled ( ERenderCaptureType : : Specular , false ) ;
}
else
{
SceneCapture - > SetCaptureTypeEnabled ( ERenderCaptureType : : CombinedMRS , false ) ;
SceneCapture - > SetCaptureTypeEnabled ( ERenderCaptureType : : Roughness , true ) ;
SceneCapture - > SetCaptureTypeEnabled ( ERenderCaptureType : : Metallic , true ) ;
SceneCapture - > SetCaptureTypeEnabled ( ERenderCaptureType : : Specular , true ) ;
}
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
SceneCapture - > SetCaptureSceneActors ( Actors [ 0 ] - > GetWorld ( ) , Actors ) ;
SceneCapture - > AddStandardExteriorCapturesFromBoundingBox (
CaptureDimensions , FieldOfView , NearPlaneDist ,
true , true , true ) ;
return SceneCapture ;
}
2021-04-29 18:12:32 -04:00
static void BakeTexturesFromPhotoCapture (
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
TUniquePtr < FSceneCapturePhotoSet > & SceneCapture ,
2021-04-29 18:12:32 -04:00
const IGeometryProcessing_ApproximateActors : : FOptions & Options ,
FGeneratedResultTextures & GeneratedTextures ,
const FDynamicMesh3 * WorldTargetMesh ,
const FMeshTangentsd * MeshTangents
)
{
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
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Textures ) ;
2021-04-29 18:12:32 -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
int32 UVLayer = 0 ;
2021-05-04 19:08:26 -04:00
int32 Supersample = FMath : : Max ( 1 , Options . AntiAliasMultiSampling ) ;
if ( ( Options . TextureImageSize * Supersample ) > 16384 )
{
2021-06-04 12:43:35 -04:00
UE_LOG ( LogApproximateActors , Warning , TEXT ( " Ignoring requested supersampling rate %d because it would require image buffers with resolution %d, please try lower value. " ) , Supersample , Options . TextureImageSize * Supersample ) ;
2021-05-04 19:08:26 -04:00
Supersample = 1 ;
}
FImageDimensions OutputDimensions ( Options . TextureImageSize * Supersample , Options . TextureImageSize * Supersample ) ;
2021-04-29 18:12:32 -04:00
FScopedSlowTask Progress ( 8.f , LOCTEXT ( " BakingTextures " , " Baking Textures... " ) ) ;
Progress . MakeDialog ( true ) ;
Progress . EnterProgressFrame ( 1.f , LOCTEXT ( " BakingSetup " , " Setup... " ) ) ;
FDynamicMeshAABBTree3 Spatial ( WorldTargetMesh , true ) ;
FMeshImageBakingCache TempBakeCache ;
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
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Textures_MakeCache ) ;
TempBakeCache . SetDetailMesh ( WorldTargetMesh , & Spatial ) ;
TempBakeCache . SetBakeTargetMesh ( WorldTargetMesh ) ;
TempBakeCache . SetDimensions ( OutputDimensions ) ;
TempBakeCache . SetUVLayer ( UVLayer ) ;
TempBakeCache . SetThickness ( 0.1 ) ;
TempBakeCache . SetCorrespondenceStrategy ( FMeshImageBakingCache : : ECorrespondenceStrategy : : Identity ) ;
TempBakeCache . ValidateCache ( ) ;
}
2021-04-29 18:12:32 -04:00
Progress . EnterProgressFrame ( 1.f , LOCTEXT ( " BakingBaseColor " , " Baking Base Color... " ) ) ;
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
FAxisAlignedBox3d TargetBounds = WorldTargetMesh - > GetBounds ( ) ;
double RayOffsetHackDist = ( double ) ( 100.0f * FMathf : : ZeroTolerance * TargetBounds . MinDim ( ) ) ;
2021-04-29 18:12:32 -04:00
auto VisibilityFunction = [ & Spatial , RayOffsetHackDist ] ( const FVector3d & SurfPos , const FVector3d & ImagePosWorld )
{
FVector3d RayDir = ImagePosWorld - SurfPos ;
double Dist = Normalize ( RayDir ) ;
FVector3d RayOrigin = SurfPos + RayOffsetHackDist * RayDir ;
int32 HitTID = Spatial . FindNearestHitTriangle ( FRay3d ( RayOrigin , RayDir ) , IMeshSpatial : : FQueryOptions ( Dist ) ) ;
return ( HitTID = = IndexConstants : : InvalidID ) ;
} ;
FSceneCapturePhotoSet : : FSceneSample DefaultSample ;
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
FVector4f InvalidColor ( 0 , - 1 , 0 , 1 ) ;
DefaultSample . BaseColor = FVector3f ( InvalidColor . X , InvalidColor . Y , InvalidColor . Z ) ;
2021-04-29 18:12:32 -04:00
FMeshGenericWorldPositionColorBaker BaseColorBaker ;
BaseColorBaker . SetCache ( & TempBakeCache ) ;
BaseColorBaker . ColorSampleFunction = [ & ] ( FVector3d Position , FVector3d Normal ) {
FSceneCapturePhotoSet : : FSceneSample Sample = DefaultSample ;
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
SceneCapture - > ComputeSample ( FRenderCaptureTypeFlags : : BaseColor ( ) ,
2021-04-29 18:12:32 -04:00
Position , Normal , VisibilityFunction , Sample ) ;
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 Sample . GetValue4f ( ERenderCaptureType : : BaseColor ) ;
2021-04-29 18:12:32 -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
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Textures_BakeColor ) ;
BaseColorBaker . Bake ( ) ;
}
2021-04-29 18:12:32 -04:00
// find "hole" pixels
TArray < FVector2i > MissingPixels ;
TUniquePtr < TImageBuilder < FVector4f > > ColorImage = BaseColorBaker . TakeResult ( ) ;
TMarchingPixelInfill < FVector4f > Infill ;
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
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Textures_ComputeInfill ) ;
TempBakeCache . FindSamplingHoles ( [ & ] ( const FVector2i & Coords )
{
return ColorImage - > GetPixel ( Coords ) = = InvalidColor ;
} , MissingPixels ) ;
// solve infill for the holes while also caching infill information
Infill . ComputeInfill ( * ColorImage , MissingPixels , InvalidColor ,
[ ] ( FVector4f SumValue , int32 Count ) {
float InvSum = ( Count = = 0 ) ? 1.0f : ( 1.0f / Count ) ;
return FVector4f ( SumValue . X * InvSum , SumValue . Y * InvSum , SumValue . Z * InvSum , 1.0f ) ;
} ) ;
}
2021-04-29 18:12:32 -04:00
2021-05-04 19:08:26 -04:00
// downsample the image if necessary
if ( Supersample > 1 )
{
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
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Textures_Downsample ) ;
2021-05-04 19:08:26 -04:00
TImageBuilder < FVector4f > Downsampled = ColorImage - > FastDownsample ( Supersample , FVector4f : : Zero ( ) , [ ] ( FVector4f V , int N ) { return V / ( float ) N ; } ) ;
* ColorImage = MoveTemp ( Downsampled ) ;
}
2021-04-29 18:12:32 -04:00
2021-05-04 19:08:26 -04:00
// this lambda is used to process the per-channel images. It does the bake, applies infill, and downsamples if necessary
2021-04-29 18:12:32 -04:00
auto ProcessChannelFunc = [ & ] ( ERenderCaptureType CaptureType )
{
FVector4f DefaultValue ( 0 , 0 , 0 , 0 ) ;
FMeshGenericWorldPositionColorBaker ChannelBaker ;
ChannelBaker . SetCache ( & TempBakeCache ) ;
ChannelBaker . ColorSampleFunction = [ & ] ( FVector3d Position , FVector3d Normal ) {
FSceneCapturePhotoSet : : FSceneSample Sample = DefaultSample ;
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
SceneCapture - > ComputeSample ( FRenderCaptureTypeFlags : : Single ( CaptureType ) , Position , Normal , VisibilityFunction , Sample ) ;
return Sample . GetValue4f ( CaptureType ) ;
2021-04-29 18:12:32 -04:00
} ;
ChannelBaker . Bake ( ) ;
TUniquePtr < TImageBuilder < FVector4f > > Image = ChannelBaker . TakeResult ( ) ;
Infill . ApplyInfill ( * Image ,
[ ] ( FVector4f SumValue , int32 Count ) {
float InvSum = ( Count = = 0 ) ? 1.0f : ( 1.0f / Count ) ;
return FVector4f ( SumValue . X * InvSum , SumValue . Y * InvSum , SumValue . Z * InvSum , 1.0f ) ;
} ) ;
2021-05-04 19:08:26 -04:00
if ( Supersample > 1 )
{
TImageBuilder < FVector4f > Downsampled = Image - > FastDownsample ( Supersample , FVector4f : : Zero ( ) , [ ] ( FVector4f V , int N ) { return V / ( float ) N ; } ) ;
* Image = MoveTemp ( Downsampled ) ;
}
2021-04-29 18:12:32 -04:00
return MoveTemp ( Image ) ;
} ;
2021-05-26 03:37:14 -04:00
bool bMetallic = Options . bBakeMetallic ;
bool bRoughness = Options . bBakeRoughness ;
bool bSpecular = Options . bBakeSpecular ;
TUniquePtr < TImageBuilder < FVector4f > > RoughnessImage , MetallicImage , SpecularImage , PackedMRSImage , EmissiveImage ;
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
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Textures_OtherChannels ) ;
2021-05-26 03:37:14 -04:00
if ( Options . bUsePackedMRS & & ( bMetallic | | bRoughness | | bSpecular ) )
{
PackedMRSImage = ProcessChannelFunc ( ERenderCaptureType : : CombinedMRS ) ;
}
else
{
if ( bRoughness )
{
RoughnessImage = ProcessChannelFunc ( ERenderCaptureType : : Roughness ) ;
}
if ( bMetallic )
{
MetallicImage = ProcessChannelFunc ( ERenderCaptureType : : Metallic ) ;
}
if ( bSpecular )
{
SpecularImage = ProcessChannelFunc ( ERenderCaptureType : : Specular ) ;
}
}
if ( Options . bBakeEmissive )
{
EmissiveImage = ProcessChannelFunc ( ERenderCaptureType : : Emissive ) ;
}
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-29 18:12:32 -04:00
2021-05-26 03:37:14 -04:00
2021-04-29 18:12:32 -04:00
Progress . EnterProgressFrame ( 1.f , LOCTEXT ( " BakingNormals " , " Baking Normals... " ) ) ;
2021-05-26 03:37:14 -04:00
TUniquePtr < TImageBuilder < FVector3f > > NormalImage ;
if ( Options . bBakeNormalMap )
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
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Textures_NormalMapBake ) ;
2021-04-29 18:12:32 -04:00
2021-05-26 03:37:14 -04:00
// no infill on normal map for now, doesn't make sense to do after mapping to tangent space!
// (should we build baked normal map in world space, and then resample to tangent space??)
FVector4f DefaultNormalValue ( 0 , 0 , 1 , 1 ) ;
FMeshGenericWorldPositionNormalBaker NormalMapBaker ;
NormalMapBaker . SetCache ( & TempBakeCache ) ;
NormalMapBaker . BaseMeshTangents = MeshTangents ;
NormalMapBaker . NormalSampleFunction = [ & ] ( FVector3d Position , FVector3d Normal ) {
FSceneCapturePhotoSet : : FSceneSample Sample = DefaultSample ;
SceneCapture - > ComputeSample ( FRenderCaptureTypeFlags : : WorldNormal ( ) ,
Position , Normal , VisibilityFunction , Sample ) ;
FVector3f NormalColor = Sample . WorldNormal ;
float x = ( NormalColor . X - 0.5f ) * 2.0f ;
float y = ( NormalColor . Y - 0.5f ) * 2.0f ;
float z = ( NormalColor . Z - 0.5f ) * 2.0f ;
return FVector3f ( x , y , z ) ;
} ;
NormalMapBaker . Bake ( ) ;
NormalImage = NormalMapBaker . TakeResult ( ) ;
if ( Supersample > 1 )
{
TImageBuilder < FVector3f > Downsampled = NormalImage - > FastDownsample ( Supersample , FVector3f : : Zero ( ) , [ ] ( FVector3f V , int N ) { return V / ( float ) N ; } ) ;
* NormalImage = MoveTemp ( Downsampled ) ;
}
2021-05-04 19:08:26 -04:00
}
2021-04-29 18:12:32 -04:00
// build textures
Progress . EnterProgressFrame ( 1.f , LOCTEXT ( " BuildingTextures " , " Building Textures... " ) ) ;
{
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
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Textures_BuildTextures ) ;
2021-04-29 18:12:32 -04:00
FScopedSlowTask BuildTexProgress ( 6.f , LOCTEXT ( " BuildingTextures " , " Building Textures... " ) ) ;
BuildTexProgress . MakeDialog ( true ) ;
2021-05-26 03:37:14 -04:00
if ( Options . bBakeBaseColor & & ColorImage . IsValid ( ) )
{
BuildTexProgress . EnterProgressFrame ( 1.f ) ;
GeneratedTextures . BaseColorMap = FTexture2DBuilder : : BuildTextureFromImage ( * ColorImage , FTexture2DBuilder : : ETextureType : : Color , true , false ) ;
}
if ( Options . bBakeEmissive & & EmissiveImage . IsValid ( ) )
{
BuildTexProgress . EnterProgressFrame ( 1.f ) ;
2021-05-27 21:27:15 -04:00
GeneratedTextures . EmissiveMap = FTexture2DBuilder : : BuildTextureFromImage ( * EmissiveImage , FTexture2DBuilder : : ETextureType : : EmissiveHDR , false , false ) ;
2021-05-26 03:37:14 -04:00
}
if ( Options . bBakeNormalMap & & NormalImage . IsValid ( ) )
{
BuildTexProgress . EnterProgressFrame ( 1.f ) ;
GeneratedTextures . NormalMap = FTexture2DBuilder : : BuildTextureFromImage ( * NormalImage , FTexture2DBuilder : : ETextureType : : NormalMap , false , false ) ;
}
if ( ( bRoughness | | bMetallic | | bSpecular ) & & PackedMRSImage . IsValid ( ) )
{
BuildTexProgress . EnterProgressFrame ( 1.f ) ;
GeneratedTextures . PackedMRSMap = FTexture2DBuilder : : BuildTextureFromImage ( * PackedMRSImage , FTexture2DBuilder : : ETextureType : : ColorLinear , false , false ) ;
}
else
{
if ( bRoughness & & RoughnessImage . IsValid ( ) )
{
BuildTexProgress . EnterProgressFrame ( 1.f ) ;
GeneratedTextures . RoughnessMap = FTexture2DBuilder : : BuildTextureFromImage ( * RoughnessImage , FTexture2DBuilder : : ETextureType : : Roughness , false , false ) ;
}
if ( bMetallic & & MetallicImage . IsValid ( ) )
{
BuildTexProgress . EnterProgressFrame ( 1.f ) ;
GeneratedTextures . MetallicMap = FTexture2DBuilder : : BuildTextureFromImage ( * MetallicImage , FTexture2DBuilder : : ETextureType : : Metallic , false , false ) ;
}
if ( bSpecular & & SpecularImage . IsValid ( ) )
{
BuildTexProgress . EnterProgressFrame ( 1.f ) ;
GeneratedTextures . SpecularMap = FTexture2DBuilder : : BuildTextureFromImage ( * SpecularImage , FTexture2DBuilder : : ETextureType : : Specular , false , false ) ;
}
}
2021-04-29 18:12:32 -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
struct FApproximationMeshData
2021-04-29 18:12:32 -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
IGeometryProcessing_ApproximateActors : : EResultCode ResultCode = IGeometryProcessing_ApproximateActors : : EResultCode : : UnknownError ;
bool bHaveMesh = false ;
FDynamicMesh3 Mesh ;
bool bHaveTangents = false ;
FMeshTangentsd Tangents ;
} ;
2021-04-29 18:12:32 -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
static TSharedPtr < FApproximationMeshData > GenerateApproximationMesh (
FMeshSceneAdapter & Scene ,
const IGeometryProcessing_ApproximateActors : : FOptions & Options ,
double ApproxAccuracy
)
2021-04-29 18:12:32 -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
FScopedSlowTask Progress ( 8.f , LOCTEXT ( " Generating Mesh " , " Generating Mesh.. " ) ) ;
2021-04-29 18:12:32 -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
TSharedPtr < FApproximationMeshData > Result = MakeShared < FApproximationMeshData > ( ) ;
2021-04-29 18:12:32 -04:00
2021-05-20 19:35:43 -04:00
// collect seed points
2021-04-29 18:12:32 -04:00
TArray < FVector3d > SeedPoints ;
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
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate_SeedPoints ) ;
Scene . CollectMeshSeedPoints ( SeedPoints ) ;
}
2021-04-29 18:12:32 -04:00
FAxisAlignedBox3d SceneBounds = Scene . GetBoundingBox ( ) ;
// calculate a voxel size based on target world-space approximation accuracy
float WorldBoundsSize = SceneBounds . DiagonalLength ( ) ;
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
int32 VoxelDimTarget = ( int ) ( WorldBoundsSize / ApproxAccuracy ) + 1 ;
2021-04-29 18:12:32 -04:00
if ( VoxelDimTarget < 64 )
{
VoxelDimTarget = 64 ; // use a sane minimum in case the parameter is super-wrong
}
// avoid insane memory usage
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
if ( VoxelDimTarget > Options . ClampVoxelDimension )
2021-04-29 18:12:32 -04:00
{
2021-06-04 12:43:35 -04:00
UE_LOG ( LogApproximateActors , Warning , TEXT ( " FApproximateActorsImpl - very large voxel size %d clamped to %d " ) , VoxelDimTarget , Options . ClampVoxelDimension ) ;
2021-04-29 18:12:32 -04:00
VoxelDimTarget = Options . ClampVoxelDimension ;
}
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
Progress . EnterProgressFrame ( 1.f , LOCTEXT ( " SolidifyMesh " , " Approximating Mesh... " ) ) ;
2021-04-29 18:12:32 -04:00
FWindingNumberBasedSolidify Solidify (
2021-05-20 19:35:43 -04:00
[ & Scene ] ( const FVector3d & Position ) { return Scene . FastWindingNumber ( Position , true ) ; } ,
2021-04-29 18:12:32 -04:00
SceneBounds , SeedPoints ) ;
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
Solidify . SetCellSizeAndExtendBounds ( SceneBounds , 2.0 * ApproxAccuracy , VoxelDimTarget ) ;
2021-05-04 19:08:26 -04:00
Solidify . WindingThreshold = Options . WindingThreshold ;
2021-04-29 18:12:32 -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
FDynamicMesh3 SolidMesh ;
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate_Solidify ) ;
SolidMesh = FDynamicMesh3 ( & Solidify . Generate ( ) ) ;
}
2021-04-29 18:12:32 -04:00
SolidMesh . DiscardAttributes ( ) ;
FDynamicMesh3 * CurResultMesh = & SolidMesh ; // this pointer will be updated as we recompute the mesh
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
if ( Options . bVerbose )
{
2021-06-04 12:43:35 -04:00
UE_LOG ( LogApproximateActors , Warning , TEXT ( " Solidify mesh has %d triangles " ) , CurResultMesh - > TriangleCount ( ) ) ;
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-29 18:12:32 -04:00
Progress . EnterProgressFrame ( 1.f , LOCTEXT ( " ClosingMesh " , " Topological Operations... " ) ) ;
// do topological closure to fix small gaps/etc
FDynamicMesh3 MorphologyMesh ;
if ( Options . bApplyMorphology )
{
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
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate_Morphology ) ;
2021-04-29 18:12:32 -04:00
double MorphologyDistance = Options . MorphologyDistanceMeters * 100.0 ; // convert to cm
FAxisAlignedBox3d MorphologyBounds = CurResultMesh - > GetBounds ( ) ;
FDynamicMeshAABBTree3 MorphologyBVTree ( CurResultMesh ) ;
TImplicitMorphology < FDynamicMesh3 > ImplicitMorphology ;
ImplicitMorphology . MorphologyOp = TImplicitMorphology < FDynamicMesh3 > : : EMorphologyOp : : Close ;
ImplicitMorphology . Source = CurResultMesh ;
ImplicitMorphology . SourceSpatial = & MorphologyBVTree ;
ImplicitMorphology . SetCellSizesAndDistance ( MorphologyBounds , MorphologyDistance , VoxelDimTarget , VoxelDimTarget ) ;
MorphologyMesh = FDynamicMesh3 ( & ImplicitMorphology . Generate ( ) ) ;
MorphologyMesh . DiscardAttributes ( ) ;
CurResultMesh = & MorphologyMesh ;
2021-05-20 19:35:43 -04:00
if ( Options . bVerbose )
{
2021-06-04 12:43:35 -04:00
UE_LOG ( LogApproximateActors , Warning , TEXT ( " Morphology mesh has %d triangles " ) , CurResultMesh - > TriangleCount ( ) ) ;
2021-05-20 19:35:43 -04:00
}
2021-04-29 18:12:32 -04:00
}
// if mesh has no triangles, something has gone wrong
if ( CurResultMesh = = nullptr | | CurResultMesh - > TriangleCount ( ) = = 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
Result - > ResultCode = IGeometryProcessing_ApproximateActors : : EResultCode : : MeshGenerationFailed ;
return Result ;
2021-04-29 18:12:32 -04:00
}
Progress . EnterProgressFrame ( 1.f , LOCTEXT ( " SimplifyingMesh " , " Simplifying Mesh... " ) ) ;
FVolPresMeshSimplification Simplifier ( CurResultMesh ) ;
Simplifier . ProjectionMode = FVolPresMeshSimplification : : ETargetProjectionMode : : NoProjection ;
Simplifier . DEBUG_CHECK_LEVEL = 0 ;
Simplifier . bAllowSeamCollapse = 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
int32 BaseTargeTriCount = Options . FixedTriangleCount ;
{
int32 BeforeCount = CurResultMesh - > TriangleCount ( ) ;
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate_Simplification ) ;
if ( Options . MeshSimplificationPolicy = = IGeometryProcessing_ApproximateActors : : ESimplificationPolicy : : TrianglesPerUnitSqMeter )
{
FVector2d VolArea = TMeshQueries < FDynamicMesh3 > : : GetVolumeArea ( * CurResultMesh ) ;
double MeshAreaMeterSqr = VolArea . Y * 0.0001 ;
int32 AreaBaseTargetTriCount = MeshAreaMeterSqr * Options . SimplificationTargetMetric ;
Simplifier . SimplifyToTriangleCount ( AreaBaseTargetTriCount ) ;
}
else if ( Options . MeshSimplificationPolicy = = IGeometryProcessing_ApproximateActors : : ESimplificationPolicy : : GeometricTolerance )
{
double UseTargetTolerance = Options . SimplificationTargetMetric * 100.0 ; // convert to cm (UE Units)
// first do fast collapse
2021-05-20 19:35:43 -04:00
// (this does not seem to help perf and probably makes the results slightly worse)
//{
// TRACE_CPUPROFILER_EVENT_SCOPE(ApproximateActorsImpl_Generate_Simplification_PrePass);
// Simplifier.FastCollapsePass(0.1 * UseTargetTolerance, 5);
//}
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
// now simplify down to a reasonable tri count, as geometric metric is (relatively) expensive
// (still, this is all incredibly cheap compared to the cost of the rest of this method in practice)
2021-05-20 19:35:43 -04:00
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate_Simplification_Pass1 ) ;
Simplifier . SimplifyToTriangleCount ( 50000 ) ;
}
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
FDynamicMesh3 MeshCopy ( * CurResultMesh ) ;
FDynamicMeshAABBTree3 MeshCopySpatial ( & MeshCopy , true ) ;
FMeshProjectionTarget ProjectionTarget ( & MeshCopy , & MeshCopySpatial ) ;
Simplifier . SetProjectionTarget ( & ProjectionTarget ) ;
Simplifier . GeometricErrorConstraint = FVolPresMeshSimplification : : EGeometricErrorCriteria : : PredictedPointToProjectionTarget ;
Simplifier . GeometricErrorTolerance = UseTargetTolerance ;
2021-05-20 19:35:43 -04:00
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate_Simplification_Pass2 ) ;
Simplifier . SimplifyToTriangleCount ( 8 ) ;
}
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
}
else
{
Simplifier . SimplifyToTriangleCount ( BaseTargeTriCount ) ;
}
int32 AfterCount = CurResultMesh - > TriangleCount ( ) ;
if ( Options . bVerbose )
{
2021-06-04 12:43:35 -04:00
UE_LOG ( LogApproximateActors , Warning , TEXT ( " Simplified mesh from %d to %d triangles " ) , BeforeCount , AfterCount ) ;
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-29 18:12:32 -04:00
2021-06-15 00:28:54 -04:00
Progress . EnterProgressFrame ( 1.f , LOCTEXT ( " RemoveHidden " , " Removing Hidden Geometry... " ) ) ;
if ( Options . OcclusionPolicy = = IGeometryProcessing_ApproximateActors : : EOcclusionPolicy : : VisibilityBased )
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate_Occlusion ) ;
TRemoveOccludedTriangles < FDynamicMesh3 > Remover ( CurResultMesh ) ;
Remover . InsideMode = EOcclusionCalculationMode : : SimpleOcclusionTest ;
Remover . TriangleSamplingMethod = EOcclusionTriangleSampling : : VerticesAndCentroids ;
Remover . AddTriangleSamples = 50 ;
Remover . AddRandomRays = 50 ;
FDynamicMeshAABBTree3 CurResultMeshSpatial ( CurResultMesh , false ) ;
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate_Occlusion_Spatial ) ;
CurResultMeshSpatial . Build ( ) ;
}
TArray < FTransform3d > NoTransforms ;
NoTransforms . Add ( FTransform3d : : Identity ( ) ) ;
TArray < FDynamicMeshAABBTree3 * > Spatials ;
Spatials . Add ( & CurResultMeshSpatial ) ;
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate_Occlusion_Compute ) ;
Remover . Select ( NoTransforms , Spatials , { } , NoTransforms ) ;
}
if ( Remover . RemovedT . Num ( ) > 0 )
{
FMeshFaceSelection Selection ( CurResultMesh ) ;
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate_Occlusion_Clean ) ;
Selection . Select ( Remover . RemovedT ) ;
Selection . ExpandToOneRingNeighbours ( 1 ) ;
Selection . ContractBorderByOneRingNeighbours ( 2 ) ;
}
FDynamicMeshEditor Editor ( CurResultMesh ) ;
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate_Occlusion_Delete ) ;
Editor . RemoveTriangles ( Selection . AsArray ( ) , true ) ;
}
}
if ( Options . bVerbose )
{
UE_LOG ( LogApproximateActors , Warning , TEXT ( " Occlusion-Filtered mesh has %d triangles " ) , CurResultMesh - > TriangleCount ( ) ) ;
}
}
2021-04-29 18:12:32 -04:00
// re-enable attributes
CurResultMesh - > EnableAttributes ( ) ;
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
// TODO: clip hidden triangles against occluder geo like landscape
2021-04-29 18:12:32 -04:00
// compute normals
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
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate_Normals ) ;
2021-05-20 19:35:43 -04:00
if ( Options . bCalculateHardNormals )
{
FMeshNormals : : InitializeOverlayTopologyFromOpeningAngle ( CurResultMesh , CurResultMesh - > Attributes ( ) - > PrimaryNormals ( ) , Options . HardNormalsAngleDeg ) ;
FMeshNormals : : QuickRecomputeOverlayNormals ( * CurResultMesh ) ;
}
else
{
FMeshNormals : : InitializeOverlayToPerVertexNormals ( CurResultMesh - > Attributes ( ) - > PrimaryNormals ( ) ) ;
}
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-29 18:12:32 -04:00
// exit here if we are just generating a merged collision mesh
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
if ( Options . BasePolicy = = IGeometryProcessing_ApproximateActors : : EApproximationPolicy : : CollisionMesh )
2021-04-29 18:12:32 -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
Result - > ResultCode = IGeometryProcessing_ApproximateActors : : EResultCode : : Success ;
Result - > bHaveMesh = true ;
Result - > Mesh = MoveTemp ( * CurResultMesh ) ;
return Result ;
2021-04-29 18:12:32 -04:00
}
Progress . EnterProgressFrame ( 1.f , LOCTEXT ( " ComputingUVs " , " Computing UVs... " ) ) ;
// compute UVs
TSharedPtr < FDynamicMesh3 , ESPMode : : ThreadSafe > UVInputMesh = MakeShared < FDynamicMesh3 , ESPMode : : ThreadSafe > ( ) ;
* UVInputMesh = MoveTemp ( * CurResultMesh ) ;
FParameterizeMeshOp ParameterizeMeshOp ;
ParameterizeMeshOp . Stretch = 0.1 ;
ParameterizeMeshOp . NumCharts = 0 ;
ParameterizeMeshOp . InputMesh = UVInputMesh ;
2021-06-20 16:57:02 -04:00
ParameterizeMeshOp . Method = UE : : Geometry : : EParamOpBackend : : UVAtlas ;
2021-04-29 18:12:32 -04:00
FProgressCancel UVProgressCancel ;
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
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate_GenerateUVs ) ;
ParameterizeMeshOp . CalculateResult ( & UVProgressCancel ) ;
}
2021-04-29 18:12:32 -04:00
TUniquePtr < FDynamicMesh3 > FinalMesh = ParameterizeMeshOp . ExtractResult ( ) ;
Progress . EnterProgressFrame ( 1.f , LOCTEXT ( " PackingUVs " , " Packing UVs... " ) ) ;
// repack UVs
FDynamicMeshUVOverlay * RepackUVLayer = FinalMesh - > Attributes ( ) - > PrimaryUV ( ) ;
RepackUVLayer - > SplitBowties ( ) ;
FDynamicMeshUVPacker Packer ( RepackUVLayer ) ;
Packer . TextureResolution = Options . TextureImageSize / 4 ; // maybe too conservative? We don't have gutter control currently.
Packer . GutterSize = 1.0 ; // not clear this works
Packer . bAllowFlips = 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
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate_PackUVs ) ;
bool bOK = Packer . StandardPack ( ) ;
ensure ( bOK ) ;
}
2021-04-29 18:12:32 -04:00
Progress . EnterProgressFrame ( 1.f , LOCTEXT ( " ComputingTangents " , " Computing Tangents... " ) ) ;
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
Result - > ResultCode = IGeometryProcessing_ApproximateActors : : EResultCode : : Success ;
Result - > bHaveMesh = true ;
Result - > Mesh = MoveTemp ( * FinalMesh ) ;
2021-04-29 18:12:32 -04:00
// compute tangents
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
Result - > bHaveTangents = true ;
Result - > Tangents . SetMesh ( & Result - > Mesh ) ;
2021-04-29 18:12:32 -04:00
FComputeTangentsOptions TangentsOptions ;
TangentsOptions . bAveraged = true ;
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
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate_Tangents ) ;
Result - > Tangents . ComputeTriVertexTangents (
Result - > Mesh . Attributes ( ) - > PrimaryNormals ( ) ,
Result - > Mesh . Attributes ( ) - > PrimaryUV ( ) ,
TangentsOptions ) ;
}
return Result ;
}
2021-06-10 21:49:51 -04:00
static int32 GetMeshTextureSizeFromTargetTexelDensity ( const FDynamicMesh3 & Mesh , float TargetTexelDensity )
{
const FDynamicMeshUVOverlay * UVOverlay = Mesh . Attributes ( ) - > PrimaryUV ( ) ;
double Mesh3DArea = 0 ;
double MeshUVArea = 0 ;
for ( int TriangleID : Mesh . TriangleIndicesItr ( ) )
{
// World space area
Mesh3DArea + = Mesh . GetTriArea ( TriangleID ) ;
FIndex3i UVVertices = UVOverlay - > GetTriangle ( TriangleID ) ;
FTriangle2d TriangleUV = FTriangle2d (
( FVector2d ) UVOverlay - > GetElement ( UVVertices . A ) ,
( FVector2d ) UVOverlay - > GetElement ( UVVertices . B ) ,
( FVector2d ) UVOverlay - > GetElement ( UVVertices . C ) ) ;
// UV space area
MeshUVArea + = TriangleUV . Area ( ) ;
}
double TexelRatio = FMath : : Sqrt ( MeshUVArea / Mesh3DArea ) * 100 ;
// Compute the perfect texture size that would get us to our texture density
// Also compute the nearest power of two sizes (below and above our target)
const int32 SizePerfect = FMath : : CeilToInt ( TargetTexelDensity / TexelRatio ) ;
const int32 SizeHi = FMath : : RoundUpToPowerOfTwo ( SizePerfect ) ;
const int32 SizeLo = SizeHi > > 1 ;
// Compute the texel density we achieve with these two texture sizes
const double TexelDensityLo = SizeLo * TexelRatio ;
const double TexelDensityHi = SizeHi * TexelRatio ;
// Select best match between low & high res textures.
const double TexelDensityLoDiff = TargetTexelDensity - TexelDensityLo ;
const double TexelDensityHiDiff = TexelDensityHi - TargetTexelDensity ;
const int32 BestTextureSize = TexelDensityLoDiff < TexelDensityHiDiff ? SizeLo : SizeHi ;
return BestTextureSize ;
}
2021-06-02 16:08:31 -04:00
IGeometryProcessing_ApproximateActors : : FOptions FApproximateActorsImpl : : ConstructOptions ( const FMeshApproximationSettings & UseSettings )
{
//
// Construct options for ApproximateActors operation
//
FOptions Options ;
Options . BasePolicy = ( UseSettings . OutputType = = EMeshApproximationType : : MeshShapeOnly ) ?
IGeometryProcessing_ApproximateActors : : EApproximationPolicy : : CollisionMesh :
IGeometryProcessing_ApproximateActors : : EApproximationPolicy : : MeshAndGeneratedMaterial ;
Options . WorldSpaceApproximationAccuracyMeters = UseSettings . ApproximationAccuracy ;
Options . bAutoThickenThinParts = UseSettings . bAttemptAutoThickening ;
Options . AutoThickenThicknessMeters = UseSettings . TargetMinThicknessMultiplier * UseSettings . ApproximationAccuracy ;
Options . BaseCappingPolicy = IGeometryProcessing_ApproximateActors : : EBaseCappingPolicy : : NoBaseCapping ;
if ( UseSettings . BaseCapping = = EMeshApproximationBaseCappingType : : ConvexPolygon )
{
Options . BaseCappingPolicy = IGeometryProcessing_ApproximateActors : : EBaseCappingPolicy : : ConvexPolygon ;
}
else if ( UseSettings . BaseCapping = = EMeshApproximationBaseCappingType : : ConvexSolid )
{
Options . BaseCappingPolicy = IGeometryProcessing_ApproximateActors : : EBaseCappingPolicy : : ConvexSolid ;
}
Options . ClampVoxelDimension = UseSettings . ClampVoxelDimension ;
Options . WindingThreshold = UseSettings . WindingThreshold ;
Options . bApplyMorphology = UseSettings . bFillGaps ;
Options . MorphologyDistanceMeters = UseSettings . GapDistance ;
Options . OcclusionPolicy = ( UseSettings . OcclusionMethod = = EOccludedGeometryFilteringPolicy : : VisibilityBasedFiltering ) ?
IGeometryProcessing_ApproximateActors : : EOcclusionPolicy : : VisibilityBased : IGeometryProcessing_ApproximateActors : : EOcclusionPolicy : : None ;
Options . FixedTriangleCount = UseSettings . TargetTriCount ;
if ( UseSettings . SimplifyMethod = = EMeshApproximationSimplificationPolicy : : TrianglesPerArea )
{
Options . MeshSimplificationPolicy = IGeometryProcessing_ApproximateActors : : ESimplificationPolicy : : TrianglesPerUnitSqMeter ;
Options . SimplificationTargetMetric = UseSettings . TrianglesPerM ;
}
else if ( UseSettings . SimplifyMethod = = EMeshApproximationSimplificationPolicy : : GeometricTolerance )
{
Options . MeshSimplificationPolicy = IGeometryProcessing_ApproximateActors : : ESimplificationPolicy : : GeometricTolerance ;
Options . SimplificationTargetMetric = UseSettings . GeometricDeviation ;
}
else
{
Options . MeshSimplificationPolicy = IGeometryProcessing_ApproximateActors : : ESimplificationPolicy : : FixedTriangleCount ;
}
2021-06-15 00:28:54 -04:00
Options . bCalculateHardNormals = UseSettings . bEstimateHardNormals ;
Options . HardNormalsAngleDeg = FMath : : Clamp ( UseSettings . HardNormalAngle , 0.001f , 89.99f ) ;
2021-06-02 16:08:31 -04:00
Options . TextureImageSize = UseSettings . MaterialSettings . TextureSize . X ;
Options . AntiAliasMultiSampling = FMath : : Max ( 1 , UseSettings . MultiSamplingAA ) ;
Options . RenderCaptureImageSize = ( UseSettings . RenderCaptureResolution = = 0 ) ?
Options . TextureImageSize : UseSettings . RenderCaptureResolution ;
Options . FieldOfViewDegrees = UseSettings . CaptureFieldOfView ;
Options . NearPlaneDist = UseSettings . NearPlaneDist ;
Options . bVerbose = UseSettings . bPrintDebugMessages ;
Options . bWriteDebugMesh = UseSettings . bEmitFullDebugMesh ;
// Nanite settings
Options . bGenerateNaniteEnabledMesh = UseSettings . bGenerateNaniteEnabledMesh ;
Options . NaniteProxyTrianglePercent = UseSettings . NaniteProxyTrianglePercent ;
// Distance field
Options . bAllowDistanceField = UseSettings . bAllowDistanceField ;
// Ray tracing
Options . bSupportRayTracing = UseSettings . bSupportRayTracing ;
return Options ;
}
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
void FApproximateActorsImpl : : ApproximateActors ( const TArray < AActor * > & Actors , const FOptions & Options , FResults & ResultsOut )
{
int32 ActorClusters = 1 ;
FScopedSlowTask Progress ( 1.f , LOCTEXT ( " ApproximatingActors " , " Generating Actor Approximation... " ) ) ;
Progress . MakeDialog ( true ) ;
Progress . EnterProgressFrame ( 1.f ) ;
GenerateApproximationForActorSet ( Actors , Options , ResultsOut ) ;
}
void FApproximateActorsImpl : : GenerateApproximationForActorSet ( const TArray < AActor * > & Actors , const FOptions & Options , FResults & ResultsOut )
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate ) ;
2021-05-20 20:54:29 -04:00
RenderCaptureInterface : : FScopedCapture RenderCapture ( CVarApproximateActorsRDOCCapture . GetValueOnAnyThread ( ) = = 1 , TEXT ( " ApproximateActors " ) ) ;
2021-06-04 12:43:35 -04:00
if ( Options . BasePolicy = = IGeometryProcessing_ApproximateActors : : EApproximationPolicy : : MeshAndGeneratedMaterial )
{
// The scene capture photoset part of this process relies on debug view modes being available.
// If it ain't the case, fail immediatelly
if ( ! AllowDebugViewmodes ( ) )
{
UE_LOG ( LogApproximateActors , Error , TEXT ( " Debug view modes not are available - unable to generate material " ) ) ;
ResultsOut . ResultCode = EResultCode : : MaterialGenerationFailed ;
return ;
}
}
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
//
// Future Optimizations
// - can do most of the mesh processing at the same time as capturing the photo set (if that matters)
// - some parts of mesh gen can be done simultaneously (maybe?)
//
FScopedSlowTask Progress ( 11.f , LOCTEXT ( " ApproximatingActors " , " Generating Actor Approximation... " ) ) ;
Progress . EnterProgressFrame ( 1.f , LOCTEXT ( " BuildingScene " , " Building Scene... " ) ) ;
float ApproxAccuracy = Options . WorldSpaceApproximationAccuracyMeters * 100.0 ; // convert to cm (UE Units)
FMeshSceneAdapter Scene ;
FMeshSceneAdapterBuildOptions SceneBuildOptions ;
SceneBuildOptions . bThickenThinMeshes = Options . bAutoThickenThinParts ;
SceneBuildOptions . DesiredMinThickness = Options . AutoThickenThicknessMeters * 100.0 ; // convert to cm (UE Units)
2021-06-15 02:47:13 -04:00
// filter out objects smaller than 10% of voxel size
SceneBuildOptions . bFilterTinyObjects = true ;
SceneBuildOptions . TinyObjectBoxMaxDimension = ApproxAccuracy * 0.1 ;
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
SceneBuildOptions . bPrintDebugMessages = Options . bVerbose ;
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate_BuildScene ) ;
Scene . AddActors ( Actors ) ;
Scene . Build ( SceneBuildOptions ) ;
}
// todo: make optional
if ( Options . bVerbose )
{
FMeshSceneAdapter : : FStatistics Stats ;
Scene . GetGeometryStatistics ( Stats ) ;
2021-06-08 02:55:00 -04:00
UE_LOG ( LogApproximateActors , Warning , TEXT ( " %lld triangles in %lld unique meshes, total %lld triangles in %lld instances " ) ,
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
Stats . UniqueMeshTriangleCount , Stats . UniqueMeshCount , Stats . InstanceMeshTriangleCount , Stats . InstanceMeshCount ) ;
}
if ( Options . BaseCappingPolicy ! = EBaseCappingPolicy : : NoBaseCapping )
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate_Capping ) ;
double UseThickness = ( Options . BaseThicknessOverrideMeters ! = 0 ) ? ( Options . BaseThicknessOverrideMeters * 100.0 ) :
( Options . bAutoThickenThinParts ? SceneBuildOptions . DesiredMinThickness : 1.25 * ApproxAccuracy ) ;
double UseHeight = ( Options . BaseHeightOverrideMeters ! = 0 ) ? ( Options . BaseHeightOverrideMeters * 100.0 ) : ( 2.0 * ApproxAccuracy ) ;
Scene . GenerateBaseClosingMesh ( UseHeight , UseThickness ) ;
}
FDynamicMesh3 DebugMesh ;
FDynamicMesh3 * WriteDebugMesh = nullptr ;
if ( Options . bWriteDebugMesh )
{
TRACE_CPUPROFILER_EVENT_SCOPE ( ApproximateActorsImpl_Generate_DebugMesh ) ;
DebugMesh . EnableAttributes ( ) ;
Scene . GetAccumulatedMesh ( DebugMesh ) ;
FMeshNormals : : InitializeMeshToPerTriangleNormals ( & DebugMesh ) ;
WriteDebugMesh = & DebugMesh ;
}
2021-05-20 19:35:43 -04:00
// build spatial evaluation cache
Scene . BuildSpatialEvaluationCache ( ) ;
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
// if we are only generating collision mesh, we are going to exit after mesh generation
if ( Options . BasePolicy = = IGeometryProcessing_ApproximateActors : : EApproximationPolicy : : CollisionMesh )
{
TSharedPtr < FApproximationMeshData > ApproximationMeshData = GenerateApproximationMesh ( Scene , Options , ApproxAccuracy ) ;
ResultsOut . ResultCode = ApproximationMeshData - > ResultCode ;
if ( ResultsOut . ResultCode = = EResultCode : : Success )
{
EmitGeneratedMeshAsset ( Actors , Options , ResultsOut , & ApproximationMeshData - > Mesh , nullptr , WriteDebugMesh ) ;
}
return ;
}
// launch async mesh compute which can run while we do (relatively) expensive render captures
TFuture < TSharedPtr < FApproximationMeshData > > MeshComputeFuture = Async ( EAsyncExecution : : Thread ,
[ & Scene , & Options , & ApproxAccuracy ] ( ) {
return GenerateApproximationMesh ( Scene , Options , ApproxAccuracy ) ;
} ) ;
Progress . EnterProgressFrame ( 1.f , LOCTEXT ( " CapturingScene " , " Capturing Scene... " ) ) ;
TUniquePtr < FSceneCapturePhotoSet > SceneCapture = CapturePhotoSet ( Actors , Options ) ;
2021-04-29 18:12:32 -04:00
Progress . EnterProgressFrame ( 1.f , LOCTEXT ( " BakingTextures " , " Baking Textures... " ) ) ;
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
// need to wait for mesh to finish computing
MeshComputeFuture . Wait ( ) ;
TSharedPtr < FApproximationMeshData > ApproximationMeshData = MeshComputeFuture . Get ( ) ;
if ( ApproximationMeshData - > ResultCode ! = EResultCode : : Success )
{
ResultsOut . ResultCode = ApproximationMeshData - > ResultCode ;
return ;
}
FDynamicMesh3 FinalMesh = MoveTemp ( ApproximationMeshData - > Mesh ) ;
FMeshTangentsd FinalMeshTangents = MoveTemp ( ApproximationMeshData - > Tangents ) ;
2021-06-10 21:49:51 -04:00
FOptions OverridenOptions = Options ;
// evaluate required texture size if needed
if ( Options . TextureSizePolicy = = ETextureSizePolicy : : TexelDensity )
{
const int32 MaxTextureSize = 8192 ;
const int32 BestTextureSize = GetMeshTextureSizeFromTargetTexelDensity ( FinalMesh , Options . MeshTexelDensity ) ;
if ( BestTextureSize > MaxTextureSize )
{
UE_LOG ( LogApproximateActors , Warning , TEXT ( " Mesh would require %dx%d textures, clamping down to maximum (%dx%d) " ) , BestTextureSize , BestTextureSize , MaxTextureSize , MaxTextureSize ) ;
OverridenOptions . TextureImageSize = MaxTextureSize ;
}
else
{
OverridenOptions . TextureImageSize = BestTextureSize ;
}
}
2021-04-29 18:12:32 -04:00
// bake textures for Actor
FGeneratedResultTextures GeneratedTextures ;
2021-06-10 21:49:51 -04:00
BakeTexturesFromPhotoCapture ( SceneCapture , OverridenOptions ,
2021-04-29 18:12:32 -04:00
GeneratedTextures ,
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
& FinalMesh , & FinalMeshTangents ) ;
2021-04-29 18:12:32 -04:00
Progress . EnterProgressFrame ( 1.f , LOCTEXT ( " Writing Assets " , " Writing Assets... " ) ) ;
2021-05-26 03:37:14 -04:00
// Make material for textures by creating MIC of input material, or fall back to known material
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
UMaterialInterface * UseBaseMaterial = ( Options . BakeMaterial ! = nullptr ) ?
2021-05-26 03:37:14 -04:00
Options . BakeMaterial : LoadObject < UMaterial > ( nullptr , TEXT ( " /MeshModelingToolset/Materials/FullMaterialBakePreviewMaterial_PackedMRS " ) ) ;
2021-04-29 18:12:32 -04:00
FMaterialAssetOptions MatOptions ;
MatOptions . NewAssetPath = Options . BasePackagePath + TEXT ( " _Material " ) ;
FMaterialAssetResults MatResults ;
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
ECreateMaterialResult MatResult = UE : : AssetUtils : : CreateDerivedMaterialInstance ( UseBaseMaterial , MatOptions , MatResults ) ;
UMaterialInstanceConstant * NewMaterial = nullptr ;
2021-04-29 18:12:32 -04:00
if ( ensure ( MatResult = = ECreateMaterialResult : : Ok ) )
{
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
NewMaterial = MatResults . NewMaterialInstance ;
2021-04-29 18:12:32 -04:00
ResultsOut . NewMaterials . Add ( NewMaterial ) ;
}
// this lambda converts a generated texture to an Asset, and then assigns it to a parameter of the Material
FString BaseTexturePath = MatOptions . NewAssetPath ;
auto WriteTextureLambda = [ BaseTexturePath , NewMaterial , & ResultsOut ] (
UTexture2D * Texture ,
FString TextureTypeSuffix ,
FTexture2DBuilder : : ETextureType Type ,
FName MaterialParamName )
{
if ( ensure ( Texture ! = nullptr ) = = false ) return ;
FTexture2DBuilder : : CopyPlatformDataToSourceData ( Texture , Type ) ;
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
if ( Type = = FTexture2DBuilder : : ETextureType : : Roughness
| | Type = = FTexture2DBuilder : : ETextureType : : Metallic
| | Type = = FTexture2DBuilder : : ETextureType : : Specular )
{
UE : : AssetUtils : : ConvertToSingleChannel ( Texture ) ;
}
2021-05-28 02:46:59 -04:00
// Make sure the texture is a VT if required by the material sampler
if ( NewMaterial ! = nullptr )
{
UTexture * DefaultTexture = nullptr ;
NewMaterial - > GetTextureParameterValue ( MaterialParamName , DefaultTexture ) ;
if ( ensure ( DefaultTexture ) )
{
Texture - > VirtualTextureStreaming = DefaultTexture - > VirtualTextureStreaming ;
}
}
2021-04-29 18:12:32 -04:00
FTexture2DAssetOptions TexOptions ;
TexOptions . NewAssetPath = BaseTexturePath + TextureTypeSuffix ;
FTexture2DAssetResults Results ;
ECreateTexture2DResult TexResult = UE : : AssetUtils : : SaveGeneratedTexture2DAsset ( Texture , TexOptions , Results ) ;
if ( ensure ( TexResult = = ECreateTexture2DResult : : Ok ) )
{
ResultsOut . NewTextures . Add ( Texture ) ;
if ( NewMaterial ! = nullptr )
{
NewMaterial - > SetTextureParameterValueEditorOnly ( MaterialParamName , Texture ) ;
}
}
} ;
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-29 18:12:32 -04:00
// process the generated textures
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
if ( Options . bBakeBaseColor & & GeneratedTextures . BaseColorMap )
{
WriteTextureLambda ( GeneratedTextures . BaseColorMap , TEXT ( " _BaseColor " ) , FTexture2DBuilder : : ETextureType : : Color , Options . BaseColorTexParamName ) ;
}
2021-05-26 03:37:14 -04:00
if ( Options . bBakeEmissive & & GeneratedTextures . EmissiveMap )
{
2021-05-27 21:27:15 -04:00
WriteTextureLambda ( GeneratedTextures . EmissiveMap , TEXT ( " _Emissive " ) , FTexture2DBuilder : : ETextureType : : EmissiveHDR , Options . EmissiveTexParamName ) ;
2021-05-26 03:37:14 -04:00
}
if ( Options . bBakeNormalMap & & GeneratedTextures . NormalMap )
{
WriteTextureLambda ( GeneratedTextures . NormalMap , TEXT ( " _Normal " ) , FTexture2DBuilder : : ETextureType : : NormalMap , Options . NormalTexParamName ) ;
}
if ( ( Options . bBakeRoughness | | Options . bBakeMetallic | | Options . bBakeSpecular ) & & Options . bUsePackedMRS & & GeneratedTextures . PackedMRSMap )
{
WriteTextureLambda ( GeneratedTextures . PackedMRSMap , TEXT ( " _PackedMRS " ) , FTexture2DBuilder : : ETextureType : : ColorLinear , Options . PackedMRSTexParamName ) ;
}
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
if ( Options . bBakeRoughness & & GeneratedTextures . RoughnessMap )
{
WriteTextureLambda ( GeneratedTextures . RoughnessMap , TEXT ( " _Roughness " ) , FTexture2DBuilder : : ETextureType : : Roughness , Options . RoughnessTexParamName ) ;
}
if ( Options . bBakeMetallic & & GeneratedTextures . MetallicMap )
{
WriteTextureLambda ( GeneratedTextures . MetallicMap , TEXT ( " _Metallic " ) , FTexture2DBuilder : : ETextureType : : Metallic , Options . MetallicTexParamName ) ;
}
if ( Options . bBakeSpecular & & GeneratedTextures . SpecularMap )
{
WriteTextureLambda ( GeneratedTextures . SpecularMap , TEXT ( " _Specular " ) , FTexture2DBuilder : : ETextureType : : Specular , Options . SpecularTexParamName ) ;
}
2021-05-26 03:37:14 -04:00
2021-04-29 18:12:32 -04:00
// force material update now that we have updated texture parameters
// (does this do that? Let calling code do it?)
NewMaterial - > PostEditChange ( ) ;
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
EmitGeneratedMeshAsset ( Actors , Options , ResultsOut , & FinalMesh , NewMaterial , WriteDebugMesh ) ;
2021-04-29 18:12:32 -04:00
ResultsOut . ResultCode = EResultCode : : Success ;
}
UStaticMesh * FApproximateActorsImpl : : EmitGeneratedMeshAsset (
const TArray < AActor * > & Actors ,
const FOptions & Options ,
FResults & ResultsOut ,
FDynamicMesh3 * FinalMesh ,
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
UMaterialInterface * Material ,
FDynamicMesh3 * DebugMesh )
2021-04-29 18:12:32 -04:00
{
FStaticMeshAssetOptions MeshAssetOptions ;
2021-05-20 19:35:43 -04:00
MeshAssetOptions . CollisionType = ECollisionTraceFlag : : CTF_UseSimpleAsComplex ;
MeshAssetOptions . bEnableRecomputeTangents = false ;
2021-04-29 18:12:32 -04:00
MeshAssetOptions . NewAssetPath = Options . BasePackagePath ;
MeshAssetOptions . SourceMeshes . DynamicMeshes . Add ( FinalMesh ) ;
2021-05-28 02:46:59 -04:00
MeshAssetOptions . bGenerateNaniteEnabledMesh = Options . bGenerateNaniteEnabledMesh ;
MeshAssetOptions . NaniteProxyTrianglePercent = Options . NaniteProxyTrianglePercent ;
2021-06-02 16:08:31 -04:00
MeshAssetOptions . bSupportRayTracing = Options . bSupportRayTracing ;
MeshAssetOptions . bAllowDistanceField = Options . bAllowDistanceField ;
MeshAssetOptions . bGenerateLightmapUVs = Options . bGenerateLightmapUVs ;
MeshAssetOptions . bCreatePhysicsBody = Options . bCreatePhysicsBody ;
2021-04-29 18:12:32 -04:00
if ( Material )
{
MeshAssetOptions . AssetMaterials . Add ( Material ) ;
}
FStaticMeshResults MeshAssetOutputs ;
ECreateStaticMeshResult ResultCode = UE : : AssetUtils : : CreateStaticMeshAsset ( MeshAssetOptions , MeshAssetOutputs ) ;
ensure ( ResultCode = = ECreateStaticMeshResult : : Ok ) ;
ResultsOut . NewMeshAssets . Add ( MeshAssetOutputs . StaticMesh ) ;
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
if ( DebugMesh ! = nullptr )
{
2021-05-28 02:46:59 -04:00
FStaticMeshAssetOptions DebugMeshAssetOptions = MeshAssetOptions ;
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
DebugMeshAssetOptions . NewAssetPath = Options . BasePackagePath + TEXT ( " _DEBUG " ) ;
2021-05-28 02:46:59 -04:00
DebugMeshAssetOptions . SourceMeshes . DynamicMeshes . Reset ( 1 ) ;
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
DebugMeshAssetOptions . SourceMeshes . DynamicMeshes . Add ( DebugMesh ) ;
2021-05-28 02:46:59 -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
FStaticMeshResults DebugMeshAssetOutputs ;
UE : : AssetUtils : : CreateStaticMeshAsset ( DebugMeshAssetOptions , DebugMeshAssetOutputs ) ;
}
2021-04-29 18:12:32 -04:00
return MeshAssetOutputs . StaticMesh ;
}
# undef LOCTEXT_NAMESPACE