#Algorithmically determine if a 2d noise function intersects a 3d chunk

1 messages · Page 1 of 1 (latest)

vestal plover
#

I'm using https://github.com/Zylann/godot_voxel for script-wise generation of terrain. My current approach is to sample a noise function given an X-Z coordinate (and do various transformations or whatever) to spit out an integer value of the surface height. anything below or equal to that value is set to generate as various blocks, anything above is set to air, and chunks that have no blocks intersecting generate as entirely air chunks with a special fill function (which is computationally faster to fill an entire chunk with one type)

The idea is to detect, as soon as possible, if a chunk would contain any blocks at all, and turn it into a surface chunk that does more fine checks to generate or an air chunk that simply fills with air and loads immediately.

My idea is to loop through the bottom 256 blocks and if at least 1 has a valid noise, generate as a surface chunk, but this is quite inflexible and quite likely slow compared to a more clever approach that i'm not thinking of.

Anyone have any ideas / experience with this?

GitHub

Voxel module for Godot Engine. Contribute to Zylann/godot_voxel development by creating an account on GitHub.

#

Algorithmically determine if a 2d noise function intersects a 3d chunk

verbal jacinth
vestal plover
#

the 256 checks are the x-z plane at the very bottom of the chunk (as it's just one height value per block)

verbal jacinth
verbal jacinth
# vestal plover I'm using https://github.com/Zylann/godot_voxel for script-wise generation of te...

My idea is to loop through the bottom 256 blocks and if at least 1 has a valid noise, generate as a surface chunk, but this is quite inflexible and quite likely slow compared to a more clever approach that i'm not thinking of.
Not sure I really get what you mean here, but you can take advantage of the properties of noise by spacing out the samples.

Like, sample every 4 blocks, and then do it again but with a 2 offset,
0 > 4 > 8 >12 > 16 and then 2 > 6 > 10 > 14. The reason is because if you have 0 noise at a position, you are more likely to have 0 noise surrounding it than not since noise is generally clustered.