Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Is there any information or tools available for the simulation of fluids such as water in ECS?

Discussion in 'Physics for ECS' started by yifanchu183, Aug 27, 2022.

  1. yifanchu183

    yifanchu183

    Joined:
    Jul 4, 2019
    Posts:
    32
    I need some help to implement fluid simulation and to be able to interact with other entities in DOTS physics.Thanks
     
  2. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    https://en.wikipedia.org/wiki/Smoothed-particle_hydrodynamics

    It's certainly doable in DOTS Physics, the Unity version has source so you'd be able to probably get something going that's performant. Havok would perform faster if using primitives, but for the best performance you'd want to code SPH from scratch in DOTS.

    The real problem isn't the behaviour but trying to get it at a decent performance by spatially dividing up the work, and good luck with that!

    In any case, once it's working you can render the particles to a buffer, blur it, generate a normal map and so on - that's the general way fluids are done with physics.

    You didn't indicate how much realism you needed, the depth, and so on. All these factors will change how much work you'd need, so I gave a pretty basic response.