I’m making planets, I have all the terrain and everything. I’m at the point where I’m generating grass with a compute shader and plopping down trees with object pooling. They work fine enough (well they at least can put something down where I tell them), but for this and other reasons, I need to define some kind of chunking system so I only load what I want within a certain range and don’t need to run over every single point on the planet to find the 0.2% I actually need.
My first thought is to create a spherical array of chunk zones using the the direction from the center of the planet outward. In 2D, this would be slicing up a pizza and determining where you are on the crust by the vector from the pizza center to your position. If you’re past a certain threshold angle x, say 46 degrees, it knows you’re in the chunk “45-90” based on your vector, and then the nearby chunks are the vectors that lead to “0-45” and “90-135”. Like a 2D grid where your index is based on your cartesian coordinates, each 3D chunk index would have three values corresponding to it’s angle/vertex.
This is only my first thought and I’m positive there’s a nice simple way to go about this. I’m posting to see if anyone has any advice on where to look for some applications, or has general advice, or realizes I’m already overthinking this or making a mistake. This is a difficult topic to search as the vast majority of terrain-related results lead to the terrain itself, and anything related to chunks takes you to minecraft (though that may still be somewhat relevant).