Common

Is it need to make Texture LODs?

UE4 automatically make mipmaps for your textures. If you import 1024 texture to engine it’s automatically creates 512,256,128,64,32,16,8,4,2,1 size textures from the original texture data. These are stored as mipmaps for original texture and it cost +33% more texture memory. When texture is sampled at material, pixel shader calculates what size mipmap it should sample. This automatic mipmapping prevents aliasing and saves a lot of texture memory bandwith. There is also texture streaming feature that only loads mipmap levels that are needed for object. If object is really far a way engine does not need to load the full size texture but small version of it. Let say 64x64 texture.

Original Text: Texture Size LODs
https://forums.unrealengine.com/development-discussion/rendering/1445698-texture-size-lods

UE4 Texture settings help (Mip Gen Settings, LOD Bias, Power of Two Mode)
https://polycount.com/discussion/200525/ue4-texture-settings-help-mip-gen-settings-lod-bias-power-of-two-mode

Comprehensive

Lifecycle of a Texture in Unreal Engine for Virtual Production

Texture Streaming

UE4 Texture Optimization Tutorial - How to use Mipmaps and Texture Streaming in Unreal Engine 4
https://www.youtube.com/watch?v=Tq1TSccLyiU

[TUTORIAL] Unreal Engine - How to optimize texture resolution
https://www.youtube.com/watch?v=p2YPcWETiG8

[UE4] Think about how to determine the Texture Streaming Pool Size
https://qiita.com/EGJ-Nori_Shinoyama/items/cc959d201ff011df872f

[UE4] About texture memory
https://qiita.com/com04/items/cea6da4949fc8774fcb8

[UE4] Impact of Texture Group on Texture Streaming
https://qiita.com/EGJ-Nori_Shinoyama/items/8b3c2e4e372f05e33476

Q: How to set Streaming PoolSize for starting up application?
A: Modify \Engine\Config\ConsoleVariables.ini, add r.Streaming.PoolSize=2000 under [Startup].
Reference:
https://answers.unrealengine.com/questions/343646/texture-streaming-pool-over.html
https://answers.unrealengine.com/questions/172853/how-do-i-increase-the-texture-pool.html

Q: What’s non-streaming texture?
A: Without respecting the power of 2 rule.
Reference:
https://answers.unrealengine.com/questions/574012/non-streaming-texture-over-4000-mb.html

Q: How to change streaming pool size?
A: Use the console command: r.Streaming.PoolSize 1500 or make the change permanent by editing your DefaultEngine.ini to include:

[/Script/Engine.RendererSettings]
r.Streaming.PoolSize=1500

Reference:
https://answers.unrealengine.com/questions/172853/view.html

Q: Disable Texture Streaming to improve performance and image quality?
A: Change your Engine.ini located in C:\Users\username\AppData\Local\Boltgun\Saved\Config\WindowsNoEditor to include these lines:

[SystemSettings]
r.TextureStreaming=0

or from your library page, right-click on Boltgun, select properties and add

-notexturestreaming

Origin:
https://steamcommunity.com/app/2005010/discussions/0/3843304884855583600/

Texture Compression

Your Guide To Texture Compression In Unreal Engine
https://www.techarthub.com/your-guide-to-texture-compression-in-unreal-engine/

Gamma Space vs Linear Space

Epic Games Texturing Guidelines
https://docs.unrealengine.com/udk/Three/TexturingGuidelines.html

SRGB: Whether Texture and its source are in SRGB Gamma color space.
https://docs.unrealengine.com/5.3/en-US/API/Runtime/Engine/Engine/UTexture/SRGB/

Parallax Occlusion Mapping

Bump Offset and Parallax Occlusion Mapping - UE4 Materials 101 - Episode 8
https://www.youtube.com/watch?v=wc0StMr3CQo

[UE4] Parallax Occlusion Tutorial
https://www.youtube.com/watch?v=4lF9H8JEQck

UE4 Parallax Occlusion Mapping Tutorial
https://www.artstation.com/artwork/XBnL3l

Parallax Occlusion Mapping
https://nerivec.github.io/old-ue4-wiki/pages/parallax-occlusion-mapping.html

Relief Mapping

RM-Methods adds many Methods of Relief Mapping beyond the actual POM shader on Unreal Engine. The plugin can generate an special Texture Map to use on the shaders.
https://www.unrealengine.com/marketplace/en-US/product/rm-methods

Detail Textures

Adding Detail Textures
https://docs.unrealengine.com/en-US/Engine/Rendering/Materials/HowTo/DetailTexturing/index.html

Mipmap

[UE4] How to make a custom Mipmap
https://qiita.com/EGJ-Osamu_Saito/items/a8c9015ecb3db3cc86db

Q: Why can’t modify Mip Gen Settings?
A: If you are not using a power of 2 texture you will get the NoMipmaps and will not be able to select any other options from the drop-down or adjust the LOD Bias.

Origin:
https://answers.unrealengine.com/questions/351241/impossible-to-change-mip-gen-settings.html

