dolphin.spatial3d · recipe ·

Let position paint a pattern

Turn a wave into stripes on a surface.

cpudolphin.materialsdolphin.mathdolphin.spatial3drecipe

A constant blend gives one color everywhere. A changing blend gives a pattern. DolphinSurfaceWave converts a coordinate and frequency into a smooth repeating value around the zero-to-one range. Using position.y makes the blend vary with height. Using position.x changes which direction the pattern follows. The function still returns an ordinary Dolphin surface value.

start.yh

Status: complete-program

Let position paint a pattern

Turn a wave into stripes on a surface.

cpu · type checked

using dolphin.materials
using dolphin.math
using dolphin.spatial3d

Surface(Vector3 position) -> dolphinSurface
{
    float bands = DolphinSurfaceWave(position.y, 14.0)
    Vector3 teal = Vector3(0.08, 0.7, 0.6)
    Vector3 violet = Vector3(0.6, 0.12, 0.95)
    Vector3 color = DolphinSurfaceMix(teal, violet, bands)
    return DolphinSurface(color, 0.32, 0.55, 0.0)
}

Console.Log(Text.From(Surface(Vector3(0.0, 0.0, 0.0)).roughness))
project.mech
manifestVersion = "2"
package = "api.example.recipe__bands"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "dolphin.materials"
version = "0.1.0"
path = "../../../dolphin/packages/materials"

[[dependencies]]
package = "dolphin.math"
version = "0.1.0"
path = "../../../dolphin/packages/math"

[[dependencies]]
package = "dolphin.spatial3d"
version = "0.1.0"
path = "../../../dolphin/packages/spatial3d"
Expected output
0.32
Notes and source

In the Atlas surface example, change frequency from 14.0 to 7.0. Then restore it and change position.y to position.x.

demonhunterlabs/app/lib/yeho-walkthrough.ts