Guides Materials & Shaders 3D Create A Custom Surface3D Shader

Materials & Shaders 3D 2 min read Updated Aug 2026

Create A Custom Surface3D Shader

Lenga uses first-class `Shader` assets for custom 3D surface rendering.

Shader assets are normal project assets:

  • shader assets are real project assets
  • materials can reference shader assets
  • the editor validates shader assets in the Inspector
  • runtime and editor previews use the same shader asset path

Surface3D Shader Shape

Custom Surface3D shader assets use:

  • Domain = Surface3D
  • Surface Mode = Unlit
  • one vertex source file
  • one fragment source file

This workflow is ideal for:

  • stylized unlit materials
  • banding
  • gradients
  • contouring
  • texture-driven looks
  • simple material-specific surface effects

Create The Shader Asset

  1. In the Assets panel, create a new Shader asset.
  2. Select it in the Inspector.
  3. Keep Domain set to Surface3D.
  4. Keep Surface Mode set to Unlit.
  5. Assign:
    • Vertex Source
    • Fragment Source

When you create a shader asset through the editor, Lenga also creates starter .vert and .frag files beside it so the asset is immediately usable.

Assign The Shader To A Material

  1. Create or select a Material asset.
  2. In the material Inspector, set Shader Asset.
  3. Assign that material to a built-in 3D renderer such as:
    • CubeRenderer
    • SphereRenderer
    • CapsuleRenderer
    • CylinderRenderer
    • PlaneRenderer
    • MeshRenderer
    • ModelRenderer

The material still keeps its built-in Shader field as a fallback path. If the custom shader asset is invalid or unsupported, Lenga falls back to the built-in material mode instead of leaving the renderer in a broken state.

Validation And Errors

The editor validates:

  • shader asset structure
  • supported domain
  • supported surface mode
  • missing vertex source
  • missing fragment source
  • compile failures

That validation shows up directly in the Inspector, which makes it much easier to iterate without guessing whether the problem is in the asset, the source file, or the material reference.

Test Scene To Inspect

A practical test scene for a custom Surface3D shader only needs three assets:

  • Assets/Shaders/MySurface.shader.json
  • Assets/Shaders/MySurface.vert
  • Assets/Shaders/MySurface.frag

Create a material that points at the shader asset, assign it to a cube, sphere, plane, mesh, or model, then compare the Scene view and Play view. That gives you a reliable reference for the supported Surface3D shader shape inside your own project.

Limits In This Milestone

This is a strong first foundation, but it is intentionally not everything yet.

Not in scope yet:

  • visual shader graph authoring
  • custom lit forward shaders
  • sky shader assets
  • post-process shader assets
  • UI shader assets
  • 2D shader assets

Those are planned follow-up layers. The goal here is a correct, maintainable, real shader-asset workflow that the rest of Lenga can build on.