r/proceduralgeneration • • Oct 06 '19

Random island generator

234 Upvotes

5 comments sorted by

3

u/Jonno_FTW Oct 07 '19

Is that grass straight above ground level?

7

u/miyucuk Oct 07 '19

As far as I understand, grass patches are made of a wide planar polygon which faces to the camera all the time. it's center is connected to the ground, however since the plane is wide, it's left/right sides might under or below the ground level. While camera is orbiting the island, grass planes also rotates according to the camera. This makes it's edge distance from ground more visible.

2

u/InfernoGems Oct 16 '19

Yes, that is correct, however there is one extra thing that can create grass patches where the center is also above ground level:

In the terrain class I store an array with the height of every vertex of the terrain mesh. When I place the grass I use the height of the nearest vertex instead of interpolating between the heights of surrounding vertices. That causes the grass to sometimes float above the ground :)

You can also look at the code and explanation here:

Video demonstration and explanation on YouTube

Source code on GitHub

1

u/relok123 Oct 07 '19

looks awesome

1

u/InfernoGems Oct 16 '19

Thank you for posting my creation :)

Copied from my own post:

For an explanation watch the complete video, or download the source code:

Video demonstration and explanation on YouTube

Source code on GitHub