Mesh Edges Model Type
Note
This feature is only available in Tessera Pro
The usual way of working with Tessera is that you manually paint the connections between tiles. This gives you ultimate control over behaviour.
However, Tessera also supports auto-detecting tile connections based on the mesh of each tile. Two tiles connect if
- the open edges (aka borders) of their meshes exactly match when placed next to each other.
- the corners interior information agrees
Sample Building shows a an example of this Model Type in action.
Setting up the generator
The generator can be set up normally. Set the Model Type to Mesh Edges
.
Setting up the tiles
Tiles can be set up normally. There's no need to paint the tiles as it's not used in this model type (though some other Tessera features like the path constraint do use it). This feature works best with Cube tiles, but Hex tiles also work.
Each tile should have a MeshFilter
component on it or a child object. You don't need a MeshRenderer
component.
The meshes need to be designed for this in mind. Generally, the meshes should not be a fully closed solid. Instead, each should be a surface width edges terminating at the tile boundary. This will enable Tessera to detect which edges are on each side of the tile.
Also, Tessera will not match a single edge in one mesh with two edges on a second mesh, even if they cover the same distance. So it's necessary to make sure all tiles have the same vertices and subdivision.
You can see some suitable examples in the Building and HexRaceway samples.
Typically, asset packs give tiles that are fully closed. It's necessary to delete edges and size the mesh carefully before it will work in Tessera.
Left shows the original mesh, right the mesh with extra faces deleted so that the mesh edges will line up with those from another tile..
If you are still in doubt, WildTile has a good tutorial about how the meshes should work
Empty tiles
When a Tessera Generator runs, it always fills every cell of the grid with a tile. Thus it's often necessary to explicitly supply an empty or "air" tile for Tessera to use when you don't want anything else added.
You also may find the need to create a "solid" tile which is used to fill in the interiors or builds, or underground, etc.
Edge detectors can often get confused between these two tiles - they fulfill different roles and have different connections, but both of them don't need any mesh as there is nothing to display.
In order to resolve this, Tessera will treat a tile with an empty mesh (no vertices) as all interior (solid) and a tile with no mesh (null, or without a MeshFilter
component at all) as all exterior (air). Tessera comes with an EmptyMesh.fbx
asset for use in the first case.
Debugging
Mesh edge matching is not a 100% reliable process. Often, some edges won't match, because you've not desinged your tiles correctly, or something has gone wrong.
To debug issues, you are recommended to use the Paint Tile From Mesh feature. It gives a clear visual indication of how the mesh has been interpreted. It also comes with a Debug setting, which dumps out exactly what Tessera found when analysing the mesh. For even more debug info, set EdgeDetection.ExtendedDebugInfo
to true in the source code, which gives internal details about the snapping and hashing process.
Tolerance
Tessera classifies edge by snapping vertices to a grid, then forming a "hash" that matches pairs of edges.
The tolerance setting controls the level of snapping. A small value means vertices have to be incredibly close to each other to match, which can often cause similar looking meshes to not match. A large value means vertices do not need to be as close, which can cause different meshes to accidentally match.
If you have having issues with the matching process, try tweaking the tolerance. Sometimes picking non-round numbers helps too, as this can stop similar vertices being snapped in different directions. Try 1/252 for example.
Samples
The Building and HexRaceway samples both come with tilesets suitable for edge detection. Feel free to experiment.