Download

Is it possible to make a 'hard copy' of a dynamic texture?

I’m wanting to use BLUI - the web page renderer - to generate multiple textures at runtime. My problem is in pulling the texture and making an unchanging copy of it for each texture - the only thing I can get is obviously a ref to the original rather than a copy. Any ideas?

Create a CanvasRenderTarget2D blueprint, add a Texture/Texture2D variable. In this blueprint, on EventRecieveUpdate call a DrawTexture node. Target the Canvas. MakeVector2D from Width and Height on the EventRecieveUpdate node and feed that into Screen Size. Feed the texture variable into Render Texture.

When you want to create a copy, in some other blueprint, CreateCanvasRenderTarget2D of the same class. GetSizeX and Y of the texture to be copied and feed that into the Width and Height of the created CanvasRenderTarget2D. CastToCanvasRenderTarget2D and set it’s texture variable to the texture to be copied. UpdateResource targeting the created CanvasRenderTarget2D. You can use the CanvasRenderTarget2D as a texture reference, and if you don’t update it further, it won’t change .

Thanks very much! I’ve been struggling with this for ages. I’ll give it a try later and let you know how it goes.

It works! Thanks so much for this - I thought i’d have to go into c++ land to do this. I’m hoping that a CanvasRenderTarget2D is only as resource heavy as a texture2d as long as you’re not updating it every frame (I’ll only be setting it once I think).

Thanks so much! It’s a breakthrough moment for my project.

Dan