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"

Change parameter of material in level blueprint

I want to change the parameter 'MyColor' of material 'ColorParam' in Level Blueprint to a random value every time i press '2'.

I can do this as a Blueprint actor with a mesh (Cube) defined as the input target in the construction script, like this (the Print Sting is just for debugging):

alt text

and

alt text

I want to get rid of the mesh connection and instead change the parameter of the material itself. Is that possible in any way?

Product Version: UE 4.9
Tags:
event.png (149.1 kB)
more ▼

asked Sep 17 '15 at 12:41 PM in Blueprint Scripting

avatar image

Alltvin
406 9 7 27

avatar image Stupet Sep 17 '15 at 12:52 PM

I have the same problem!

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Hi!

This is rough example, but i think this works the way you want.

This is Construction Script in Cube actor

alt text

This is Level Blueprint.

After press "R", BP get all actors in a scene and try to change Color parameter in material. If actor have material with Color parameter, then color will changed.

alt text

Result

alt text

randcolor01.png (281.1 kB)
randcolor02.png (251.3 kB)
color.gif (3.8 MB)
more ▼

answered Sep 17 '15 at 02:26 PM

avatar image

svv3dUDN
8.4k 254 37 396

(comments are locked)
10|2000 characters needed characters left

Hello Alltvin!

In my product IwTransit, I do it this way.

This example is for changing the color, to alter other values, check the "type" that is needed in the material, and adjust as required, but the Name is absolutely required. I have not found a way to query a material, and get all the parameters it supports, and then get all the "types" that it is. Such that I could say, I want all parameters, and of those, which is the parameter for the color?

  1. I use a material inteface (Just allows more "Material types" to be used.

  2. You will need to know the name of the parameter and type, in the material you wish to alter

  3. Create a Dynamic Material Instance (that's the name of the node as well)

  4. Using node, Set Parameter Value, Feed in a. Dynamic Material Instance b. The name of the parameter that you wish to change c. The value that you wish to change it too.

  5. your done, kind of

Don't forget to set the new Material Instance to the static mesh, skeleton, whatever. For primitive components, the node is Set Material.

Hope this helps.

Jay Ice

IceWare

more ▼

answered Sep 17 '15 at 01:47 PM

avatar image

jayice
1.4k 41 28 56

(comments are locked)
10|2000 characters needed characters left
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