Added: 4 years ago
From: jahkr
Views: 3,543
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (19)

Sign In or Sign Up now to post a comment!
  • Hi! Nice demo!

    Do you use particle-particle collisions or is it a collision-free model (use pressure force)? Thanks!

    

  • Thanks for comment.

    The SPH (Smoothed particle hydrodynamics) model uses the "interaction" between nearest particles to calculate the pressure. Then the presure gradient is used to get the acceleration.

  • I have noticed that when a fluid particle falls on the free surface, it bounces back up, also causing the free surface particles to almost form a void. Why?

  • Could you explain how you did this? I tried to make something like this, but the particles clustered into a ball.

  • im not the one that did it but I have done a lot of experimenting with sph (check out my channel, the water oil one is the most recent ,its at the bottom) but before anything get farmialliar with verlet physics if you are not already. I make a constraint between all particles touching eachother (within a certain radius). now the springyness of the constraint depends on the distance and what you want your fluid to look like. Then simply solve all of the constraints. :)

  • Thanks for the help :] I posted that several months ago & already found this out. It's still unstable, but I know the problem & I'm just not smart enough right now to find the single magical line of code that would solve my problem! :)

  • to solve my instabilities/compression, I just solve the constraints 3-4 times a frame... it took me forever to figure out but it only took 3 minutes to code it in

  • My problem is figuring out how to move the particle to a certain distance away from a particle. I know how to figure out how much it has to move, but I can't figure out how to apply it. It's probably really simple, but I really have no experience in this kind of math.

  • oh yeah. it took a bit of experimenting for me to figure this out.

    in my engine the user gives the following parameters:

    outer radius

    inner radius

    inside springyness

    outside springyness

    even the best of engines is unstable if these values are not experimented with

    the outer radius is how far the particle has to be from another particle before they interact

    the inner radius is the ideal distance between two particles

    continued...

  • now first I calculate the distance

    dx = x1-x2

    dy = y1-y2

    dist = do the distance formula

    then I divide the dx and dy by the distance to give me a vector one unit long

    dx = dx / dist

    dy = dy / dist

    then multiply that by the length you want it to be like this to account for elasticity:

    continued

  • dx = dx * (length*elasticity + dist*(1-elasticity)/2

    same for dy

    and you have a solved constraint/force between the particles

  • Comment removed

  • to answer your question luke that got removed for some reason? idk why

    no I was just saying how to do the part that said "physics stuff here" and make sure you have a variable to make sure you only check collisions once between all points like so

    for i:point = eachin pointlist i.done = true for j:point = eachin pointlist

     if i.done = false then 'do physics stuff endif next

    next

    i suspect this is your problem

  • also you might want to put your types into arrays instead of lists... its generally much faster

  • If you use a double loop the program works very slow (because is n^2 order), will be better to do list with the particles in collision with each one at every time.

  • thats why I use fixed grid and other stuff but I figured that might complicate rather than simplify things for luketheduke since he was just asking how to make the water react right

  • lol, I know that there are much more efficient ways of doing it, but I just wanted to do the easiest way for me. Thanks for all of the help. And natethegreatBlitzMax, I deleted the comment. I think I was going to ask another question or something, but I had solved it myself.

  • cool, well im glad I helped

  • :] It worked! Thank you! It's extremely inefficient, but it works!

  • no problem... and you must use a fixed grid optimization if you want maximum efficiency :)

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more