Phase 6 updates

Phase 6 · Slice 8 ·

Vertex colors

  • Meshes carry vertex colors to the GPU: Mesh.colors/colors32 upload (a new mesh_set_colors, native API 40) when there's one per vertex, into MeshData::colors (RGBA8, empty for white). Every vertex attribute location is taken, so the color rides in the UV attribute, widened to four floats: r + 256 g and b + 256 a, whole numbers floats hold exactly. The cooked asset format is unchanged (imported meshes have no colors yet).
  • Materials whose shaders take vertex colors (the sprite, UI and particle shaders: the two-sided built-ins) set a material flag, and the surface shader multiplies the color by the vertex color (and cutout shadow casters their alpha). Lit shaders ignore vertex colors, as Unity's do.
  • LineRenderer and TrailRenderer gradients now show on screen. A GPU test checks a two-color quad (the gradient, the material color multiplying it, and surfaces that ignore it); the lines_trails sample shows a looped gradient star with round corners, a sine wave with a width curve (SineWave) and a comet trail (Orbiter).
  • Not yet: vertex colors from imported FBX and glTF meshes (glTF's COLOR_0 multiplies its base color), vertex colors under custom shaders.