1
$\begingroup$

I'm trying to add some details like grass, rocks, trees, etc. to my little procedurally-generated planet. The meshes for the terrain are created from a spherified cube which is split in chunks (chunked LOD).

To do this I've wrote a geometry shader that takes a mesh as input and uses its vertex positions as locations where the patches of grass will be placed (as textured quads).

For an infinite flat world (not spherical) I'd use the terrain mesh as input to the geometry shader, but I've found that this won't work well on a sphere, since the vertex density is not homogeneous across the surface.

So the main question would be: How to create a point cloud for each terrain chunk whose points were equally distributed across the chunk?

Note: I've seen some examples where these points are calculated from intersecting a massive rain of totally random perpendicular rays from above... but I found this solution overkill, to say the least.

Another related question would be: Is there something better/faster than the geometry shader approach, maybe using compute shaders and instancing?

$\endgroup$
4
  • $\begingroup$ Pertubated Fibonacci sphere points? $\endgroup$
    – beyond
    Sep 21, 2018 at 9:13
  • $\begingroup$ Related (and the answer there may be relevant to a solution here): computergraphics.stackexchange.com/questions/51/… $\endgroup$ Sep 23, 2018 at 10:45
  • $\begingroup$ @beyond that sounds like the beginnings of a great answer, if you could add more detail? $\endgroup$ Sep 23, 2018 at 10:49
  • $\begingroup$ You should be able to find the code for creating a Fibonacci sphere. These points are somewhat evenly distributed over the sphere. In order to make it look more real-life like you could pertubate the points randomly on the surface. This way you could make your grass sphere. $\endgroup$
    – beyond
    Sep 27, 2018 at 9:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.