How to Change Material Texture with Texture2D Loaded from file?

On your blueprint you need to set the name of the texture parameter you are changing. At least on the image you’ve posted the texture says None. On the SetTextureParameterValue node you need to write the name TextureToModify, which is the way it is exposed to your blueprints.

I’m pretty sure thats the issue, but if that fails try using a Texture Object parameter instead on your material, but always remember to set the name you’ve given to your parameter in the material in the node when you are calling the setter in blueprints.

Maybe this is more complicated in reality than it is in my head… To me, however, this seems like a really simple thing to do and I’m missing something obvious!

My problem in a nutshell is as follows:

  1. I have a sphere object in an empty world. The user can control this object via Widget buttons and move it around the world from a top-down viewpoint (like an editor).
  2. Once they have positioned the sphere where they want it to go, a dialogue box appears and asks them to enter a file path (such as the one in the first image below) to the image that they would like to load.
  3. When they input the path, Rama’s blueprint loads the file as Texture2D.
  4. I then use this to change the material of the sphere:

From the several other related answers etc. I’ve viewed, I saw that I need to create a material which takes a texture parameter which I’ve done:

But as you can see below, it doesn’t work:

250769-newtexturefailed.png

Cheers.

Edit 1 - Grammar.

Good thinking but unfortunately it’s not the name :frowning:

In regards to the second part, how would I go about linking up the Texture Object Parameter to the SphereMaterial? I’ve not really worked with Materials before so apologies in advance if it’s obvious!

Okay, I’ve spent 5 days on this looking into command line asset loading and other crazy workarounds but finally it works!! We were both right - the solution was extremely easy and the name needed to be set to “TextureToModify”.

Aside from that, I used the new “Import File as Texture 2D” blueprint function to get the texture instead of the Victory plugin, like so:

I’m so relieved that I can’t put it into words. Thank you @Bariudol!

I’d also like to tag @manuaganu as I know you’ve been looking for the same solution (from all the Googling I had done, your name popped up a lot!)

1 Like

Hi @preadspread, Would you mind to create the tutorial of this and how you could success on this blueprint ? Please help. Thanks.

How does the material look? I’ve been doing something similar, but no mip maps are generated and there’s a strong moiree effect - the material doesn’t look smooth at all.

How does the material look? I’ve been doing something similar, but no mip maps are generated and there’s a strong moiree effect - the material doesn’t look smooth at all.