UTexture2DDynamic for runtime texture

I’ve been trying to find a 4.6 compatible example for updating a texture at runtime every frame - similar to a movie playback, but sufficiently different (not codec based, for example). Can anyone provide direction or examples? I’m looking for the fastest method and am assuming UTexture2DDynamic is what I’m looking for - if not then what is the purpose of UTexture2DDynamic?

I’ve seen references to https://wiki.unrealengine.com/Dynamic_Textures, but have also seen comments that it should not be used for updating every frame.

Ultimately what I would like to do is create a plugin that defines a blueprint texture node that can be linked into a material that can then be linked to a mesh - that sort of thing. I found this pdf which appears to be a great explanation of what I assume I’ll need, but it has snippets that are currently above my ability to compile into something coherent - I’m a UE4 noob.

In MediaTextureResource.cpp look at the function UpdateDeferredResource. They do like this:

uint32 Stride = 0;

FRHITexture2D* Texture2D = TextureRHI->GetTexture2D();

uint8* TextureBuffer = (uint8*)RHILockTexture2D(Texture2D, 0, RLM_WriteOnly, Stride, false);

FMemory::Memcpy(TextureBuffer, CurrentFrame->GetData(), CurrentFrame->Num());

RHIUnlockTexture2D(Texture2D, 0, false);

But this is too slow when your textures becomes big, like HD or 4K. So I do like this:

FRHITexture2D* Texture2D = TextureRHI->GetTexture2D();

RHIUpdateTexture2D(Texture2D, 0, m_regions[0], m_Dimensions.X * 4, CurrentFrame->GetData());

In short, I replace the lock/copy/unlock with RHIUpdateTexture2D.

I ended up integrating directly into the MediaPlayer system with my own plugin that was frankenstein’d off the wmf player. Really wish there were more tutorials - especially for expanding currently available plugins. Not even sure if I’m doing it proper, but I was able to get it to work. I’m still working on optimizations (both from my texture creation as well as the MediaPlayer’s rendering).