|
| 1 | + |
| 2 | + |
| 3 | +# Simple Height Fog Effect |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +A shader effect that simulates height fog on a plane mesh. It was created for Serious Point Games as part of my studies in shader development. It was created for Unity 6 URP (6000.0.27f1) |
| 10 | +but it can work in other unity versions (like Unity 2022 or Unity 2019) and other pipelines (like Built-In). |
| 11 | + |
| 12 | + |
| 13 | +It comes in two variants, one being a simple height fog (using Unity’s built in particle unlit shader which can be |
| 14 | +used to re-create a height fog) and a custom two color height fog. |
| 15 | + |
| 16 | +You can refer to the effect's documentation for more info (should be in the repo and its release as a PDF file). |
| 17 | + |
| 18 | +## Features |
| 19 | +- Simulate height fog in areas only covered by the plane mesh, saving resources unlike the post processing approach |
| 20 | +- Can add a noise texture to the fog, using a custom noise texture (2 Color Fog shader) |
| 21 | +- Can also animate the noise texture within the fog (2 Color Fog shader) |
| 22 | +- Customizable fog color & parameters |
| 23 | + |
| 24 | +## Example[s] |
| 25 | + |
| 26 | +What the simple height fog eff ect looks like with the effect on. |
| 27 | +<br> |
| 28 | + |
| 29 | +<br> |
| 30 | +What the two color height fog eff ect looks like with the eff ect on, the red and off -white color is just used for demonstration purposes only to make the fog more apparent. |
| 31 | + |
| 32 | +## Installation |
| 33 | +1. Clone repo or download the folder and load it into an unity project. |
| 34 | +2. Drag the material onto a plane gameobject/mesh that you want to apply the eff ect on, or go to the object’s inspector panel and change its material to the material with the 2 color height fog shader. |
| 35 | +3. [Optional] If you want to use the simple fog one like the one I implemented, create a new material, go to Universal Render Pipeline > Particles > Unlit, then enable soft particles and ensure the material’s |
| 36 | + surface type is on transparent instead of opaque. |
| 37 | +5. Optionally, you can use one of the prefabs by clicking and dragging one of the prefabs into the scene. |
| 38 | + a. You can scale the plane to make the height fog area bigger or smaller. |
| 39 | + |
| 40 | +## Credits/Assets used |
| 41 | +Some parts of the code is adapted from Unity Technologies's Particles Unlit code, which is found from https://github.com/Unity-Technologies/Graphics/blob/master/Packages/com.unity.render-pipelines.universal/ShaderLibrary/Particles.hlsl |
| 42 | +or in here, https://github.com/Unity-Technologies/Graphics/tree/master/Packages/com.unity.render-pipelines.universal within Shader or ShaderLibrary folder |
| 43 | + |
| 44 | +Some of the code is adapted from my other effects, like the Volumetric Spotlight Shader Graph and Gradient Fog Effect. |
| 45 | + |
| 46 | +The method used to create the simple height fog eff ect is from this Youtube video by Vanmillion Studios, https://www.youtube.com/watch?v=-s7_l3TXWPM. |
0 commit comments