# Start with one material

Describe a Dolphin surface as a small Yeho function.

Last updated: 2026-09-09

Package: dolphin.spatial3d | Status: complete-program

Tags: cpu, dolphin.materials, dolphin.math, dolphin.spatial3d, recipe

A surface function answers: what material should be here? It receives a position and returns color, roughness, metallic response, and emission. We can begin with the same answer everywhere. This example uses the Dolphin materials, math, and spatial3d packages. It prints a sampled material value in the console. To see the material on a sphere, use the Atlas surface workshop and its compiled CPU reference preview.

```yh
start.yh
```


## Start with one material

Describe a Dolphin surface as a small Yeho function.

Verification: type checked

```yh
using dolphin.materials
using dolphin.math
using dolphin.spatial3d

Surface(Vector3 position) -> dolphinSurface
{
    return DolphinSurface(Vector3(0.08, 0.7, 0.6), 0.8, 0.0, 0.0)
}

dolphinSurface material = Surface(Vector3(0.0, 0.0, 0.0))
Console.Log(Text.From(material.roughness))
```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.recipe__surface"
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.8
```

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--surface/program --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


In the Atlas surface example, compare roughness 0.8 with 0.2 while keeping color, metal, emission, and lighting unchanged.

Source: demonhunterlabs/app/lib/yeho-walkthrough.ts

AI training permission: https://demonhunterlabs.com/ai-use
