Create texture at runtime

I am looking into a way to create a texture at runtime, for example when player clicks on a “SAVE OUTFIT” button in the UI, and compress the created texture using DXT1.

Is there a built-in way to achieve this, and if not, can someone point me in the right direction?

Thanks for your time guys!

Hi Stephane,

There’s a pretty good example of generally doing dynamic textures at runtime here: A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums (both one-shots and things updated from code every frame). If you want to render 3d geometry to a texture then you want to use a scene capture actor + render target texture instead (there’s an example in content examples: Content Examples Sample Project for Unreal Engine | Unreal Engine 5.1 Documentation and also I think in the Blueprint Example sample with the butterflies, used for the security camera).

However, in either case there is no support for doing DXT compression at runtime. Currently that code is only in the editor. The best place to start looking is FTextureFormatDXT if you want to reuse the existing DXT compression code, though it’d involve moving that code into a runtime module and create a dependency on Nvidia Texture Tools.

Cheers,
Michael Noland

Michael, thanks a lot for the info, I’ll look into what you suggested.