Search Unity

Ideas needed for workaround for fluid sim on Android

Discussion in 'General Discussion' started by Schneider21, May 14, 2019.

  1. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    I'm doing a little side project for work and need some help from you people.

    I have a pretty basic architectural visualization app that runs on the Oculus Go, which is an Android platform. In that app, I want to visualize the flow of water down a dam spillway. Since this is just for demo purposes at this stage, the simulation doesn't need to be based on accurate modeling, and instead just needs to look convincing.

    I bought Obi Fluid during the May sale, but it doesn't support single pass stereoscopic rendering. I'm trying to avoid going down the road of changing to multipass, since I suspect I'm going to need that framerate boost once I get to the more complicated visualizations down the road.

    I then discovered Blender's fluid simulation and got something that looks great there. But the Alembic file it exports doesn't run on Android. So I exported each frame of the animation as OBJ and made a quick script to toggle each one on in succession (250 objects, one every 1/25th of a second), which works on the PC but crashes the app when the scene attempts to load on the device (presumably from memory overuse).

    I'm kind of stuck now trying to figure out what to try next. Any ideas?
     
  2. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Planes and particles? With some shader water magic
     
    Metron likes this.
  3. Metron

    Metron

    Joined:
    Aug 24, 2009
    Posts:
    1,137
    I join xVergilx in his proposal. Fluid simulation is quite performance intensive and clearly overkill in this situation.

    Some planes with a cycling texture on it combined with sparse particle effects should do the trick.

    Be aware that transparency kills performance.
     
  4. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    Yeah, I understand the actual simulation is resource intensive, which is why I'm trying to bake it as an animation and use that. I don't think I can do what I want with planes and particles in this case. It probably would have been helpful to show the animation from the start:



    Edit: Link if it's not loading.

    This is the 250 objects being enabled/disabled in sequence setup. Worst case, I think I could load a few frames of this animation (maybe 4 frames a second, for 40 frames total) and just have a choppy version of this going. But obviously I'd like it to be as impressive as possible, if anyone knows a good workaround.
     
  5. TheGaul

    TheGaul

    Joined:
    Apr 15, 2019
    Posts:
    199
    I would just use a load of circles in the 2D physics engine. And then put a circle sprite on it that is bigger than the circle collider. This would make all the circles merge together and look like water.