How would I go about disabling the override that "terrain:WriteVoxelChannels()" makes?

Hi,

The title is pretty self explanatory - I’m wondering how I’d go about stopping “air” voxels from generating.

To provide more context, the image below contains 2 layers; first being sand, and water on top. The sand is getting overridden once I call terrain:WriteVoxelChannels().

Now, there’s no problem in the image above, however the problem begins when I want to generate my islands via terrain:WriteVoxelChannels(). As you can see in the image below, the island generates (as it should) but the sand gets overridden at the bottom, which of course, isn’t the intended result:


The system I’m using is a chunk system which generates pure ocean. Via perlin noise, I then procedurally determine where an island should be created. If the noise value is above a certain threshold, it generates an island at that chunk. But some islands can be larger than the chunk, and the island seeps into other chunks (which is intended behaviour)

Additionally, I make sure to draw the water and sand after the island has finished generating, but of course, I can’t account for other surrounding chunks, hence the island gets rid of the ocean bed around neighbouring chunks :frowning:

And one last bit of context, the islands themselves aren’t procedurally generated, I have a “region part” which acts as a well, region. And once the server initiates, I read the voxels in said region part and save it in a variable, where later when an island has to be generated it’ll simply read the voxel data, reposition the region at the chunks position and write the voxels.

Sorry for so much information!


Given this context, is there anyway that I could use terrain:WriteVoxelChannel in a “better” way to avoid the occurrence of air voxels from being written? Any help would be greatly appreciated, thank you :slight_smile: