Ultraviolet-like light sensetive material

I was thinking of good puzzles for my current project and started wondering about materials that react to light. My current idea is something that has a limit on how much light it can receive.
Here’s a simplistic mockup to show what I roughly mean:
ezgif-3-5df44c5269

Hey, thank you for the demonstration, it really helps when it comes to mechanics like these.

This can be done in a variety of ways, but each approach would be different based on a few factors. For instance, how many decals will you have in the game that can be viewed by the light? Will meshes need to be uncovered as well or is it only decals?

1 Like

Thanks for the reply! my current idea is to have a randomized padlock code that you can find on walls in this way, so I’d have 10 decals (0 to 9) placed far away from each other. I think having only decal be uncovered will be enough.
When it comes to solutions, the easiest one is going to probably be the best in my case, as I’m usually a code guy who’s forced to do graphics and I only have a very basic knowledge of material editor, so I’d greatly appreciate making any explanation very trough for me :sweat_smile:

Hey @V_vix

You could have a look here:

In this thread you can read my post and the one from EliasWick

The very first thing that comes to mind is to use a material parameter collection and pass a position and radius of an imaginary sphere. Your blueprint will trace where the light would hit and the distance from the player and feed that data to the MPC. There is a node called a sphere mask in the material which you can pass the hit position to, and both the radius and strength of the effect can be determined by the distance from the player. The sphere mask will act as an alpha. Inside the mask glows using the emissive channel, outside the mask doesn’t.

Just toss decals/meshes into a specific stencil pass and render them in/out with a post process.

Post processes can be localized to an area, so you could describe the cone of a flashlight as the area for a postprocess that simply highlights what it needs to based on very simple logic.

If decals for whatever reason won’t work (as in they can’t be assinged a stencil or similar - I never tried it on a decal) then using dedicated/instanced mesh makes even more sense for this purpose.

A mesh can be excluded from rendering alltogether and manually enabled by the logic of the overlapping cone. On top of just being able to assign it to a stencil and just toggle the post process to make it visible/not visible with the stencil system.

Note: using a mesh and toggling it on/off probably costs a whole lot less than a post process, as you are only adding a few drawcalls to the interested area described by the flashlight cone…