Hey guys! I am working on a small project in which I want a player’s flashlight to be able to change what the player sees in-game. When the flashlight is on, the objects illuminated by the flashlight will change to a different material. Additionally, I would like to only change the material in the specific location where the light is hitting on the object… not the entire object. So almost like “looking through” the flashlight into a different version of my world. Would this be at all possible and if so, can anybody help me to figure this out? Thanks so much.
Its possible only with workarounds. For example:
Make trace from center of flashlight and in forward direction. Detect it if hits this specific object. Pass hit location to this object material.
In object material add sphere mask of some adjustable radius and location, and use it as opacity.
I saw a cool blog post on a similar trick. Take a look at this, it does require switching to forward rendering though. He is using shadows, but I imagine light in general would be the same method more or less, just slightly different line in the HLSL node
Could you possibly upload a screenshot of an example material blueprint? I am having no problems understanding the concept of this, I simply don’t understand how to use the hit location within the object material. Thanks for the help!
This is awesome! Thanks for the link. As for now I am attempting to stray away from forward rendering. I have no idea what I’m doing when I get into all of that.