Download

Render to texture question

What I am trying to do is have a list of materials in UMG. Then I click on one of them and they change on some specified meshes. I got all this working. What I can’t figure out is how to put a preview of the material into UMG. It needs to be automated. I assume that I cannot put the materials directly into UMG because they are multilayered and complex and based on multiple master materials.

What’s the best way to do this? After searching the web for a solutions the best I can come up with is this:

  • collect the materials in an array
  • send it to a simple render stage somewhere below the main area
  • render a texture from the material on a cube (for now) inside the render stage blueprint
  • put that texture in a dynamic material instance of a UMG material and send all of them back in an array.
  • apply them to the buttons in the UMG widget.

Everything works except one thing: I don’t know how to proper store the render result. Whatever I try all buttons always have the texture of the last rendered material on it. So obviously I am doing something wrong. Would be great if someone points me into the right direction. Or maybe there is a better way all together.

Thanks a lot.

Below are a few images with short comments.