terrain gen

I’m wanting to make a cubic world, how would I go about generating it with different materials with a procedural mesh?
atm I’m only interested in making:

  • flat terrain with 30 blocks under it,
  • deleting blocks when hit with ray-cast
  • face culling

thanks in advance