Material changes depending on the camera distance

I created a material with a World Position Offset setting, and I want to inactivate this setting depending how far the camera is.
Maybe with the CameraPositionWS function, but I can’t find any tutorials for how to use it.
Any suggestions?

Thanks. :slight_smile:

This may help you along the path Go Here in the UE4 Documentation, and then scroll down to Distance Based Detail Texturing. It should help you figure out how to make a material that’ll change in the distance.

A big thanks my princess, it’s working. :slight_smile:

Yeah thanks princess.

There’s a node called Camera Depth Fade that you can use to drive the alpha value of a Lerp node and then blend between your two results. In your specific case wanting to disable the WPO after X distance; you would plug your WPO nodes into A of the Lerp and 0 into B of the Lerp and then use the CameraDepthFade (Length controls the distance away from the object) to drive the change, essentially turning off the WPO when the camera reaches it’s length away from the actor.

CameraDepthFade

2 Likes

Exactly what I needed for stopping wind foliage depending on distance. Thanks!

1 Like