dolphin.materials · function ·

DolphinSurfacePreview

Evaluate a surface function with Dolphin's CPU reference renderer and return encoded BGRA pixels for a small material preview.

cpudolphindolphin.materialsfunctionmaterialmaterialspreview

Compose linear-color surfaces and shared shading math in ordinary Yeho code.

external DolphinSurfacePreview(function of Vector3 to dolphinSurface shader,int size) returns text

Status: source-declared

Parameters

function of Vector3 to dolphinSurface shader
Supply shader as function of Vector3 to dolphinSurface.
int size
Supply size as int.

Render a material preview

Sample a teal material with the compiled Dolphin CPU reference. The output is encoded BGRA pixel data, not a GPU shader export.

cpu · material · preview · executed

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

Surface(Vector3 point) -> dolphinSurface
{
    return DolphinSurface(Vector3(0.1, 0.7, 0.6), 0.4, 0.0, 0.0)
}
text pixels = DolphinSurfacePreview(Surface, 16)
Console.Log(Text.From(Text.Length(pixels)))
project.mech
manifestVersion = "2"
package = "api.example.dolphin_materials__dolphinsurfacepreview"
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"
Notes and source

Package presence and a declaration do not establish support on every host. Host services need their platform and lifecycle setup.

dolphin/packages/materials/src/surface.yh:56