Orthographic Camera Support
Locate and edit CommonsURP.hlsl file and uncomment this line:
#define ORTHO_SUPPORT
Fog of War
The fog of war feature uses a color texture to control the opacity of the fog on the world. It can be used to clear / add fog at any custom position. This feature is commonly used to show which areas of the world have been visited or are visible to the player.
-
World Center / Coverage: maps the fog of war texture to the world using this center and size.
-
Texture Size: the size of the fog of war texture. A big texture allows finer details but it can result in a slower operation.
-
Restore Delay / Duration: controls when the fog restores it original appearance. It can be used to allow the fog to disappear while the character is at certain position and gracefully restore the fog when character abandons the place. A delay of 0 means the fog won’t never be restored. A duration of 0 means immediate change (no transtition).
-
Border Smoothness: controls the smoothness of the border of clear areas.
-
Blur: produces a softer transition between clear and opaque fog areas.
Fog of War Editor
Enable the Fog of War Editor to interactively add, paint with color or remove fog in Scene View.
Click “Create new Mask Texture” to create the texture asset which will hold the opacity states of the fog of war.
The Brush Mode selects the paint/erase mode as well as Width, Fuzziness and Opacity allow you to customize the artistic result.
Transparency support
Customizing the rendering order
Each Dynamic Fog volume can have a different render queue setting, located in “Rendering Section”:
These settings allows you to control the rendering order.
Respecting other transparent objects
The fog effect relays on the depth buffer to compute ray marching distance. Since transparent objects do not render to depth buffer, it means the fog effect will always render on top of previously rendered objects, regardless of the space position, for example water, rivers and any other transparent objects located between the fog and the camera.
To avoid this issue, you should first try solving the issue by customizing the rendering order (see previous section).
Sub-Volumes
A sub-volume is a special area where you can assign a different fog profile and a fade distance. Fog appearance will transition to the new profile in this area when the controller enters it.
This is useful if you have a general fog preset that covers the entire gameplay area but you want the fog to change colors or appearance in certain rooms or zones.
To create a sub-volume in the scene, right click in the Hierarchy window as shown below:
Then, you the sub-volume will be created.
Change its position and scale to cover the desired area and assign a profile and a fade distance: