Painting terrain details (e.g. grass billboards) programmatically?

In Unity, is it possible to paint terrain details such as billboarded grass textures programmatically? (The kind that appear vertical and wave according to wind settings.)

What I know so far (or think I do):

  • Terrain.TerrainData.terrainLayers holds the textures (dirt/rock/grass/etc.) that can be painted “flat” onto the terrain
  • Terrain.TerrainData.detailPrototypes holds the billboard-able grass/vegetation textures that can be painted to appear vertical / waving in the wind
  • Terrain.TerrainData.treePrototypes holds the 3D tree models imported for placement
  • Terrain.TerrainData.treeInstances (I would guess) holds actual placements of trees on the terrain

What I don’t know:

  • MY MAIN GOAL: “Paint” billboarded grass details at specific positions on the terrain programmatically
  • Alphamaps (and splatmaps??) seem to figure into this somehow, but I don’t know how
  • Unity’s example found here “blend[s] the two terrain textures according to the steepness of the slope at each point”, but that’s not exactly what I’m trying to do.
  • I also found this fairly ancient (2014) blog post, but I don’t see any reference to adding billboarded brass details in it either.

Hopefully this makes sense to someone willing to point me in the right direction.