Search Unity

Pipe(line) Dreams: Water/Terrain interactions

Discussion in 'General Discussion' started by Tazling, Mar 20, 2017.

  1. Tazling

    Tazling

    Joined:
    Jan 26, 2017
    Posts:
    25
    Bringing this discussion over from the Neverending Gaia Thread... I would like to model PNW islands with a lot of fractal, heavily indented coastline... and so water, and especially water with fairly convincing wave trains and shore break, is a big issue for me. One of the things I've noticed with dismay about the water packages I've tried so far is that they don't honour landform interference fx. Maybe this would just be too insanely complicated to model? What I mean is:

    Say you have a prevailing wave train in Suimono or Hydroform or whichever package, with waves rolling towards an island. Now imagine that the island has a central lagoon opening to leeward, with a bit of tree cover and some land height to windward sheltering it. I have experimented with these 2 packages and they are good 'uns, but in both cases the sea state to windward of the island continues rolling on identically right through the lagoon and on the leeward side of the island. Here's a crude and sloppy sketch (via sketch.io).


    This is so counter-physical... and for me, as a sailor and coastal animal, a major illusion-breaker. The prevailing swell should not continue into any water surface sheltered by a landmass. And the surface riffle on a protected body of water should be smaller and finer than the surface riffle (wind chop) on the exposed body of water, given the same wind. There should be a "tail" of flat water to leeward of an island, proportionate to its elevation. [Realistically, the prevailing swell should also curve around the landmass -- be it point, peninsula, island -- in the way we are all accustomed to. It should also bounce off the hard shoreline (reflection waves, additive waves) but hey, I'm not asking for perfect physics, just for a way to avoid the most jarring illusion-breakage :)]

    Some attempt is made by some devs to vary wave heights with sea bottom: Hydroform doco iirc says waves will dampen in shallower water. Alas, this is weirdly counterphysical as any sailor or surfer can tell you... wave trains initially get taller when they hit shallower water, not shorter :) It also means that you can't have a deep, beautiful diving pool (or underwater cave entrance!) sheltered from open ocean by a peninsula or reef (not with Hydroform anyway); if there are ocean waves outside, they will not be masked by the peninsula but will roll right through your pool/cave (unless you make it a shallow puddle? I'll have to try this). IRL there are plenty of lagoons in e.g. Hawai'i with a barrier reef that tames the prevailing heavy swell, rendering the lagoon smooth and suitable for kids to swim in. I'd like to model them.

    Sorry, this is getting a bit longwinded: but imho it's a serious problem if you're trying to model real-life coastal regions. It seems like the water packages I have seen so far are not trying to model the behaviour of real water but instead to produce a surface, cosmetic effect (which they often do quite beautifully!) -- unlike Blender's water models for example, though I have to admit those are horrendously expensive in processing time & that is probably why the Unity models are cheating. If anyone has addressed this problem successfully I'd be intensely interested to hear what you did. S Pacific islands w/o lagoons, N Pacific scenery w/o peninsulae, fjords, bays etc, are not believable, but sheltered lagoons/bays with a big open-water swell or a crisp wind chop marching across them are equally unbelievable, so I'm hoping someone has figured this out... or I'm just going to have to keep the wind at zero and the sea state flat all the time in my sim, which would be boooring.

    [update] I have a Modest (and ignorant!) Proposal for addressing this issue, after a bit of contemplation. It would be grand if water planes could be built out of tiles, each tile with independently settable params, with (here a miracle occurs) some algorithm for blending where tile edges meet. Thus, the designer of the tropical atoll above would place one tile of suitable size in the lagoon (nearly flat calm, light riffle only), one huge tile to windward (extending to horizon) with the big waves, tiles on either side with a slight change in wave direction, one tile directly downwind with lower sea state etc. Or (more limited, but maybe more do-able, and useful in many circumstances ) might it be possible to "cut a hole" in a water plane (where a terrain with rigidbody intersects it) and in that hole, install a smaller water plane with different settings. That would avoid the wave-matching problem for fully enclosed bodies of water, but would limit the feature only to, say, lakes on an island.

    Neither of these would be perfect water physics, but would be more realistic and less limiting than the current behaviour. In the more ambitious option A, the huge challenge would be synching up/blending the wave forms where the tiles connect, but maybe that could be painfully precomputed and baked into a looping animation. As it now stands, the state of the art in water planes seems to preclude modelling certain kinds of scenery in a realistic fashion, and dang if those aren't the very sceneries I want to model :)

    I don't have anywhere near the skills to write what I'm proposing here, btw :) just doing some wishful thinking. Unity (plus addons) seems so magical at times that it's a shock when I run up against something it doesn't model.
     
  2. cdarklock

    cdarklock

    Joined:
    Jan 3, 2016
    Posts:
    455
    What percentage of your audience is that?

    I mean, I watched the new Iron Fist series this weekend, and as a longtime martial artist it gives me absolute fits to watch them casually mix styles that have fundamentally contradictory philosophies. I had to turn off the critical aspect of my brain and just enjoy the half-arsed attempt they made to contrast different cultural varieties of martial arts.

    The expansion of people's worldview will affect far more people. By saying "look, Chinese and Japanese martial arts are fundamentally different in character" they are putting a Good Thing into a lot of people's heads. But when I am sitting there going "will you make up your damn mind whether to use zui quan or hung gar," 99% of the audience doesn't notice and wouldn't be able to even if I explained.

    Basically, do a reality check on what's bothering you.

    Also, have you tried actually modeling the desired behaviour by making the lagoon a separate body of water with different parameters?
     
  3. Dameon_

    Dameon_

    Joined:
    Apr 11, 2014
    Posts:
    542
    Games have to cheat, because realistically rendering fluid dynamics is extremely expensive. This is true of most game graphics; it's the reason a frame in a 3D movie might take days to render, while a computer typically has to render at least 60 frames in a single second. Everything in video games is about cheating, from AI to graphics to pathfinding, and this will inevitably irk anybody that looks too closely at the details expecting a 100% realistic creation.

    That said, feel free to learn shader programming and create some kind of perfectly realistic ocean dynamics simulation that won't tank FPS. The game world only gets better when people push the boundaries.
     
    Teila, MV10 and angrypenguin like this.
  4. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    Do any of the systems you've tried allow you to mask or blend out the wave effects in a given area? If so then I expect that they have considered the use cases you speak of, they just haven't tried to account for them in their generic algorithms.
     
    Kiwasi likes this.
  5. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    This. It seems like it should be relatively trivial to add on another texture that feeds in wave height. Then you can bake in sheltered zones to your hearts content.

    If you want it dynamic at runtime you will have to do more work. But the same principle should work.
     
  6. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    While I love the idea of realistic waves, my wish would be for the illusion of realistic waves that would still keep the fps at a decent level...after adding everything else into the scene. I like the ones in Suimono, but the performance is not great, although I doubt that has to do with the moving foam on the surface.

    I think this is important. I too am/was a sailor as well as spending many hours of my life doing coastal geology research. But, for most players, it is again, the illusion that works. Unless your game's main focus is the surf zone of an ocean, it might not be worth the realism.
     
  7. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Sounds like you need/want some kind of ocean fluid dynamics simulator thing. Good luck.
     
    EternalAmbiguity and Teila like this.
  8. Tazling

    Tazling

    Joined:
    Jan 26, 2017
    Posts:
    25
    We-e-ell, I have to agree that full-on fluid dynamics is too much to ask of any game physics engine, and as 3d game/sim designers we are always working in the realm of illusion. So I guess I'm just hoping for tools to improve the illusion.

    I don't think landlubbers are necessarily that oblivious to the immersion-breaker... water that doesn't honour landform effects doesn't look realistic as viewed from land, even for non-maritime players. Wave trains that roll right through landform are like a river that flows uphill, or rain that falls right through a roof... It reminds you that you're in a fake environment. We spend so much time getting details right, like translucent foliage on realistic trees of identifiable species, trees and grasses that sway gently in a breeze, atmospheric perspective effects, sun angle, beautiful skyboxes and weather, grain and texture in rock faces... it seems a shame, with so much finely-tuned realism all around, to spoil the illusion with water that so obviously doesn't behave like water.

    Also I was hoping to have my FPS character travel by kayak across bodies of water from island to island. I think there must be at least a million people who kayak casually or seriously, so it's not an utterly tiny potential audience :) and sport/travel sims seem to be gaining some interest recently.

    Actually it's more like 15 million kayakers, as of 2015, in the US alone:
    https://www.statista.com/statistics/191249/participants-in-kayaking-in-the-us-since-2006/

    One of the important considerations for kayakers is sea state, and a common strategic issue is "can I get across windy body of water X and reach sheltered body of water Y, before conditions worsen (or before it gets dark)". A sim in which conditions are always calm and optimal would remove most of the game-like potential... it becomes, dare I say it, rather flat.

    Getting back to How-To: A mask feature imho would be perfect. It would not require massive FD computation, and yet permit flattening (enough to be semi-realistic) where required. I will ask on the relevant threads (for the top few ocean packages), whether this is possible.
     
    Kiwasi likes this.
  9. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Cool! I can't wait to see what you make. :) Should be really nice with your attention to
    details. Be sure to show us on the forums. I would really like to see it work.