Saving output of material as new texture

Just curious if something like this was possible. Say you had character customization for your game, and you allowed colors to be changed. This was accomplished by adding a hue node in the material with a parameter set to it. Maybe there’s a bunch of other stuff being parametized as well. When it’s all said and done the character is created. But you don’t want to keep doing the calculation to get to that end result since the character is set in stone now. Is there some way to output the result of those calulations as a texture so it can be used later, without the overhead of calculating that texture over and over?

1 Like

I know it is possible by saving the variables trough code/blueprint… but how…
Beats me.

Just wanted to give you a heads up on saying its possible :slight_smile:

Yea you could save the parameter values in blueprints, but you would still need to apply them to the material to transform the texture, instead of saving the texture and using it after. Unless you meant another type of variable?

There is this tool if you want to give it a try: Render an Unwrapped Static Mesh Material to Textures | Unreal Engine Documentation

That’s what I was thinking of, but can something like that be done at runtime?

It can. This example renders a material to a canvas render target, then uses it as a texture parameter in a dynamic instance of another material, which is applied to a cube in the level. The material used in the RT is then moved back and forth along x and the RT is updated with each tick.

Create a new blueprint of class CanvasRenderTarget2D. Set it up like this:

Create a new material, add a texture parameter and name it(I called it CRTTex). Create an instance constant of the material.

In another blueprint(this happens to be the level blueprint) create a variable for your material instance constant. Set up your blueprint up like this.

Ah I see, thank you.

That’s interesting, but it doesn’t save output of material to a texture (to be used later), but just passes the texture target into a material, right? I’m looking for thing that is exactly what @Rael5 asked, I would like to save material output to a Texture (RenderTarget2D or regular Texture2D) - is it possible?

1 Like

Hi, I’m looking for the same. did you find any solutions?