MudBun Manual

Features & Terminologies

Pleas read the details page first to better understand the features & terminologies.

Importing The Package & Building Executables

When upgrading from older versions of MudBun, DELETE the entire MudBun folder before re-importing from a newer package. File structures might have changed, and directly re-importing a new package on top of an existing one could cause unexpected issues.

There are folders specific to render pipelines: Built-In RP, URP, and HDRP. There are one of each under the folders MudBun/Examples and MudBun/Resources/Render. Only import the folders that are specific to the current render pipeline and leave out the rest. It wouldn’t matter in play mode in editor, but it would cause errors when building executables.

Renderers & Brushes

To generate volumetric VFX mesh, a renderer is needed. Brushes nested under the renderer will be processed in a top-to-bottom order as presented in Unity’s Hierarchy panel.

To add a new renderer, right click in the Hierarchy panel, and select MudBun > Renderer.

Alternatively, a renderer will be automatically created if a newly created brush is not under an existing renderer’s hierarchy. For example, creating a new noise volume brush will also create a new renderer and the noise volume brush will be nested under the renderer.

A solid brush (e.g. the Sphere brush) is blended with all the brushes above it in the Hierarchy panel.

A distortion brush (e.g. the Quantize brush) distorts the sample space and affects all the brushes below it in the Hierarchy panel.

A modifier brush (e.g. the Onion brush) post-processes the accumulated SDF and thus affects the results from all the brushes above it in the Hierarchy panel.

Materials

Each brush has its own material, as shown in its Mud Material component. A brush’s material properties, such as color and smoothness, may be adjusted in-place right within the Inspector panel.

Alternatively, a shared material can be created in the Project panel by right-clicking and selecting Create > MudBun > Material. This is stored as an asset that can be shared across multiple renderers and brushes.

A renderer has some master material properties. These properties are multiplied with the final results of voxel materials. For example, setting the master color to a blue color will give the color of the generated mesh a blue tint. Same as a brush’s material, a renderer’s master material can be bound to a shared material asset.

Mesh Colliders

Mesh colliders can be generated from a renderer’s current mesh, which can be either added to the renderer itself or added to a new separate game object. A custom voxel density different from the one used by the renderer can also be specified for generating mesh colliders.

Custom Brushes

Templates and examples for creating custom brushes are located in the MudBun/Customization folder. To create a custom solid, distortion, or modifier brush: On the script side, extend the MudSolid, MudDistortion, or MudModifier classes, respectively. On the compute shader side, modify the brush cases in CustomBrush.cginc.

GPU Memory Budgets

It’s important to keep track of how much GPU memory is allocated is used. It’s good practice not to allocate too much more than what is actually needed. The renderer’s Budgets section in the Inspector panel provides an interface to adjust budgets, monitor the usage, and automatically adjust based on actual usage.

The Auto-Adjust Budgets option keeps track of high-water marks of voxel & voxel chunk usage and automatically adjusts the budgets, with the Margin Percent option for reserving an extra safe percentage of memory margin.

Allocating much more GPU memory than actually needed is not the end of the world, but this could mean that other code that also needs GPU memory might exhaust it when allocating, potentially leading to a crash.

If there appears to be holes in the mesh, i.e. some voxels are missing, chances are that the budgets for max voxels and/or max voxel chunks are set too low. Check the GPU memory usage and increase the memory budgets accordingly.

Tooltips

Don’t forget that some parameters provide tooltips if you mouse-over them.

Performance

In general, having too much of anything in a game will induce unnecessary performance hit. Here are a few things to look out for to get the most out of MudBun while maintaining reasonable performance.

  • Keep voxel density as low as possible while still looking good. This will help with performance as well as keeping GPU memory usage low.
  • Remember that the flat mesh and splats render modes are computationally cheaper than the smooth mesh render mode.
  • Keep the sizes of distortion and modifier brushes as small as possible, as they can quickly eat up a lot of voxels as they grow larger.
  • Consider trying the splats render mode with low voxel density. It creates a stylized look, and low voxel density means good performance.
  • Watch the number of particles. Each particle is treated as one solid brush. Try using higher self-blend values and less particles to achieve the same effect, or consider using noise volumes to arrive at similar effects.