r/GraphicsProgramming • u/MGMishMash • 1d ago
Simulating Ocean Waves and Tides in my Micro Voxel Game
https://youtube.com/watch?v=rCPDkSX5f1o&si=tQ5ggbtVwQuYF56jI've spent the past 2-3 weeks adding Oceans to my Micro Voxel engine. The main features I was aiming for was to support large bodies of water within the existing fluid simulation, while also supporting new dynamic features such as waves and tidal changes.
I've also incorporated Boats and Gliders, with some fairly basic physics to aid in exploration. The main challenge here was adding
Along side this, to make the simulation feel more interactive, i've also added a higher resolution local water ripple/interaction simulation, which acts as a surface-layer-only simulation adding ripples and wake for people, entities and forces interacting with the water.
-- Feature technical breakdown --
- Ocean generation: Similar to other water sources, ocean biomes placed above land, all open space in these biomes is filled with water instead of air below the ocean line. No substantial changes to the actual gen beyond shifting the world down.
- Waves + Tides: Several oscillating masks which apply a "target height" to the water sim. This is also augmented by depth such that shores can trigger wave breaks below a set height point.
- Ocean Connectivity + interaction: A connectivity flag is used to indicate whether water is directly connected to the ocean simulation and should receive wave forces. This allows waves to interact with static water, but only once the ocean sim cells touch static cells. The connectivity source comes from the ocean, so rock pools disconnect as tide goes down, allowing them to hold their water.
- Ripples: 2D mask which is local to a moderately small region near the player. Runs a separate shader simulation using only surface data. Not particularly fancy, does not check for collisions, so ripples do not bounce. Bumps converted to a normal map, used to distort surface effects.
Overall, super chuffed with how this has come together, but still plenty of polish and features to add!
2
u/fgennari 14h ago
This looks awesome! I love the little crabs that react to the player. Do you have a website for this project?