Editor Notes

How to set Texture Size

Texture Editor -> Compression -> Maximum Texture Size.
Default value 0 means the maximum size for the format on each platform.

How to leave the texture uncompressed

Compression Settings -> Vector Displacementmap (RGBA8).

Origin:
https://forums.unrealengine.com/t/how-do-i-disable-gamma-correction/279567

Texture Settings

Texture Support and Settings
https://docs.unrealengine.com/en-US/Engine/Content/Types/Textures/SupportAndSettings/index.html

Programming Notes

How to save Texture2D to image file (e.g. .jpg; .png) using C++

Use UImageWriteBlueprintLibrary::ExportToDisk, example: CompositingElementOutputs.cpp

Reference:
https://forums.unrealengine.com/development-discussion/c-gameplay-programming/76797-how-to-save-utexture2d-to-png-file

How to generate mipmap for dynamic Texture 2D

Solution:

UCanvasRenderTarget2D::bAutoGenerateMips = true;

No mipmap support for Dynamic Texture 2D https://answers.unrealengine.com/questions/424643/no-mipmap-support-for-dynamic-2d-texture.html

How to change LODBias at runtime

C++ code:

if(UTexture2D* Tex = GetTexture())
{
    Tex->LODBias = LODBias;
    Tex->UpdateCachedLODBias();
}

Cosole command:

r.mipmaplodbias 0
How to get list of textures from a material
virtual void UMaterialInterface::GetUsedTextures
(
    TArray< UTexture * > & OutTextures,
    EMaterialQualityLevel::Type QualityLevel,
    bool bAllQualityLevels,
    ERHIFeatureLevel::Type FeatureLevel,
    bool bAllFeatureLevels
) const

https://answers.unrealengine.com/questions/470467/get-list-of-textures-from-a-material.html?sort=oldest

How to list all the textures loaded in system memory (RAM)

Quoted from ImGuiMemoryDebugger.cpp:

// Find out how many primitive components reference a texture.
TMap<UTexture2D*, int32> TextureToUsageMap;
for (TObjectIterator<UPrimitiveComponent> It; It; ++It)
{
    UPrimitiveComponent* PrimitiveComponent = *It;

    // Use the existing texture streaming functionality to gather referenced textures. Worth noting
    // that GetStreamingTextureInfo doesn't check whether a texture is actually streamable or not
    // and is also implemented for skeletal meshes and such.
#if ENGINE_MAJOR_VERSION == 4
    ImGuiDebugToolsUtils::FStreamingTextureLevelContext LevelContext(EMaterialQualityLevel::Num, PrimitiveComponent);
#elif ENGINE_MAJOR_VERSION == 5
    FStreamingTextureLevelContext LevelContext(EMaterialQualityLevel::Num, PrimitiveComponent);
#endif
    TArray<FStreamingRenderAssetPrimitiveInfo> StreamingTextures;
    PrimitiveComponent->GetStreamingRenderAssetInfo((FStreamingTextureLevelContext&)LevelContext, StreamingTextures);

    //// Increase usage count for all referenced textures
    for (int32 TextureIndex = 0; TextureIndex < StreamingTextures.Num(); TextureIndex++)
    {
        UTexture2D* Texture = Cast<UTexture2D>(StreamingTextures[TextureIndex].RenderAsset);
        if (Texture)
        {
            // Initializes UsageCount to 0 if texture is not found.
            int32 UsageCount = TextureToUsageMap.FindRef(Texture);
            TextureToUsageMap.Add(Texture, UsageCount + 1);
        }
    }
}
Reference

Texture Streaming
https://docs.unrealengine.com/en-us/Engine/Content/Types/Textures/Streaming

Texture Streaming Configuration
https://docs.unrealengine.com/en-US/Engine/Content/Types/Textures/Streaming/Config/index.html

Virtual Texturing | Live from HQ | Inside Unreal
https://www.youtube.com/watch?v=fhoZ2qMAfa4

The Render to Texture Blueprint is a tool that has several different texture baking functions built in. It makes use of the editor’s ability to save high resolution screenshots including visualization buffers such as base color and world normal.
https://docs.unrealengine.com/4.27/en-US/RenderingAndGraphics/RenderToTextureTools/

Texture Properties. Reference for the properties and settings for texture assets.
https://docs.unrealengine.com/4.27/en-US/RenderingAndGraphics/Textures/Properties/

Textures. Image assets used in Materials to apply to surfaces or drawn on-screen by the HUD.
https://docs.unrealengine.com/4.27/en-US/RenderingAndGraphics/Textures/

UE4纹理技术及相关命令 (Recommended)
https://www.cnblogs.com/kekec/p/11548506.html

Plugins & Tools

Load Texture

Runtime Image Loader, Load images into Unreal at runtime without hitches
https://www.unrealengine.com/marketplace/en-US/product/runtime-image-loader


极度渴望成功的人并不多,愿付非凡代价的人更少。----美团王兴