# Example · Ripples around a point

Feed distance into a wave to make rings.

Last updated: 2026-09-09

Package: dolphin.spatial3d | Status: complete-program

Tags: cpu, dolphin.materials, dolphin.math, dolphin.spatial3d, recipe

Stripes vary along one coordinate. Rings vary with distance from a center. We can reuse the same wave and blend helpers by changing the value we feed into them. The square root of x*x + y*y gives distance in the X/Y plane. Points at the same distance receive the same blend weight. This is why the pattern forms rings.

```yh
start.yh · Dolphin material example
```


## Example · Ripples around a point

Feed distance into a wave to make rings.

Verification: type checked

```yh
using dolphin.materials
using dolphin.math
using dolphin.spatial3d

Surface(Vector3 position) -> dolphinSurface
{
    float radius = Math.SqrtFloat(position.x * position.x + position.y * position.y)
    float ripple = DolphinSurfaceWave(radius, 24.0)
    Vector3 deep = Vector3(0.02, 0.05, 0.2)
    Vector3 foam = Vector3(0.1, 0.8, 1.0)
    return DolphinSurface(DolphinSurfaceMix(deep, foam, ripple), 0.4, 0.1, 0.0)
}

dolphinSurface center = Surface(Vector3(0.0, 0.0, 0.0))
Console.Log(Text.Format("{0}, {1}, {2}", center.color.x, center.color.y, center.color.z))
```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.recipe__shader_rings"
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:

```text
0.06, 0.425, 0.6
```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/recipe--shader-rings/program --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


Lower frequency from 24.0 to 12.0, then shift the center by subtracting 0.3 from X before squaring it.

Source: demonhunterlabs/app/lib/yeho-walkthrough.ts

AI training permission: https://demonhunterlabs.com/ai-use
