Overlapping Model Type
Note
This feature is only available in Tessera Pro
Tessera's main generation algorithm is called WaveFunctionCollapse (WFC), which is responsible for choosing which tiles can be placed in the output.
WFC can be run in two different models: adjacent (aka "simple") and overlapping. By default, Tessera uses the adjacent model. This model forces that pairs of adjacent tiles must connect together, as specified by the tile paint.
In an overlapping model, you supply samples, which are pre-made levels that the model will learn from. The generator will then ensure that every rectangle in the output matches a rectange found in one of the sample levels. This can copy the style of the sample level quite faithfully. More details on how it works can be found at https://github.com/mxgmn/WaveFunctionCollapse or https://twitter.com/exppad/status/1267045331004469248.
Example
On the left, a small 6x7 map of tiles has been specified as the sample, and a larger map has been made from it. Every 2x2 rectangle in the output comes from somewhere in the input, with the red box showing one particular patch.
Usage
In the generator settings, set the Model Type to Overlapping.
You can then supply a list of samples, and the overlap size.
Creating samples
To create a sample, create an empty game object and add it to the samples array of the generator.
Then add objects as children of the sample. The children objects should be arranged in a grid with spacing matching the tile size. The children don't need a TesseraTile component, they need to be "linked" to the original tiles instead. Tile are linked by either:
- The name of the child matching the name of a configured tile (suffixes are ignored)
- The child having a TesseraPinned component, with the tile property set to the tile in question.
Using grid alignment tools such as ProBuilder can help set up your sample.
For 2d grids, you can also use a Unity TileMap as the sample input. The tiles should have names that correspond with configured Tessera Tile objects. See the "Plains" sample for details.
Clone Sample
Getting Tessera to detect your sample can be a bit finickity. Use the Clone sample
button that appears in the inspector to get Tessera to dump out it's internal view of the sample. If you've got everything right, it should look like the original. If not, see what's different.
Rotation
If the tiles have rotation / reflection on, then reflected / rotated copies of the sample will also be used. It's highly recommended you enable the symmetric option if you have rotatable tiles, as overlapping model copes much less well than the adjacent model with redundant tile rotations. This feature requires tile paint.
Caveats
- Overlapping model is much slower than adjacent models. Using overlapSize greater than 3 is not recommended.
- Overlapping model is a strict constraint - every output rectangle must come from a sample. You will often need to make samples quite large and detailed to get sufficient variety for a good quality output.
- It supports cube and square grids only
- You must manually create sample levels.
- Overlapping interacts stangely with irregularly shaped outputs. You are recommended to avoid pins other than PinType.Pin, and to avoid the MaskOut feature of Tessera volumnes.
- Tile paint is not used for the model, but it will still be read by many other Tessera features such as rotational symmetry, pinned tiles, the path constraint and skyboxes. Thus you will likely need to paint the tiles in addition to making samples.