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"

Show hidden "message-icon" when specific light color hits mesh surface

In short I want a material that will be on a wall that has a text that doesn't appear until you hit the wall with a specific light. For example your character can hold a green,a red and a yellow flashlight and only when you aim at the wall with the red one the text will appear otherwise nothing shows up. Is that possible to achieve and if so how easy is it to make that material?

Product Version: UE 4.10
Tags:
more ▼

asked Jan 08 '16 at 08:38 AM in Everything Else

avatar image

MuFeR
41 5 9 8

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

1 answer: sort voted first

I'd make it simpler and have all the materials that need such functionality use Material Parameter Collection in which you have an int 'current flashlight'. Set that value in the MPC through code or blueprint when changing the flashlight.

Then in the material, normally react to light (make the text on normalmap or spec) but check for that int whether it matches what you need. Use lerp or switch, both would work. MPC is quite well documented, you should be able to get it up and running quickly.

more ▼

answered Jan 08 '16 at 03:37 PM

avatar image

vipeout
369 13 10 25

avatar image MuFeR Jan 08 '16 at 04:34 PM

It sounds simple enough but for some reason I can't seem to make it work, could you post an example image of what it should look like inside the material for just a random solid color and the text in specular? I'm almost sure if I do something wrong that it's on the lerp/switch part.

avatar image vipeout Jan 11 '16 at 07:52 AM

Yes I can. Here you go:

The material: alt text

If A (CurrentFlashlightColor, taken from MPC) equals B (hard typed value, you may want to make this a parameter so you'll have 3 material instances which you can use, depending on what kind of light given mesh requires) then it will fire the A=+B input to the output pin. Otherwise it will feed the normal one.

I haven't tested it, so I've no idea how it will look. It also requires 2 normal maps instead of one (or spec, if that's what you'll end up using). Or both ;)

The BP (change flashlight):

alt text

Here you just add this node to the logic of flashlight. Depending which light you enable, set the variable appropriately so the material will know what it needs to.

unreal editor.jpg (109.0 kB)
node.jpg (23.4 kB)
avatar image MuFeR Jan 11 '16 at 01:07 PM

Weird this is exactly what I ended up doing on my own (adding a typed value of "1" on B as you mentioned), So I figured something was wrong with the text image, after trying few things I just saved the image in .psd instead of .png and without changing anything suddenly it worked...

avatar image MuFeR Jan 12 '16 at 12:21 PM

To add to this topic. With this method the text appears all the time if the value in the material matches the one in the MPC even if you don't look at the wall with the hidden text (pretty much acts as a visibility toggle for the text), so is there any way to make it so only if you look at the wall and have the flashlight on that the text will appear? The only solution I've found is to use an event tick and line trace to look for the wall but I'm not sure if that's good optimization wise.

avatar image vipeout Jan 12 '16 at 01:55 PM

I'd make that writing a decal instead of normal map on a wall. Then, add a volume component to your character and OnComponentBeginOverlap, check if it's decal, get it's material and either modify it's parameter in the MaterialInstanceDynamic, or create new one and replace with the one currently in decal. Even better, make a blueprint with decal as a parent, so you can even better filter out the ComponentOverlap events to not try to modify any other decals in the game. Or if it suits you better - a blueprint with decal component.

You would need to modify the material - add 1 more parameter working as on/off switch on top of the color. And check the flag to be used with decals.

It's pretty rough solution but relatively quick and easy to do. Also, you do not need to keep more textures for each object you want a writing on - you just add a decal and it will work on everything. The only texture you need is the writing itself.

(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