Decouple Water and Terrain

I’m building a level that doesn’t use Terrain but would really like to use Water.

The level is procedurally generated and it is annoying to deal with the fact that Water has to be on a global 4x4x4 grid because I can’t be exactly sure where the boundaries will be ahead of time. I have to design with a +/- 4 fuzziness in mind. So, for example, any tank that has Water in it needs to be at least 4 studs thick and narrow rivers are impossible. This sounds kind of abstract, so here is a hard thing to make look good with 4x4x4 voxels.

Also I don’t like the fact that Water’s properties are global to the terrain, so there is no way right now to have pools of liquid that are different colors. I have to choose whether my game is going to have water, lava, slime, or whatever and I can only pick one. I want to set properties per-body. I also want to trap CharacterEntered/CharacterLeft events per body so I can do things like make lava burn people or make people run out of breath while swimming. Right now this is logic has to go on the Character, which seems like an anti-pattern to me, since it breaks encapsulation. I.e. I can’t take someone’s lava model and drop it in my game, and someone’s slime model and have it also work without editing code most likely.

Global water properties don’t even make sense in games that only use water as water, since at the moment it is very hard to do things like make deep ocean darker than shallow water.

Basically I just want to create a giant Part and set it’s material to Water and get liquid properties on that material.

Water’s always been weird as part of Terrain anyways, since it is the only voxel type where the voxel has two materials (Water + another material) in all the boundary voxels.

As an alternative solution, allowing me to define new liquid voxel types in code would be OK and at least fix the customizability problem.

75 Likes

Echoing your sentiment of wanting multiple different liquids and water of different depths having different properties. Having liquids as their own objects may be more performant also, as you wouldn’t have to generate and replicate potentially millions of voxels just to have large bodies of water. What if I wanted water on a moving object? Can’t do that with voxels.

Also I suppose I’ll throw these old threads in for good measure; this has been a popular request for a good while now:

2 Likes

Most of this is speculation so dont take this at face value.

I imagine the reason Water is included in terrain is to do with the rendering engine. If Water and Terrain are both coupled into the same instance, it allows them to render in a more performant way.

Also it might be to do with the old voxel terrain where Water was also a 4x4 block. (I want that water back btw it was cool)

Then again, they could just put Terrain and Water under the same superclass

BasePart
  VoxelPart
    Terrain
    Water

The water shader is per-pixel, so is the same for voxels vs. parts.

Rasterizing voxels is more expensive than rasterizing parts. Voxel to Mesh Conversion: Marching Cube Algorithm | by Smile Sikand | Zeg.ai | Medium no longer be start of the art)

3 Likes