x

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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Get Texture2D from material.

Hi

I am currently trying to create an object where if I click on another object, it gets the object's material, then gets the texture from that material, and applies that texture to a texture param within it's own material.

So for example, there is a wooden wall, the player is carrying a ball that looks like concrete, the player clicks the wall, and the ball changes it's appearance to look like wood.

I have tried a bunch of different ways to make this work, but so far, am unable to do so within blueprints. Does anybody have an ideas?

Product Version: UE 4.9
Tags:
more ▼

asked Nov 09 '15 at 05:22 AM in Blueprint Scripting

avatar image

Otreum
239 18 26 38

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

1 answer: sort voted first

I have a habit of solving my own problems moments after asking for help. :P

What I had to do was make sure that the object that I am getting the texture from, has a "Material Instance Dynamic" variable (I called it "MatInst") I also needed to make sure there was a TextureSampleParameter2D node inside of the material, which I called "SurfaceTexture".

Then when I clicked the object, inside of the ball object blueprint, I cast to the object in question (in this case, a "WoodenWall" object), I then got the "MatInst" variable, dragged off a "GetTextureParameterValue" node with the parameter name field set to "SurfaceTexture". Inside of the ball blueprint, is another dynamic material instance called "BallMat", which I also have a TextureSampleParameter2D inside of called "BallTexture". I then get the texture out of the GetTextureParameterValue node and set the Texture Parameter for the BallMat to the SurfaceTexture we just exposed.

I am kind of a bit drunk, so this may not make too much sense. I hope it helps someone anyway :)

more ▼

answered Nov 09 '15 at 06:22 AM

avatar image

Otreum
239 18 26 38

avatar image Malloc007 Sep 20 '16 at 06:20 AM

That‘s so humor

(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