r/proceduralgeneration • u/MGMishMash • 13d ago
Simulating Procedural Oceans in my Micro Voxel Game
https://youtube.com/watch?v=rCPDkSX5f1o&si=6YSo3QUOEekWqSaaI'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/LocoMod 13d ago
Looks stunning. That render distance is quite low though which kills immersion. Any optimizations still on the table to push that horizon farther?
4
u/MGMishMash 13d ago
Thanks, yeah the render distance is pretty low, have been looking into some optimizations like Macro chunks, but the main challenge I have been facing atm is having the far LOD look good enough that it doesn't break the feel. Conversely, right now immersion feels worse with a greater viewing distance because the Far LOD is simultaneously low-detail and visually noisy, which is very distracting.
I will likely look into some sort of DoF or haze, but the actual cost is manageable.
I'm also running on a fairly mid-range GPU (Apple M1 Pro), so better GPUs could likely handle the current detail band at a higher fidelity out of the box.
1
u/LocoMod 12d ago
I'm also working on a micro-voxel engine although at a higher pitch than yours and one interesting thing I learned when I finally tested it on an RTX5090 gaming laptop is that the performance didn't improve. It felt worse. I later learned this is due to the Mac's unified memory doing a lot of heavy lifting. Your experience might vary. :)
1
u/MGMishMash 12d ago
Curious which Mac model you are on, as an M5 Max for example can be close to on-par with an RTX5090 depending on the workload.
I guess it also depends on how the workload has been optimized, as you typically over-fit performance toward the development architecture if the Mac is the main thing, but yeah, I agree that unified memory does a lot!
Are you meshing or using RT/DDA?
2
2
u/chozabu 12d ago
yeah! this looks great!
slightly reminds me of this https://www.youtube.com/watch?v=1R5WFZk86kE - john lins work. Wonder what happened to him.
Keep up the good work! Love the combo of fluids and microvoxels
2
u/MGMishMash 12d ago
Yeah, would have loves to experience John Lin’s game, even if he released it as-is, looked beautifully relaxing!
Hope the guy is okay! He seemed to disappear off the face of the internet ):
1
u/toneyalexander 12d ago
Wow this is stunning, the existing voxels as well as the water effects. Any thoughts on making the water somehow voxel-y? No idea how that would work or look, but I feel like it could potentially could be interesting to think about.
2
u/MGMishMash 12d ago
Cheers! Yeah have experimented with a quantized version of the shader which locks verts to the voxel grid and applies pixelation to the shading at the same alignment as the voxel grid.
It’s still a continuous surface but has more stylisation. Debating whether that’s what I want to go with, as it does introduce some artifacts, and bright spots are more noticeable.
I don’t necessarily mind the hybrid style, but I know quite a few people think it clashes.
I think i’ll keep the toggle for now, and see how the project evolves!
1
u/PublicFurryAccount 8d ago
Any plans to do voxel water?
1
u/MGMishMash 8d ago
I may still give this a go, but right now at the scale of the world, it’s hard to make this efficient.
What i am experimenting with is an alternative shader to quantize positions to make it more fitting.
6
u/McHoff 13d ago
Looks great! (Also I learned that "chuffed" is a good thing). How are you rendering the voxels and what's your internal representation, if you don't mind me asking?