Tips and Tricks: Converting SPH particles to GFD particles.

Hi all!

Sometimes we have a simulation which we had used SPH particles like circles, squares, object emitters, etc emitter but we want to add splashes or foam to it in the same way we do for the Grid Fluid Domain. In order to do that, we can convert the SPH particles to Grid Fluid Domain particles by using a batch scripting , and they will work in the same way that the GFD particles do, it means adding splashes or foam to them. Take a look this video to know how to do it and download the script too.

Thanks to Alex!!!

Download the script here convert_sph_to_GFD.

The script will be incredibly faster in command line and for this reason is advisable to run the scene in command line if you have a lot of particles.

luisM.

31 comments

  1. Hola Luis,

    Muchisimas gracias, justo lo que buscaba!
    Lamentablemente tengo un problema con el script :

    Script error : “name ‘Fill_Object2’ is not defined” at line number 3
    ๐Ÿ˜ฆ tienes una idea del porque…hay otra forma de covertir sph en gfd?

    gracias de antemano por cualquier tipo de ayuda!

    Y gracias por toda las informaciones en este blog,la verdad que a mi personalmente me han ayudado mucho!

    1. Hola,

      Tienes que comprobar que tienes el nodo con ese nombre “Fill_Object2” en la escena. ยฟNo le falta sera “Fill_Object02”?.

      Me alegro de que te haya ayudado que eso es justo lo que intento.๐Ÿ˜‰

      You’ll need to check if you have a node with that name in the scene “Fill_Object2”. Maybe, could it be “Fill_Object02”?

      I’m glad that this blog has been useful for you, it is what I try.๐Ÿ˜‰

      luisM.

      1. Hola!

        Gracias por contestarme!
        Perdona en el post anterior me equivoque yo…en el script el nombre del nodo es corecto que como bien dices es : Fill_Object02…pero sigue dandome el mismo error, este error me lo da en -nogui mode puesto que con la Gui directamente se va in crash el programa….las particulas tampoco son muchas como 200.000 y poco mas….

        Muchisimas gracias
        Michele

      2. Hola Michele,

        ยฟMe puedes enviar la escena con el mismo script que tienes? Puedes usar dropbox o similar. Aunque sea el mismo script que puse yo, algunas veces al subir un script a internet se pone un espacio en blanco al final del fichero rfs y hace que el script no funcione. Si el programa se cierra puede ser algo mas grave.

        Could you send me the scene with the same script you downloaded? You can use dropbox or similar. Even if it is the same script I put, sometimes when uploading a script, an empty space is added at the end of the line and it is the cause which is not working. If Realflow is crashing, maybe it is a worth thing.

        Thanks

        luisM.

  2. Hola Luis,

    Bueno…no se porque no se me ocurrio antes efectivamente…tengo problemas con el plano…porque el script funciona perfectamente ( intente con un plano de prueba como lo del tutorial ) !!!

    Tendre que ver que pasa con este plano….ยฌ_ยฌ”

    Muchas gracias!

    1. Hi Dennis,

      Yeah. It is possible. You can’t get the particles from a RealWave directly, but you can get the faces or vertices, so you can simulate the realwave and adding particles by scripting for each frame with the vertices position and removing the particles for the previous frame. The new particles will be created in a new container so it can save the bin files. Maybe I can do an example.

      Another option is exporting the bin files for realwave particles when checking the Particle Layer parameter and then loading the particles with a Binary Loader and applying the script.

      I hope it helps.

      luisM.๐Ÿ˜‰

  3. A friend of mine tried this with 2013 and he told me it only gives him the last frame. We could really use some help.

    1. Hi,

      I’ll do some test with this script. Anyway, there was a daemon to convert the sph to grid domain particles, but unfornutately it was only for RF2012. We can try to make a graph to do this.

      luisM.

  4. Hello

    I’ve tried your script with RF2013, it worked great, whoever it only save the normal particles into Hybrido’s particle, the Hybrido’s field cache is empty, it’s 2kb each frame. I tried to make a splash but it didnt work, as it turns out looks like RF2013 need the field cache make secondary simulation like splash and foam. Do you have any suggestion?

    Thank you very much for helping!

    1. Hey,

      I think it is easier to make a graph to make that conversion. I’ll try to do this graph later. That script is not sure that it is really working with the new hybrido format. I’ll let you know.

      luisM.

  5. Hi all

    has anyone found a way to does this in real flow 2013 yet, I read the last post I was wondering if there’s been any updates. I was trying to do something just like this but with the beer foam script from the next limit website but no luck it doesn’t look like any of the script like the beer or this splash one work in real flow 2013 anyone found a work around.

    Thanks You very much for the help.

    1. Hi Carl,

      You can do it by using a graph where you sent the particles from the sph emitter to the splash emitter. It is simply getting the position and velocity and create that particle in the splash emitter. Once the particle is created will have all splash info to generate foam, for example.

      luisM.

      1. Hi Luis

        I’m new to real flow 2013 so bare with me are you saying all I have to do is use the same script but make adjustments in the graph area

      2. Hi emanuel!,

        Yeah, that is. The same script should be working in RealFlow 2013 too, but you’ll need to do some changes regarding the names for emitters. Now they are called with scene.get_PB_emitter(” “)๐Ÿ˜‰

        luisM.

  6. Hi Luis,
    the script works when it comes to convert the sph simulation to gfd. However when i add splashes or foam nothing happens. I know other people had the same problem and you tried to give a solution, which is quite cryptic to me. Can you explain in simpler terms? for example, what does it means “You can do it by using a graph where you sent the particles from the sph emitter to the splash emitter” ?
    Thanks for the great work.
    Francesco

    1. Hi Francesco,

      As far as I remember, that script was made for RealFlow 2012 and it is possible it is not working for RealFlow 2013. The best option you have in, in graphs, to get the particles position for your sph emitter and create a new particle for a splash emitter adding the particle to the splash and removing it from the sph emitter. It is basically the same idea in this script but it would need to be implemented for graphs. There is a scene “hyflip splash” in demo scenes which might help you.

      luisM.๐Ÿ˜‰

  7. hi luisM,
    The link looks like dead .. can u upload it again or mail it to me. thanks and nice work of conversion. Hoping that this would help me.

  8. hi luis,

    i am new to realflow and i get the idea of converting particles . i am stuck at the script. i am getting a error “object of type ‘realflow PB emitter’ has no len()” at line number 4. can u help me with this
    thanks for the great work .

  9. I’m not sure if you’re able to answer this, but I’m having problems with the workflow. The script works fine, I get my SPH particles converted to GFD particles. However, when I try to add in a HY_Bubbles node, splash OR foam, nothing appears. The converted GFD particles are still there, just no secondary particles ever get emitted.

    I’m using Realflow 2014 and I suspect this is the problem. Any ideas? Thanks!

    1. Hi tim,

      That is correct. It is due to you need the distance field also exported to generate secondaries for hybrido. I mean, the vbd, gfc or f3d files. If they have not been generated, the secondaries can’t be created. You can do it with a graph sending the particles from the first Hybrido domaind to another Hybrido domain with its vbd checked to export. In this way, when simulating, the vdb and rpc are created for the second hybrido domain and you will be able to generate secondaries for it.

      luisM.๐Ÿ˜‰

  10. Hey man, how are you? First of all, amazing tutorials in here, dude. Thank you so much for this.
    Actually I’ve already used this one, for about 2 years ago?
    Ok. But now in RF2014 I can’t get this to work. It should work? Like, the same script?
    Thank you so much.

    1. Hey,

      I’m afraid it won’t work with RealFlow 2014 because the formats are not the same. Maybe the id you need to convert the particle is different now. But now it is easy to convert sph particles to Hybrido particles with a graph. I guess you wanna them for generating splash or foam, right?. In that case you will need to import the particles with a graph in FramesPre, and send the particles to the new Hybrido which will be active, while RealFlow is simulating, so it can generate also the fields vdb or gfd as they are necessary to generate the secondaries particles. I hope it helps. It is almost the same process you have for the RealWave to Hybrido tutorial but loading particles instead using a RealWave. I hope it helps.

      luisM๐Ÿ˜‰

  11. Hello Luis,
    thank you for your time and knowledge and sharing with us:)
    I wonder if a invers process is possible. Transfering from a DY emmiter to a standard emitter. Also, i followed https://www.youtube.com/watch?v=iMhq7Eq9iOk It works great, but my foam emiter doesn’t keep the same shape as the liquid emitter. It’s bigger, and it goes trough the geometry walls. i tried all the volume options (inside, outside, shell), i even changed my geometry to be open not closed, but it’s the same result. The foam particles are being emited around the liquid shape, instead of going inwards and going up to the surface.
    any idea why ?

    1. Hi Mario,

      You will need to adjust the Hybrido cell size to match, more or less, the Dyverso resolution so they could have, more or less, the same numbers of particles in a hypotethic simulation. It is probably you will need to set the Hybrido Cell size with a 0.1 cell size value.

      luisM.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s