I'm moving from working on 3D block-world terrain to more specific features like tree leaves and ore veins (the ore veins will likely be done with my existing Perlin noise for the terrain). One thing I'm having with is properly generate clusters of blocks (for example, leaves for trees).

I've tried looping through a radius and randomly skipping blocks so it seems more natural but this still doesn't look natural enough and also makes it based on a cube shape to start. I want some trees to have more of an overall sphere-shape to the leaves, or some to have a cone shape. I haven't really found helpful info on how to loop through coordinates of shapes other than a cube.

What technique(s) should I employ to generate natural looking clumps of tree leaf blocks?

  • \$\begingroup\$ Do you want leaves made of cubes, or leaves instead of cubes? If you don't need such features to be constructable/destructable, you could just have a node type of "leaf" and render an arbitrary mesh there. \$\endgroup\$ Commented Dec 4, 2013 at 2:21
  • \$\begingroup\$ Leaves as cubes. Similar to Minecraft. \$\endgroup\$
    – BotskoNet
    Commented Dec 4, 2013 at 2:23
  • \$\begingroup\$ I can't understand why you removing random voxels, while you explicitly want to remove voxels that are not inside of some shape (e.g. sphere or cone)? You don't know how to detect if some coordinate is inside a sphere? \$\endgroup\$ Commented Dec 4, 2013 at 8:43
  • \$\begingroup\$ Because nothing in nature is a perfect shape, so a perfect sphere won't cut it. Randomly removing won't work well because it has to be weighted for the edges, blocks shouldn't be missing from the inner areas. \$\endgroup\$
    – BotskoNet
    Commented Dec 4, 2013 at 17:15

1 Answer 1


Would it make sense to generate a tree structure using an L-system, initially ignoring the cube grid, and then clamp the resulting leaf positions to the grid? (ignoring duplicates where multiple leaf nodes map to the same grid cell)

Another possibility: You could randomly generate points within a sphere (some approaches here, if your environment doesn't provide a convenience function for this), and then add a leaf block at each grid cell in a line between that point and the center of the sphere. This will ensure you don't have floating leaves with no neighbours, and the boundary will still be rough rather than looking like a perfect sphere.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .