Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Water fluid for 3D game

Discussion in 'General Discussion' started by lolreplay92, Apr 7, 2021.

  1. lolreplay92

    lolreplay92

    Joined:
    Dec 17, 2017
    Posts:
    13
    Hey guys,

    I'm interested in making a 3d game containing a water stream pipe that fill the container (cup or box etc...)
    Do you have any idea on how to start such task?

    Thank you.
     
  2. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    Maybe obi fluid but it depends on the scale of things
     
    Joe-Censored likes this.
  3. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,081
    I can't make any recommendations on this kinda prompt because this could be done with something as simple as a plane being elevated to a more complex shader solution to requiring a physics simulation. You have to be more specific.
     
  4. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,553
    Apply smoke and mirrors and script it. Plane in the container that raises up when you hold container under faucet.
     
  5. lolreplay92

    lolreplay92

    Joined:
    Dec 17, 2017
    Posts:
    13
    I understand that it can be achieved with a rising plane and shader but I also need to fill big objects with water and make my character swim inside it so the water need to have volume so don't know if rising plane can solve that but maybe I just didn't understand.
     
  6. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,753
    Volume is irrelevant.
    You know the ground position, you know water surface position, character between these two points animates swimming. Above water surface point animated falling.
     
    EternalAmbiguity likes this.
  7. Games aren't real world simulators most of the time. It would be beneficial if you stop thinking about these like that. Instead of the "oh, it's water, I need to simulate everything it does", start to break down what you actually want to do into smaller pieces.
    - You got advice on how to solve raising levels and surface
    - you need to figure out how to detect if your player is inside a volume
    - you need to figure out how to trigger changes in player behavior when they enter/staying/exiting from volumes
    - you need to figure out how to show/animate/post-process stuff when it happens, if any
    etc

    Break your goals down into pieces and solve them one by one.
     
    NotaNaN, arkano22, stain2319 and 2 others like this.
  8. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Hi lolreplay, Obi Fluid maker here (saw it mentioned in this thread)

    Honest advice: don't use it -or any other actual fluid simulation- unless you're one hundred percent sure of what you're doing and why, and that there's no other viable alternative.

    Most fluid/water you see in games is not simulated, or at least not fully. There's many tricks to getting believable results that don't involve any actual simulation: from a simple plane and an over/under test, to surface-only simulations, billboards/particles for splashes, a combination of these... 95% of the time you can get away with very simple methods.

    Obi Fluid is intended for the 5% of the time that you cannot fake it and need to use the real (and very resource-hungry) stuff. Antypodish's and Lurking-Ninja's advice is good.
     
    Last edited: Apr 10, 2021
    NotaNaN, Lurking-Ninja and stain2319 like this.
  9. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,553
    Most games fake it. Because simulating it is incredibly expensive and in majority of cases is not worth it.

    For example, if you've seen Half Life Alyx "booze shader", that one's a fake. Smoke and Mirrors.

     
    EternalAmbiguity and arkano22 like this.
  10. lolreplay92

    lolreplay92

    Joined:
    Dec 17, 2017
    Posts:
    13
    Thank you all for your help, I just made a plane with a double sided water material to see the ripples and then used post processing to illustrate underwater effect in case the character goes below water surface.