Welcome and thank you for purchasing Living Mud URP for the Unity Game Engine. Living Mud is a set of tools and effects to give your game environments realistic and reactive mud.
Download and import the Living Mud URP package using the Package Manager.
Dependencies:
If you do not have the Unity Visual Effects Graph package installed download and import that using the Package Manager.
Add the Unity Decal Render Feature by finding your URP Renderer (usually located in the Settings folder) and select “Add Render Feature.”
Lastly, if you do not have Text Mesh Essentials installed you will prompted when you open the demo scenes. TMP is only used for demo scene screen UI and not in the actual toolset.
Dynamic Mud Surfaces or DMS are a tool that allow GameObjects to visually affect a muddy surface based on its particular characteristics. A DMS is made up of a suitable model (usually a flat plane), a DynamicMudSurface.cs component, Collider, and DMS Material. The DMS will accept stamps to alter its surface by using a Custom Render Texture within your project.
Tip - Because the DMS effects are rendered via a Custom Render Texture it is important not to make one extremely large mud surface. Very large Custom Render Texture resolution impacts performance and stretching a texture over a very large surface reduces visual fidelity. Try to break large mud surfaces into separate sections by using environment elements.
Thickness - Describes the muddy quality of this surface to trigger different effects when GameObjects interact with the surface.
Bounding Box Size In Units - The largest dimension of this GameObject measured in units. This measurement is very important to align the stamp material pixels with the GameObject in world space.
Override Material Stamp Texture - The Custom Render Texture used for this surface will send references to stamps and materials interacting with it. (True by default)
Custom Render Texture - A reference to the Custom Render Texture this DMS uses for stamping. Create a Custom Render Texture in your project with the Unity “Create” Menu.
The DMS material uses a custom Unity Shader written in Shader Graph. This allows you to easily inspect how it works and modify it if you like. The Mud Surface Properties affect the appearance of the surface when it is undisturbed. An additional normal map option is included to allow for extra characteristics on the surface such as the Dirt Track example included in the package.
The Dynamic Mud Stamps properties affect the stamps that will change the DMS when objects interact with it.
Stamp Render Texture - A reference to the Custom Render Texture this DMS uses. If the Override Material Stamp Texture is enabled in the DMS component the reference will be supplied automatically.
Flip UV - Rotates the UV space by 180 degrees. This is useful if the model used for the DMS is not facing the positive Z direction.
Stamp Normal Strength - The intensity of the normal map applied by stamps.
Stamp Darken - Lowers the value of the surface albedo where stamps are placed. This is useful in making the stamped areas look more wet.
UV Channel - Choose between UV channel 0 or 1 for the stamped surface. The Custom Render Texture relies on a 0 to 1 top projected UV space. If your DMS model needs to use a different UV space such as the Dirt Track model with wheel marks orbiting around the track you can use this option to project stamps on a different UV channel.
DMS models must have a scale of 1.0
DMS origins must align with UV space (0.5,0.5) It is best to keep the origin at the center of the model and use top down projection to set the UVs of the model.
Try to use DMS scales around 20 meters with a Custom Render Texture Resolution set to 2048 for high quality stamp fidelity.
The Custom Render Texture used for the DMS must have the Double Buffered option enabled and be set to OnDemand updating. Any material which uses the LivingMud/StampToTexture shader will work in the material property.
Living Mud does not work directly with Unity Terrain because the fidelity of the texture space would be compromised. Living Mud does work great with terrain by incorporating DMS models into a terrain. The included Mud Pit example uses a terrain with a lowered section and a DMS surface together. For extra visual impact you can utilize the same mud texture in your terrain to blend the mud with other terrain layers.
Living Mud Stamps are made up of a MudStamp.cs component, stamp texture, and stamp material. New stamps can be easily created in the Unity “Create” menu by selecting your custom stamp texture and clicking “Create/Living Mud/Stamp” this will move the texture into a folder of the same name and create a prefab, material, and preview material.
Stamp Textures are a specially formatted texture which apply to a DMS to change its appearance. Stamps appear like a Normal Map with a transparent Alpha channel but they MUST NOT be set as a “Normal map” in the Unity Import Settings. Additionally “Alpha as Transparency” must be set to true for a stamp. Stamps should not contain any visible pixels along their outer boundary as these will be projected across the entire DMS surface. Several stamp textures are included with the package.
Living Mud URP comes with several foundational effects that can be stacked together to create more complex interactions with Dynamic Mud Surfaces. These effects can be split into three categories.
Splashes - Fully 3D mesh based fluid simulations that operate within Unity’s Visual Effects Graph. These effects require the installation of the Unity Visual Effect Graph package found in the Package Manager *Be sure to select Packages: Unity Registry to find the package.
The splashes use a custom shader which switches visibility between frames of submeshes creating 3D flipbook animation. The splashes can be tweaked using the properties exposed in the Visual Effect Component.
Particles - The included particle system use Unity’s build in Particle System. There are particle systems for different types of mud based on its surface as well as different impact styles. These base level systems can be altered via the properties to suit your needs. They look great combined with the other included effects.
Decals - Living Mud URP includes many different high resolution decal textures to splatter your mud dynamically across any scene. The decals use Unity’s URP Decal Render feature which must be added to the basic Unity URP renderer.
Living Mud URP includes several custom shaders and materials. Where possible the shaders have been authored in Unity Shader Graph to give you the flexibility to easily modify and add to them. *The exception to this is the shader that writes stamps to a DMS Custom Render Texture. The ability to write to a Custom Render Texture must currently be done with a written CG shader.
Basic Lit Shader - A simple shader that provides simple lighting and texture options in URP.
DMS Shader - The shader that applies stamps to a Dynamic Mud Surface via a Custom Render Texture. This shader’s properties are separated into sections that control the appearance of the mud surface and the stamps that are applied to it.
Flowing Water URP Lit Shader - This shader is used in the Creek Bed example for the flowing water surface of the creek. It uses a flowmap to simulate moving water as well as a variable transparency and edge detection to create the look of mud in the water.
Mesh Flipbook Loop URP Lit Shader - This shader is used in the VFX Splash effects to turn visibility on and off amongst the submeshes of the splash model. This effect creates an animated 3D model that loops between frames. The various frames are separated via their UV channel and the shader turns these frames on and off at a given rate.
Mesh Flipbook URP Lit Shader - The same as the above shader but without built in looping. This shader requires input via the frame property to choose which frame it is displaying.
Mud Projection URP Lit Shader - This shader uses planar projection to overlay a muddy material over another material. It exposes properties that allow you to dynamically control how far along the local Y axis of the model the mud will appear on. This shader is useful for quickly allowing models that enter the mud to be effected realistically.
Muddy Water URP Lit Shader - A shader to simulate extremely muddy water you would find in a mud puddle. It can be seen in the Mud Pit example.
Stamp Preview Shader - Used on stamp prefabs to visualize the scale of a stamp relative to its prefab. This is automatically created when a new stamp is made via the “Create/LivingMud/Stamp” menu. This shader is only used for visualization purposes to set stamps up in your scene.
StampShader - This shader is NOT created using Shader Graph. This code is run when a stamp is applied to a Custom Render Texture. It inputs transform data from the stamp GameObject and converts it to texture space on the Custom Render Texture. This shader’s properties are exposed so you may observe the data being transferred between the stamp GameObject and the shader but they are not designed to be altered directly. The only exception to this is the Vignette property which can be enabled to create a circular mask around the stamp ensuring that no edge pixels are applied incorrectly.
Texture with Mud - An example of a shader which can overlay mud with a basic noise mask to allow objects to get muddier dynamically. This differs from the Mud Projection shader as it applies the mud evenly over the entire model. It can be seen on the ATV tire and Piano projectiles.
URP Decals - There are many different unique decal materials included for all types of mud and dirt splatter. These must be used with the Unity Decal Renderer which must be added to the URP Render Features.
Dynamic Mud Surface Materials - There are seven included materials for different types of mud surface. Living Mud is fully intended for users to create their own mud surface materials with any textures they like but these included materials should represent a wide variety of mud types. All are provided in 4k resolution and repeat seamlessly.
Living Mud includes scripts which control its various effects. Some scripts are used for the base level functionality of the toolset and others are examples that are used in the Demos. The tools included in Living Mud are made to be modular and flexible so a user can combine and control them in any way you see fit. The following documentation will give a basic overview of the scripts that are necessary to operate the tools. All scripts have been designed to be easy to read, properly commented, and have summaries for all classes.
The included scripts and demos use an interface and component based architecture to distribute necessary data between components when mud is interacted with.
DynamicMudSurface - This class holds the necessary references and methods for a DMS. It is necessary for stamps to interact with a surface and for projectiles to determine if they have contacted a DMS. It serves as an interface between the surface GameObject, its Material, and the Custom Render Texture that applies stamps.
MudProjectile - This class is the basic manager for any GameObject that will interact with a Dynamic Mud Surface. It expects a Rigidbody and Collider to detect a collision with an object which has a DynamicMudSurface component. It will then report impacts to any other components on its object which implement an IUseImpactData interface.
MudStamp - This class is the manager for stamps that can affect a Dynamic Mud Surface. This class contains properties to change the appearance of the stamp and methods to transmit the necessary data about the stamp GameObject’s transform relative to the surface it is affecting.
ICheckInMud - Implement this interface in classes that need to be notified when an object is contacting a Dynamic Mud Surface.
IPlaceStamp - Implement this interface for any class that can apply a stamp to a DMS.
ISetColorMap - Interface that receives color and color texture maps from a surface that has been contacted.
ISpinOut - Used in the ATV tire example to communicate if the wheel is currently “spinning out” which will trigger specific effects.
IUseImpactData - Implement this for any class that wishes to receive data regarding a collision with a DMS. This interface can be used to alter effects based on the angle, mass, and position of a collision.
This scene displays the basic effects included in the Living Mud URP package which are combined to make a fully realized mud simulation. It is a quick way to check out the basic effects which you can modify and expand upon to create your own specific simulations.
This scene includes three environments showcasing the three types of included mud surface thickness (Dry, Sloppy, and Watery). The scene should be viewed in Play Mode using the on screen UI to generate projectiles and effects. The ATV tire projectile can be controlled using the arrow or WASD keys. You will observe that the various projectiles generate different effects based on the environment that they are interacting with.