TL;DR: Given a new, dynamic Texture 2D Object Reference, is there a way copy it to a shared texture/render target/media texture/other, so that multiple materials may all reference it and dynamically update when it changes?
Details
On my project we are streaming live videos using a custom network format. These video streams are used as textures for various materials. Currently, on BeginPlay
we create a Dynamic Material Instance for each object/material we want to update…
…and then on Tick
we have a custom C++ function that decodes the video frame and updates a Param2D texture on the instance with new texture data:
This setup works fine when you only want one material for each video stream. I’ve run into a situation where I actually want 5 distinct materials (not just instances, but base materials) to all be using one video stream as a texture.
Is there a way to create something like a Render Target
or Media Texture
(or any other 2D texture that can be dynamically changed), reference it in all 5 of my materials, and then in my Blueprint copy the information from the Texture 2D Object Reference returned by C++ into that texture, so that all 5 materials are using a synchronized video stream?