{"id":"dolphin.materials--DolphinSurfacePreview","name":"DolphinSurfacePreview","owner":"dolphin","package":"dolphin.materials","kind":"function","signature":"external DolphinSurfacePreview(function of Vector3 to dolphinSurface shader,int size) returns text","description":"Evaluate a surface function with Dolphin's CPU reference renderer and return encoded BGRA pixels for a small material preview.","context":"Compose linear-color surfaces and shared shading math in ordinary Yeho code.","parameters":[{"name":"shader","type":"function of Vector3 to dolphinSurface","description":"Supply shader as function of Vector3 to dolphinSurface."},{"name":"size","type":"int","description":"Supply size as int."}],"returns":"text","members":[],"tags":["cpu","dolphin","dolphin.materials","function","material","materials","preview"],"updated":"2026-09-09","source":{"repository":"dolphin","path":"packages/materials/src/surface.yh","line":56,"sha256":"009f4f147ecdf092eeb6d6c7a20fae2c1b2a351f4cb47a531420e348713e03df"},"status":"source-declared","notes":["Package presence and a declaration do not establish support on every host. Host services need their platform and lifecycle setup."],"examples":[{"id":"complete","title":"Render a material preview","description":"Sample a teal material with the compiled Dolphin CPU reference. The output is encoded BGRA pixel data, not a GPU shader export.","code":"using dolphin.math\nusing dolphin.spatial3d\nusing dolphin.materials\n\nSurface(Vector3 point) -> dolphinSurface\n{\n    return DolphinSurface(Vector3(0.1, 0.7, 0.6), 0.4, 0.0, 0.0)\n}\ntext pixels = DolphinSurfacePreview(Surface, 16)\nConsole.Log(Text.From(Text.Length(pixels)))\n","tags":["cpu","material","preview"],"run":"cpu-oracle","expected":null,"verifyRun":true,"manifest":"manifestVersion = \"2\"\npackage = \"api.example.dolphin_materials__dolphinsurfacepreview\"\nversion = \"0.1.0\"\nlanguageEdition = \"yeho-core-2026.1\"\n\n[app]\nkind = \"headless\"\n\n[[dependencies]]\npackage = \"dolphin.materials\"\nversion = \"0.1.0\"\npath = \"../../../dolphin/packages/materials\"\n\n[[dependencies]]\npackage = \"dolphin.math\"\nversion = \"0.1.0\"\npath = \"../../../dolphin/packages/math\"\n\n[[dependencies]]\npackage = \"dolphin.spatial3d\"\nversion = \"0.1.0\"\npath = \"../../../dolphin/packages/spatial3d\"\n","verification":"executed","sha256":"369329daede723c293d1eb44facb1f94c05ad25851c54f5288ba693592d45fb9","checked":"2026-09-09","diagnostic":"","observedOutput":"2048","checkedBackend":"cpu-oracle"}],"searchTerms":[],"url":"https://demonhunterlabs.com/academy/api?item=dolphin.materials--DolphinSurfacePreview","json":"https://demonhunterlabs.com/reference/items/dolphin.materials--DolphinSurfacePreview.json","markdown":"https://demonhunterlabs.com/reference/text/dolphin.materials--DolphinSurfacePreview.md"}
