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 Multiple Material Textures Blueprint based on Health Total

Healthy to Dead Character Material Change

I have 2 materials assigned to my character (head/body), the materials are instances. The main global material used has two 2 textures for the base color, one for a healthy body and one for a damaged bloody body. I managed to create a blueprint that changes texture based on a float for health total. It works, however, not perfectly. It only changes the body or head textures to the damage texture. How can I edit the blueprint to make it change all textures to damage texture?

Product Version: UE 4.19
Tags:
more ▼

asked Jul 30 '18 at 12:52 PM in Rendering

avatar image

Oblivion2500
143 16 26 129

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

2 answers: sort voted first

I fixed it! What you have to do is create a private integer variable called "MaterialIndex". So since most of my characters have 2 materials (head/body), a few also have 3 or 4 materials as well. So if you want the blueprint construction script to check how many materials the mesh have first before swapping out the textures in the materials. (The global material got a lerp node with a parameter node that changes one texture to the other for the base color/roughness). Connect the "MaterialIndex" variable to a Make Array node, since most of the characters have 2 materials but some have 3 or 4, add 3 more pins to the Make Array node, if the mesh does not have a 3rd or 4th material, it will automatically return nothing (NULL) and ignore the 3rd or 4th pin. Connect the Make Array node to a ForEachLoop then connect the Script to the ForEachLoop to the Create Dynamic Material Instance. Compile and try sliding the DamageTotal (public variable float) from 0.0 to 1.0 and you will see all the textures being swapped out to the "dead/damaged" one. FIXED

more ▼

answered Jul 30 '18 at 06:15 PM

avatar image

Oblivion2500
143 16 26 129

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

Make two Dynamic Material Instances, one for each Element Index. It sounds like you have two (head and body) so do the same thing in your constructor but use the 2nd index for the other MDI.

more ▼

answered Jul 30 '18 at 04:02 PM

avatar image

mightyenigma
3.8k 18 20 20

avatar image Oblivion2500 Jul 30 '18 at 04:29 PM

Some of my characters have more than 2 materials. How can I set up an array that checks for the number of materials then changes them all to the damaged textures? This is what I got so far.

not working yet...

avatar image mightyenigma Jul 30 '18 at 04:47 PM

That I don't know how to do.

(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