dolphin.spatial3d · recipe ·

Mix two colors

Understand a blend before adding patterns.

cpudolphin.materialsdolphin.mathdolphin.spatial3drecipe

Pick two colors and imagine a slider between them. At zero, choose the first. At one, choose the second. Halfway gives equal contributions. That is the idea behind a linear blend. DolphinSurfaceMix performs this blend component by component and clamps its weight to the zero-to-one range. We will reuse it in the next lesson with a changing weight.

start.yh

Status: complete-program

Mix two colors

Understand a blend before adding patterns.

cpu · type checked

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

Vector3 blue = Vector3(0.0, 0.0, 1.0)
Vector3 red = Vector3(1.0, 0.0, 0.0)
Vector3 mixed = DolphinSurfaceMix(blue, red, 0.5)
Console.Log(Text.Format("{0}, {1}, {2}", mixed.x, mixed.y, mixed.z))
project.mech
manifestVersion = "2"
package = "api.example.recipe__color"
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.5, 0, 0.5
Notes and source

Run with weights 0.0, 0.5, and 1.0. Predict the printed RGB components before each run.

demonhunterlabs/app/lib/yeho-walkthrough.ts