Ultra-Violet Light - Decal Material Question

Hello everyone, I am trying to create a sort of Ultra-Violet light material. The idea is that the player has a uv flashlight and can shine it on decals to make them shine and be visible when they would otherwise be very dull/invisible. I am not sure on where to start with this particular problem, I am researching custom depth but my main idea is to alter opacity and emissive with a custom value (0-1), then go into the flashlight BP and add the custom values there based off the spotlights cone, so when it shines over one of those decals it becomes visible and glows.

Is that line of reasoning going in the correct direction or is there a better way of doing it and/or something that I’m missing entirely?

Thank you all for the help!

I love your idea and solution. I have spent quite a bit of time working with shaders, and I would take the same approach as you explained above. Create the decals / materials, and make the scalar / floats into parameters multiplied with the texture you end up using. In the blueprint create a dynamic material and basically increase the scalar parameter value when you shine over the material with the flash light.

Thanks!

The issue currently is I am not entirely sure what nodes to use in order to get there, if you have any advice that would be wonderful. I know I have to set set dynamic material instance in the construction script, so I made a blueprint for this special decal and put it in that construction script, on the flashlight I added a cone geo shape and made it fit the cone of the light attenuation and named it UVLightCone_Comp, and I made a parameter in the special material that is attached to said blueprint, that has a custom param node that is multiplied with the emissive and opacity min value is .01 and max value is 1, now I am not quite too sure of where to go from here. Any advice is much appreciated! Thank you so much! :slight_smile:


Bump

Can anyone show an example of how this might work?

I kinda got it half working, still a ways to go on this effect but its coming along.

Its just too harsh and changing the Hardness on the sphere mask doesn’t seem to add any falloff to the sphere trace

You mean something like this?:

Problem with this method: decals don’t work, but you can take a plane and place your “decal” on it with this material. Maybe there are better methods, but with this you have a starting point(?).

Nope, not my idea, posted by these guys:

UE426_UVLight.zip (1.2 MB)

UE5_UVLight.zip (837.4 KB)

This might not be super helpful as it is a mere suggestion, but you should be able to set the decals you want to be affected by the light to a stencil, which is passed in a post process volume. This in turn will allow you to use the spotlight to shine on a single decal and have it affected by the light.

One of my shader is built with a “generated” spotlight: Elias Wick | Spotlight using a similar method as mentioned by L1z4rD89.

You can map the effects to the screen and affect what you see that way using the masks given. For instance this method I used here is similar and could be used in a similar fashion: Elias Wick | Area