Random Chitchat 2020-2024
|
08-23-2020, 11:27 PM
(08-23-2020, 04:15 PM)xoft Wrote: There are multiple caches in the worldgen - biome cache, height cache, composition cache. Getting rid of them would be unwise, they save a LOT of work. For example the biome cache measured more than 90 % cache hit rate during startup world generation - that means ~10x speedup just thanks to the cache. That's a very helpful explanation, thank you. I did some testing and after villages and trees are commented out the only thing that hits a cache is apparently height generation, reading 3x3 chunks' worth of biome data. This is to smooth out height transitions between biomes, right? Reminds me of the lighting thread, that also has a 9:1 read amplification when calculating one chunk xD Do you think it would be, theoretically, feasible to generate the terrain first, say with suitably tuned 3D noise, and afterwards retroactively apply biomes based on the terrain height, a temperature map, and a humidity map? This way we can sidestep needing to smooth out height.
08-23-2020, 11:31 PM
Also for trees, I think it's even desirable for them to intersect and cut through terrain; they've had hundreds of years to do it, after all Then trees also wouldn't need to depend on other chunks' data.
Image sourceĀ DevianTart
08-23-2020, 11:36 PM
The Generator.html article did mention the "generate terrain first" strategy as how the natural world does it, but didn't go into detail on why the inverse "biome-first, then apply terrain" approach was chosen.
08-24-2020, 12:16 AM
I assume the tree generator still requires the height of adjacent chunks because if a branch goes outwards to another chunk it needs to know the height where the tree started.
08-24-2020, 01:13 AM
That is a good point, I guess if using terrain-first generation it could do a noise query at one point in the other chunk to figure out height.
08-24-2020, 01:23 AM
Calculating biomes from terrain is incredibly hard.
Why are you so obsessed with getting rid of the caches? Just make them thread-safe, it will be fine.
08-24-2020, 02:07 AM
With independent chunks doing anything with them is embarrassingly parallel, but with a cache, barring just putting a big mutex on any access, a more fine-grained locking strategy would need finesse to get right. Even then, reading from it/writing to it won't be free.
Anyway, just some discussion about hypotheticals. Why is biome calculation from terrain super hard? Maybe even with humidity + temp data we don't have rich enough information to distinguish every biome supported?
08-24-2020, 05:08 PM
How would you even go about calculating the biome from terrain? I assume by "terrain" you mean just the heightmap, or possibly shapemap (solid vs air in 3D), probably not the composition, because how would you compose without biome info?
I suspect you'd want to calculate at least slope from the height, which means calculating differences between neighboring heights, which means you need to calculate the terrain height for neighboring chunks in order to be able to calculate the slope at the edge of the chunk. And you're back to 9:1 amplification, but this time you're calculating terrain ahead of the biomes.
08-24-2020, 05:23 PM
(08-24-2020, 01:13 AM)tigerw Wrote: That is a good point, I guess if using terrain-first generation it could do a noise query at one point in the other chunk to figure out height. Keep in mind we're not generating the height anymore but the shape. From that shape the height is retrieved. I believe the shape is actually generated much smaller and later upscaled to fit an entire chunk, so you might have to generate the entire shape of adjacent chunks. |
« Next Oldest | Next Newest »
|
Users browsing this thread: 17 Guest(s)