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"

What is the best way to temporarily overlay a mesh with another material?

Hi,

I'm looking to apply a quick white flash to a characters mesh when the character is damaged in a typical arcadey fashion, however the only way that I know this can be done is through sending a parameter to the material.

The issue is that I have lots of characters, each with lots of materials, yet I want this to be able to be applied to any of them without having to add parameter logic to every single material and control them independently, which would be horrible. This needs to be independent of the original mesh / materials of the character.

One other way that I can think of would be to duplicate the mesh, parent it to the original and somehow make sure all its bones match up, then apply a parameter-controller material to that mesh which extrudes very slightly causing it to draw in front of the original material. I think that would be much better than the first option, but still feels a bit odd, having two skeletons and all.

Is there any better way to do this?

Thanks

Product Version: UE 4.8
Tags:
more ▼

asked May 29 '15 at 01:53 PM in Using UE4

avatar image

Acren
455 45 49 69

avatar image Acren Aug 20 '15 at 11:33 AM

bumping this

avatar image rujuro Sep 07 '16 at 12:14 AM

Acren, Did you ever figure out the best way to do this?

avatar image Acren Sep 07 '16 at 05:42 AM

What I did was make a standard character material function that receives parameters for dynamic effects and add that to all character materials that need to be affected.

So one effect might be for the damage flash mentioned in the OP, another might be for being frozen and turned to ice.

Then whatever is controlling the effect uses an interface to get the dynamic material instances and sets the parameter for that specific effect.The material function within the materials gets the parameter data and can render material effects without each individual material having to worry about it.

Perhaps not ideal if you only need some effects on some characters because it will run shader logic for all of them, but in that case you can make separate material functions for each individual effect and another for each set of effects which contains the functions for the individual effects.

Another thing you might want to look into is the new mesh decals in 4.13 but I don't know too much about that.

avatar image Mesothere Sep 28 '16 at 10:57 PM

Would you mind expanding on this a little? I'm having the same issue. I have one mesh with many materials attached. I've created a function called "DamageTaken" which takes a single float as an input, and depending on the value will output either a white or transparent colour. I have attached this function to the "Emissive colour" node on every material in the mesh... but I cannot figure out how to call these functions from within C++ without arduously iterating over each material and changing the input parameter manually. What method did you take?

avatar image Acren Oct 01 '16 at 04:37 AM

Yeah, you are going to have to set the parameter on each material. In blueprint you can plug an array directly into "set parameter" node, but in C++ you might want to write a static function you can reuse for setting a parameter on an array of materials.

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

0 answers: sort voted first
Be the first one to answer this question
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