Fog in Orthographic/GameObject Centered Fog

Ok so this is kind of a two-parter.

I am currently working on a 2.5D platformer. I have two layers of tilemaps that the player can switch between to navigate levels. The player can also switch from orthographic to perspective camera and vice versa. I wanted to set up a fog effect to make the scene feel more real. However, there are two things that I want the fog to do that it doesn’t:

  1. I want it to work in orthographic camera view
  2. I want to be able to make it center around the player not the camera (meaning, instead of the fog increasing with the distance from the camera, it increases with distance from the player.

The orthographic part is the main one as what happens currently is that there is no fog until you switch to perspective, then it snaps onto the background objects and just looks weird when it does. The second is less important, but I want to do it so that when the player moves to the background, the fog is cleared around him.

Are these possible with scripting or do ya’ll know of any assets in the store that will allow either or both of these?

I wouldn’t bother doing this as an image effect. Just set your character world position to a shader global and use that in your environment shaders to do the fog.

I’m not sure what you’re saying to do. I’m very inexperienced with the shader and effects side of unity (I’m a programmer more than anything). Could you explain what you mean? I’d really appreciate it

Go to the download archive and get the built in shaders.

Make copies of the shaders you’re using in your environment.

Modify them to lerp to your fog color based on the player’s position. Here’s an example of fog as a final color function in a surface shader.

Set the player’s position as a global shader property using the Shader api in a script.

Now it’ll work regardless of your camera type. That should be more than enough keywords to get you there.