dolphin.spatial3d · recipe ·

Example · A checker material

Turn a continuous position into alternating cells.

cpudolphin.materialsdolphin.mathdolphin.spatial3drecipe

A checkerboard asks which cell a point belongs to. Multiply a coordinate to choose cell density, round down to get the cell number, and alternate between two colors using whether the sum of two cell numbers is even or odd. Here we use X and Y, so the pattern is planar. On a sphere it stretches toward the edges of that projection. This is a deliberate first mapping, not an automatic solution for every mesh's texture coordinates.

start.yh · Dolphin material example

Status: complete-program

Example · A checker material

Turn a continuous position into alternating cells.

cpu · type checked

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

Surface(Vector3 position) -> dolphinSurface
{
    int cellX = Math.FloorToInt(position.x * 4.0)
    int cellY = Math.FloorToInt(position.y * 4.0)
    Vector3 color = Vector3(0.04, 0.06, 0.1)
    if (cellX + cellY) / 2 * 2 == cellX + cellY
    {
        color = Vector3(0.1, 0.9, 0.7)
    }
    return DolphinSurface(color, 0.7, 0.0, 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))
project.mech
manifestVersion = "2"
package = "api.example.recipe__shader_checker"
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.1, 0.9, 0.7
Notes and source

Change both density multipliers from 4.0 to 2.0. Then try using X and Z instead of X and Y.

demonhunterlabs/app/lib/yeho-walkthrough.ts