You can get Voxel Farm now. For more information click here.

Tuesday, August 19, 2014

Dynamic Fluids

You may have caught some of this if you attended SOE Live or if you watched some of the audience videos from the panels.

We have been working for a while on a cellular automata system. The following video shows some early results:



As you can see the automata is producing something that resembles flowing water. I guess with different rules we could represent other phenomena, like smoke, clouds, slime and lava. Water in particular is a tough system because it likes to flow pretty fast.

This system is already able to schedule simulation so areas near the player (or players) get more simulation ticks. Simulation frequency is also affected by how much the system "wants" to change in a given area. For instance a stable puddle of water will get far less ticks than water falling from a cliff.

This makes the solution manageable from a computational point. This approach does create its own set of problems. For instance if nobody is there to experience the water, it does not really change. As someone approaches, the simulation frequency will increase gradually. This is enough to deceive players I hope, the player influence area is large enough to mask the fact that distant water does not update as frequently.

There are a few significant challenges ahead. We need to make sure this scales when we have hundreds of players. Also not everything in a game world is made out of voxels, eventually we would need to make props block and modify the flow of water.

14 comments:

  1. Do you see this being used for things like waterfalls? Do you think a way to replenish water supplies at elevation without using magical water-spawning blocks is feasible? Rain, for example.

    ReplyDelete
    Replies
    1. For waterfalls maybe not at this resolution. This is simulating water at the finest grain possible, just because people eventually will want to create thin containers like bathtubs or barrels.

      But one very interesting application would be to simulate the rivers and lakes at a macro scale using the same system. That would produce waterfalls only that we would not simulate every drop however.

      Delete
  2. Cool. Could this ever support a pressure system? So that poking a hole in a large container would cause it to spray out accurately?

    ReplyDelete
    Replies
    1. Pressure could be possible, but it would take more data in the cellular automata. Right now it is pretty much just one bit per voxel (before compression)

      Delete
  3. @3:37 I see what you designed there.

    This is neato, I was thinking about how you're rendering water. Glancing at the water rendered in the distance, it looks quite nice, but up close there is a little to be desired. I know it's standard practice to reflect higher percentages as the view angle becomes closer to parallel to the surface. But next to zero reflection when perpendicular to the water looks funny. Is it possible to alter reflectivity on both angle to the surface as well as have brighter objects (i.e. the sky) reflect more intensely? That way, water in a dark underground cave lit up with torchlight will be quite transparent up close, but water directly below you on a bright sunny day would pretty much only be reflecting the sun.

    Also, wet textures!

    ReplyDelete
    Replies
    1. Wet textures definitively. On the other hand I am not so sure about spending more time on rendering effects.

      Delete
    2. I would encourage you to do so. I suspect it's possible that as the aggregate water LOOKS more realistic you need less modeling to make it ACT more realistic. Just a thought.

      E.g., perfectly modeled realistic acting water that looks like crap versus highly realistic water that is acts pretty much like you'd expect. Obviously the latter is more desirable than the former.

      Not that your water looks like crap! I'm very excited by your progress and can't wait to see more.

      Delete
    3. Re-reading my comment...bleh. I meant to say that from a player's point of view as far as immersion and/or believability...you may need less realistic acting water the more realistic your water looks.

      Delete
    4. I would think that would be something for a given developer to worry about. They'll have texture artists who can make the water look however pretty they want

      Delete
  4. Awesome work! Water simulation is a difficult and computationally demanding problem. What are your thoughts on scalability of such a system (especially for an MMO)? Would offloading water simulation to dedicated machines/GPUs be an option? It seems like the server demand could easily get out of hand...

    ReplyDelete
  5. Pretty sweet! I think a system that used 'water columns' in tandem with the individual voxels might allow you to simulate even larger bodies of water, for lower cost.

    ReplyDelete
    Replies
    1. We tried these, some people/research call them tall voxels. It did not go well. While it makes some operations simpler, like computing pressure, they are not too friendly with a massively parallel approach, we saw too often the tall voxels had to span over processing barriers. The bookkeeping involved in this was too expensive.

      Delete

There was an error in this gadget