Metal · Swift Package

Break the repeat.
Keep the texture.

Mip-correct stochastic hex tiling for Apple GPUs. Suppress visible repetition with the textures you already have.

Repeat sampling

Flat top view with repeat sampling

Hex tiling

Flat top view with hex tiling
Flat terrain · orthographic camera Same texture · same UV scale

01

Metal only

No MetalKit or AppKit dependency. Bring any drawable or render stack.

02

Mip correct

Explicit gradients keep filtering stable across stochastic patch boundaries.

03

PBR ready

Use the same lattice for color, normal, roughness, and metalness maps.

In context

Less pattern.
Same landscape.

Perspective, elevation, lighting, and fog are identical. Only the texture sampling path changes.

Repeat sampling

Terrain with repeat sampling

Hex tiling

Terrain with hex tiling

One primitive

Compose it with your shader.

The package ships MSL source and a compact Swift configuration API. Your material decides which maps use stochastic sampling.

Renderer.swiftSwift
import MetalHexTiling

let library = try HexTilingMetal.makeLibrary(
    device: device,
    appending: shaderSource
)

var options = HexTilingParameters(
    patchScale: 2
).shaderVector