How To Mask Light Function When Above Certain Height?

Hello! I am using a light function to create an underwater caustics effect. I like how it looks to see the caustics from above the water line as well, but my issue is that the light function affects everything above the water line as well. If I can’t figure this out, then I will just have to disable the light while above the water, but I am hoping there is some way to mask the light function in such a way that it is only visible below a certain z-level which I can control through a material instance.

1 Like

Create an actor.
Have the actor control the light function.
Set a value of the z of actor on begin play.

Attach the actor to the player.

Get where it’s going?

1 Like

I am pretty new to using Light Functions, so I am not sure how to make the light function controlled by an actor. I thought they could only be attached to lights.

You don’t even need to do any blueprint stuff for this, unless your water plane changes height. Just mask the light function by the world height. You can manually input the Z location value of your water plane to cut off the caustics at that exact height(or offset it, soften the transition, etc.)


1 Like

That works well! Thanks a lot!