FMaterialUtilities

Material utilities

Unreal Engine C++ API Reference > Developer > MaterialUtilities

Inheritance Hierarchy

References

   
Module MaterialUtilities
Header /Engine/Source/Developer/MaterialUtilities/Public/MaterialUtilities.h
Include #include "MaterialUtilities.h"

Syntax

class FMaterialUtilities : public [IModuleInterface](API\Runtime\Core\Modules\IModuleInterface)  

Remarks

Material utilities

Functions

Type Name Description
void AnalyzeMaterial ( UMaterialInterface* InMaterial, const TArray< EMaterialProperty >&..., int32& OutNumTexCoords, bool& OutRequiresVertexData )  
void AnalyzeMaterial ( UMaterialInterface* InMaterial, const FMaterialProxySettings& InMa..., int32& OutNumTexCoords, bool& OutRequiresVertexData ) Analyzes given material to determine how many texture coordinates and whether or not vertex colors are used within the material Graph
float ComputeRequiredTexelDensityFromDrawDistance ( const float InDrawDistance, float InWorldSpaceRadius ) Compute the required texel density needed to properly represent an object/objects covering the provided world space radius
float ComputeRequiredTexelDensityFromScreenSize ( const float InScreenSize, float InWorldSpaceRadius ) Compute the required texel density needed to properly represent an object/objects covering the provided world space radius
UMaterialIns... CreateFlattenMaterialInstance ( UPackage* InOuter, const FMaterialProxySettings& InMa..., UMaterialInterface* InBaseMate..., const FFlattenMaterial& FlattenMat..., const FString& AssetBasePath, const FString& AssetBaseName, TArray< UObject* >& OutAssets..., FMaterialUpdateContext* Materi... ) Creates a flatten material instance and the required texture assets
FFlattenMate... CreateFlattenMaterialWithSettings ( const FMaterialProxySettings& InMa... ) Creates a FFlattenMaterial instance with the given MaterialProxySettings data
UMaterialIns... CreateInstancedMaterial ( UMaterialInterface* BaseMateri..., UPackage* InOuter, const FString& BaseName, EObjectFlags Flags ) Creates an instanced material based of BaseMaterial
UMaterial &#... CreateMaterial ( const FFlattenMaterial& InFlattenM..., UPackage* InOuter, const FString& BaseName, EObjectFlags Flags, const FMaterialProxySettings& Mate..., TArray< UObject* >& OutGenera..., const TextureGroup& InTextureGroup ) Creates UMaterial object from a flatten material
UMaterialInt... CreateProxyMaterialAndTextures ( const FString& PackageName, const FString& AssetName, const FBakeOutput& BakeOutput, const FMeshData& MeshData, const FMaterialData& MaterialData, UMaterialOptions* Options ) Creates a proxy material and the required texture assets
UMaterialInt... CreateProxyMaterialAndTextures ( UPackage* OuterPackage, const FString& AssetName, const FBakeOutput& BakeOutput, const FMeshData& MeshData, const FMaterialData& MaterialData, UMaterialOptions* Options ) Creates a proxy material and the required texture assets
UTexture2D &... CreateTexture ( UPackage* Outer, const FString& AssetLongName, FIntPoint Size, const TArray< FColor >& Samples, const FCreateTexture2DParameters& ..., EObjectFlags Flags ) Generates a texture from an array of samples
UTexture2D &... CreateTexture ( UPackage* Outer, const FString& AssetLongName, FIntPoint Size, const TArray< FColor >& Samples, TextureCompressionSettings Compress..., TextureGroup LODGroup, EObjectFlags Flags, bool bSRGB, const FGuid& SourceGuidHash ) Generates a texture from an array of samples
void DetermineMaterialImportance ( const TArray< UMaterialInterface&#..., TArray< float >& OutImportance ) Calculates an importance value for the given set of materials according to the texture sampler usage
bool ExportBaseColor ( ULandscapeComponent* Landscape..., int32 TextureSize, TArray< FColor >& OutSamples ) Creates bakes textures for a ULandscapeComponent
bool ExportLandscapeMaterial ( const ALandscapeProxy* InLands..., const TSet< FPrimitiveComponentId >..., FFlattenMaterial& OutFlattenMateri... ) Flattens specified landscape material
bool ExportLandscapeMaterial ( const ALandscapeProxy* InLands..., FFlattenMaterial& OutFlattenMateri... ) Flattens specified landscape material
bool ExportMaterialUVDensities ( UMaterialInterface* InMaterial, EMaterialQualityLevel::Type Quality..., ERHIFeatureLevel::Type FeatureLevel, FExportErrorManager& OutErrors ) Get the material texcoord scales applied on each textures
FIntPoint FindMaxTextureSize ( UMaterialInterface* InMaterial..., FIntPoint MinimumSize ) End IModuleInterface implementation Iterate through all textures used by the material and return the maximum texture resolution used
void GeneratedBinnedTextureSquares ( const FVector2D DestinationSize, TArray< float >& InTexureWeights, TArray< FBox2D >& OutGeneratedBoxe... ) Generates a set of texture boxes according to the given weights and final atlas texture size
FString GetFlattenMaterialTextureName ( EFlattenMaterialProperties InProper..., UMaterialInterface* InBaseMate... ) Get the name of the Texture parameter associated with a given flatten material property
int32 GetTextureSizeFromTargetTexelDensity ( const UE::Geometry::FDynamicMesh3&..., float TargetTexelDensity ) Compute the required texture size to achieve a target texel density for the given mesh.
int32 GetTextureSizeFromTargetTexelDensity ( const FMeshDescription& InMesh, float InTargetTexelDensity ) Compute the required texture size to achieve a target texel density for the given mesh.
int32 GetTextureSizeFromTargetTexelDensity ( double InMesh3DArea, double InMeshUVArea, double InTargetTexelDensity ) Compute the required texture size to achieve a target texel density, given the world to UV space ratio.
bool IsValidFlattenMaterial ( const UMaterialInterface* InBa... ) Validate that the provided material has all the required parameters needed to be considered a flattening material
void OptimizeFlattenMaterial ( FFlattenMaterial& InFlattenMateria... ) Tries to optimize the flatten material's data by picking out constant values for the various properties
void OptimizeSampleArray ( TArray< FColor >& InSamples, FIntPoint& InSampleSize ) Tries to optimize the sample array (will set to const value if all samples are equal)
void RemapUniqueMaterialIndices ( const TArray< struct FSectionInfo >..., const TArray< struct FRawMeshExt > ..., const TMap< FIntPoint, TArray< int3..., const FMaterialProxySettings& InMa..., const bool bBakeVertexData, const bool bMergeMaterials, TArray< bool >& OutMeshShouldBakeV..., TMap< FIntPoint, TArray< int32 > > ..., TArray< struct FSectionInfo >& Out... ) Remaps material indices where possible to reduce the number of materials required for creating a proxy material
void ResizeFlattenMaterial ( FFlattenMaterial& InFlattenMateria..., const FMeshProxySettings& InMeshPr... ) Resizes flatten material's data if applicable by comparing it with the original settings

Overridden from IModuleInterface

Type Name Description
void ShutdownModule () Called before the module is unloaded, right before the module object is destroyed.
void StartupModule () Begin IModuleInterface implementation

Classes

Type Name Description
Public class FExportErrorManager Contains errors generated when exporting material texcoord scales.

Constants

Name Description
CurrentlyRendering Flag to indicate whether or not a texture is currently being rendered out
RenderTargetPool Pool of available render targets, cached for re-using on consecutive property rendering

Deprecated Functions

Type Name Description
bool SupportsExport ( EBlendMode InBlendMode, EMaterialProperty InMaterialPropert... ) Use SupportsExport(bool bIsOpaque, ...) function instead
bool SupportsExport ( bool bIsOpaque, EMaterialProperty InMaterialPropert... ) Use SupportsExport(bool bIsOpaque, ...) function instead

Ask questions and help your peers Developer Forums

Write your own tutorials or read those from others Learning Library