I seem to have finally managed finite water (And infinite water)

It's a good thing voxel water looks so pretty with the amount of posts on this blog dedicated to it. Some of the first posts here are about my failed experiments with finite water including the spectacular infinite water bug that created a tidal wave of infinitely expanding water. Well, now that I've managed to create a stable water simulation I was also able to optimize enough to turn that old bug into a feature, infinite water is back:

An unrelenting wall of infinitely expanding water
The entire rendered area can flood without so much as a hiccup in the frame rate. Of course the main focus of this system is realistic water so that's possible too like I showed in the last post but I've fixed up the meshing to give the water sides. Also pictured above are hard shadows from a directional light (Unity Free).






Water is a really fun system to implement, it's one thing that really lets you use a voxel system to its full potential. The real joy with voxels for me at least is having complex systems that are visually represented but are completely dynamic and reactive and that a programmer can build from the ground up as simple rules and relationships between blocks.
While I won't go through my water approach step by step in a tutorial part I'll sit down and write up some pointers from my experience setting this up and researching it that might help anyone else trying to make their own system.

12 comments:

  1. Hey that looks real nice. I'm enjoying your tutorials heaps. Tho I have something different in mind to apply voxeling too.

    ReplyDelete
  2. Quick question, have you changed to using structs per block yet? Or are you using something different? Or did you keep just defining the block things from the Chunk class?

    ReplyDelete
    Replies
    1. I'm still using an array of bytes for the block types, I've considered enumerators for the block types but some of the more special block types use their value in the array as more than just an identifier for which block it is.

      Delete
  3. Wow looks great! How do you put the water on top of the dirt? Is it a different uv map or do you some how blend two layers together?

    ReplyDelete
    Replies
    1. The water is a separate mesh, it raises the draw calls but it lets me update the water mesh without regenerating the terrain mesh every time. And since the water should be translucent the water never changes how I render the terrain underneath it because no blocks are hidden by water.

      Delete
  4. I hope you make a tutorial for this, oh and ive managed to add X crossed meshes ( like grass, flowers and mushrooms ).

    ReplyDelete
    Replies
    1. Oh and also, do you need a script that saves and loads the voxel data?

      Delete
  5. Please friend, and all I would like to learn, and you really a genius, teaches us to do ...

    ReplyDelete
  6. "without so much as a hiccup in the frame rate" that sounds very promising. I got a system like this (I assume) working but I would be very interested in the optimization you achieved to be able to handle infinite flow (in an infinite world?)
    Greetz!

    ReplyDelete
  7. Why does everyone pretty much show you step by step how to do voxel and then "I won't show you how to do water, so FU"?

    ReplyDelete