PolyBash Documentation

PolyBash builds procedural geometry along a Unity spline, and it generates the textures for that geometry. This manual has one page per part of PolyBash.

Pages

Page Content
Quick Start: Samples The samples that the .unitypackage includes: where to find the BridgeHouse scene, what it contains, and what to try first.
Surface Variants The Surface Variant asset, which describes one recolorable surface, so that one set of blocks produces many color variations.
Texture Generation The four texture definitions, which lay out prefab blocks, capture them into a texture, and write the image files.
Spline Generators Overview The parts that both generators share: build cycle, stages, scene handles, generated objects, materials, appliers, prefabs and the Info section.
Stair Path Generator The Spline Stair Path Generator, which builds steps, flat paths, side walls, tunnels, edge trims, railings and colliders.
Building Generator The Spline Building Generator, which builds walls, floors, ceilings, a gable roof, plus doors and windows with generated frames.

Reading order

The page numbers follow the order in which the parts build on each other. A surface variant recolors the blocks of a capture. A texture definition captures those blocks into the textures of a material, and a spline generator applies that material to the geometry that it builds.

To see a finished result first, start with Quick Start: Samples, where you open a complete scene and PolyBash creates its materials.

To create geometry first, start with the Spline Generators Overview, and then read the page of your generator. Return to the pages Surface Variants and Texture Generation for the materials.

Requirements

PolyBash works in Unity 2022.3 and in Unity 6.

PolyBash supports the Universal Render Pipeline (URP), the High Definition Render Pipeline (HDRP) and the Built-In Render Pipeline. It creates the materials of the texture definitions and the surface variants for the active render pipeline. Each new material uses the lit shader of that pipeline, which is Universal Render Pipeline/Lit, HDRP/Lit or Standard. PolyBash creates a material only when it is missing, so an existing material keeps its shader after a change of render pipeline.

PolyBash needs four Unity packages, and its scripts do not compile without them.

Name Version
com.unity.splines 2.8.4
com.unity.collections 2.6.8
com.unity.burst 1.8.29
com.unity.mathematics 1.3.2

When you import the .unitypackage from the Asset Store, Unity asks you to allow the installation of these packages.

Folders

When you import the .unitypackage, Unity creates the folder Assets/Snowtop/PolyBash, which holds PolyBash, and the folder Assets/Snowtop/PolyBash Samples, which holds the samples. The table below lists the folders that you work with.

Folder Content Page
Assets/Snowtop/PolyBash/Texture Definitions The included texture definitions. Each one writes its textures to Assets/Snowtop/PolyBash Samples/GeneratedTextures. Included texture definitions
Assets/Snowtop/PolyBash/Surface Variants Surface variants in stone, wood and roof colors. Most of them serve the texture definitions and the sample scene. Surface Variants
Assets/Snowtop/PolyBash/Texture Generation/Prefabs The block prefabs that a texture definition lays out: bricks, worn stones, boards and roof tiles, with their normal maps. Included block prefabs
Assets/Snowtop/PolyBash/Texture Generation/Surface Textures The surface textures Stone-01 and Wood-01 that the included surface variants recolor. Each set holds a base color, normal, ambient occlusion, height and roughness map. Surface Variants
Assets/Snowtop/PolyBash/Prefabs/Building Parts The doorknob prefab Assets/Snowtop/PolyBash/Prefabs/Building Parts/DoorKnob-01.prefab for the Knob Prefab field of the building generator. Door knob
Assets/Snowtop/PolyBash/Models The FBX models of the block, board, roof tile and doorknob prefabs. —
Assets/Snowtop/PolyBash Samples/Scenes/BridgeHouse The sample scene Assets/Snowtop/PolyBash Samples/Scenes/BridgeHouse/BridgeHouse.unity. Quick Start: Samples
Assets/Snowtop/PolyBash Samples/Prefabs Two sample prefabs. Assets/Snowtop/PolyBash Samples/Prefabs/SplineBuildingSample.prefab holds a building generator and a stair path generator. Assets/Snowtop/PolyBash Samples/Prefabs/SplineStairPathSample.prefab holds a stair path generator. Quick Start: Samples
Assets/Snowtop/PolyBash Samples/GeneratedTextures The textures of the samples, which the texture definitions and the appliers write. On the first load, the appliers of the samples create their materials in this folder. Quick Start: Samples

The folders Editor, Runtime and Shaders in the folder Assets/Snowtop/PolyBash hold the scripts and the shaders of PolyBash.

The file Assets/Snowtop/PolyBash/Third Party Notices.md holds the licenses of two libraries that PolyBash includes: Clipper2 under the Boost Software License 1.0, and Cutear under the ISC License.

Glossary

Every page uses these terms with the meaning below, and with no other word for the same concept.

Term Meaning
Generator A Spline Stair Path Generator or a Spline Building Generator component.
Knot One control point of the spline.
Section The part of the result between two neighboring knots. In an inspector, a section is also one group of fields under a title, such as Info, Roof or Layout.
Corridor The band around the spline that a generator fills. The Per-Knot Offsets set its half-widths at each knot. Left Offset and Right Offset give the start values of a new knot.
Run A group of neighboring sections that the generator builds as one unit, such as one staircase or one roof.
Level One horizontal band of a building. Level 1 starts at the local height 0.
Stage One step of the build pipeline, such as the walls or the roof. An optional stage has its own inspector section with a checkbox.
Opening A cut in a wall or in a floor: a door, a window, a floor opening or a wall opening.
Insert The generated frame, with its glass or its leaf, that fills a door or a window.
Card One entry of a list in the inspector, such as one opening or one edge entry.
Texture definition The asset that lays out blocks, captures them, and writes the textures of one material.
Block One instance of a prefab inside the layout of a texture definition.
Layout The arrangement of blocks that a texture definition generates.
Capture One render of a layout into one image, per capture type.
Preview A live capture into RenderTexture assets, which writes no image file. The surface variant preview is a different image: the recolored texture in the surface variant inspector.
Finalized textures The PNG files that a capture writes to disk.
Surface variant The asset that recolors a texture through two gradients and places it on a block.
Applier A component that connects a texture definition or a surface variant to the material fields of a generator.