Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to Change Material Texture with Texture2D Loaded from file?

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:

alt text

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:

alt text

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

alt text


Edit 1 - Grammar.

Product Version: UE 4.20
more ▼

asked Aug 17 '18 at 02:05 PM in Rendering

avatar image

36 1 2 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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. alt text

texturetomodify.jpg (159.2 kB)
more ▼

answered Aug 17 '18 at 02:18 PM

avatar image

974 22 13 29

avatar image predspread Aug 17 '18 at 02:30 PM

Good thinking but unfortunately it's not the name :(

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!

alt text

avatar image predspread Aug 20 '18 at 03:20 PM

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:

alt text

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!)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question