In the last tutorial, we saw how to add fog to your Unity scene. But in the case of URP, you don’t have a volumetric fog option. We can overcome this using a custom fog made with the particle system.
Create a new material called Fog in the project window.
Set the material properties as shown in the image below. Set the alpha value of the base map to 40.
Add a particle system to your scene by clicking Add>Effects>Particle System.
Now go to the inspector window and set the following properties for your particle system
- Duration to 1000
- Check looping and Prewarm to true.
- Start lifetime to at least 30 seconds.
- Click the down arrow near start speed and select “Random between two constants”.
- Set the value from 0.1 to 0.2.
- Check 3D start size and give 5 as the value for all axis.
- Go to the shape settings.
- Set the shape as a sphere.
- Radius based on your fog size. It’s set to 1 in the demo.
- Go to color over lifetime and set the alpha to 0 at the beginning and end.
- Create a new point in the center and set alpha to max.
- This will have a transparent effect.
- That’s it, you’re for is ready for deployment.
Play around the settings to customize it more.