Home

Awesome

Unity Plane Mesh Splitter

What is the purpose of this tool?

Say you have a gigantic terrain in a single mesh. Unity is going to process the entire mesh when rendering it even though only a small section in front of the camera is visible.

This tool lets your split this large mesh into smaller submeshes which should greatly improve the performance thanks to the built-in Unity frustum culling (only visible meshes will be rendered).

Features

Description

A tool which lets you split any mesh into smaller submeshes. At first it was designed to work with imported Tiled2Unity terrains, but I rewrote it to work with everything you can throw at it.

In 2022 I rewrote it again to improve it and solve some problems. I used the new mesh building API and simplified the vertex data copying process - it now copies data directly from the meshes vertex data buffer, retaining the same vertex data structure as the original mesh. Burst allowed me to improve performance and spread work across multiple threads.

Installation

Install this tool using Unity Package Manager: https://github.com/artnas/Unity-Plane-Mesh-Splitter.git

image

image

for versions compatible with older versions of unity go to Releases

Compability

Usage

MeshSplitController component

Add the "MeshSplitController" component to the game object you want to split and press the "Create submeshes" button. Press "Clear submeshes" to revert.

API

// mesh to split
Mesh mesh;
            
// create a mesh splitter with some parameters (see MeshSplitParameters.cs for default settings)
var meshSplitter = new MeshSplitter(new MeshSplitParameters
{
    GridSize = 32,
    GenerateColliders = true
});

// split mesh into submeshes assigned to points
var subMeshes = meshSplitter.Split(mesh);

alt tag

TODO