- Home /
Fog centered on Vector3
Does anyone know a way to make a shader that fog things off based on the distance to a Vector3? like Vector3.zero? I'm really stuck with my project and need a solution for this. I tried with a spot light centered on my player character but it doesn't give the result i hope to achieve.
Thank you very much
Answer by MarkD · Aug 04, 2014 at 02:39 PM
I don't know much about shader code, but it sounds to me that you want to write a script that gets the transform position of an object and then feed that position into a shader that renders fog based on a depth map.
The depth map will increase the fog closer to the object and fade out the fog further away from the object.
This is only how to approach it though, like said before, I do not know much about shader coding itself :). Try googling around looking for fog shaders (probably an image effect) and see if you can tweak around to get your needs.
Your answer
![](https://koobas.hobune.stream/wayback/20220613155804im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Setting up a simple depth-based Shader Replacement material? 0 Answers
Setting fog color on alpha blended to be fog color 1 Answer
How i can create vertical Fog by Shader Graph 0 Answers
Trying to have sprites affected by fog without having to use default/diffuse shader. 3 Answers
PostProcess shader - Generate plane perpendicular to World XZ 0 Answers