21
$\begingroup$

As stated in the title, I want a particle system that will have particles heat up and rise, and then sink when they cool. How can I simulate this?

Additionally, I want to make sure the particles attract each other and move around on the x and y axes.

The end goal of this is to make physically accurate cumulus clouds (the puffy, flat bottomed ones), where the particles are emitters for a smoke simulation.

$\endgroup$
0

5 Answers 5

19
+150
$\begingroup$

EDIT: Per Erik's comment...

Here's an example of a Node setup where the individual particles are on their own program. I changed the particles to be emitted over time instead of all at once to give a little more separation between particles . The smaller particles move faster than the larger ones but you can easily remove that if it doesn't suit your requirements.

The modulus operator (Math Node) is for looping the simulation indefinitely. This setup essentially uses the Minimum of the two range nodes as well as the length of time the particle has been living to determine where the particles should be along the Z-axis.

enter image description here

Of course there's a lot of room for tweaking, improvement, randomization, etc. In this gif, I added a little velocity in the X-direction using Blender's own particle settings.

enter image description here



EDIT 2:

Just saw your edit to your question. Here's an example with smoke simulation. You just need to add Smoke to the original object and make sure you select Copy Full Object so that it also copies the Smoke sim with each Instantiation.

enter image description here

enter image description here



EDIT 3 (per Erik's comment):

The single-tri smoke emitter objects will simply have no bearing on bake, simulation, or render times. Blender will crash from the smoke and particle sim long before the number of triangles.

I would concentrate on making the smoke more realistic before adding more particles. I understand that you'll need more than hundred, but the smoke is going to be the makeup of the cloud and there's a lot of "tweakability" in the smoke sim. The particle objects are only for emitting and serving as a method to give you control over location.

Here is a sim with a little bit of turbulence added (affecting the particle objects and the smoke). Sorry it's so small and crappy, I had to keep it under 2MB for upload:

enter image description here

And here's a happy little cloud render from this scene:

enter image description here

Here's the unbaked blend:

$\endgroup$
5
  • $\begingroup$ I'm new to animation nodes and particle systems, so I apoligize in advance if any of my suggestions are easily implemented. This looks promising, but the particles seem to be rising and falling all at once. They are also not moving on the x and y axes. If there was a way to animate the particles based on the particle's individual "heat" score, I believe they will be more accurate. $\endgroup$
    – Erik
    Commented Aug 5, 2017 at 3:49
  • $\begingroup$ This seems to be getting really close to the desired result. Since I am planning on using lots of particles, I was wondering if there way a way to move the particles themselves instead of replacing them with cubes (for performance reasons). If not, is there any way to at least remove the relationship lines? $\endgroup$
    – Erik
    Commented Aug 5, 2017 at 23:29
  • $\begingroup$ @Erik - In the smoke sim, there's 150 particles and they are single-face objects. Using the smoke system, you can also change the Flow Source to be a particle system, so you may not even need geometry. Nothing in the above gif is rendered. The relationship lines are just FYI and the faces are invisible when rendering. You can also use a wind generator to blow the particles around. $\endgroup$
    – bertmoog
    Commented Aug 6, 2017 at 0:27
  • $\begingroup$ I don't think I can make the particles emit the smoke since the z coordinates for the particles are not changed by the nodes. $\endgroup$
    – Erik
    Commented Aug 6, 2017 at 16:52
  • $\begingroup$ @Erik - please see edit $\endgroup$
    – bertmoog
    Commented Aug 6, 2017 at 21:48
10
$\begingroup$

Use fluid particles and a set of force fields

enter image description here

I use two opposite Wind force fields (B1-2) with "Plane" shape and quadratic (2.0) falloff. Together they determine the midpoint of the Z-region around which the particles will move.

The convection itself is given by two other Wind force fields (C1-2) that, in addition to the quadratic falloff, have a "maximum distance" (displayed by the little dotted circles around them): in this way they act as local forces that "bounce back" the particles that are going too up or too down, which results in convection forces. The stronger these force fields, the more obvious is the convection effect. [[ Edit: raising the timestep from the default 0.04 to a slightly higher value of 0.06 makes the convection more evident too ]]

A weak Turbulence force field (D) and a collision box (E) assure that the particles keep moving and don't escape the scene.

My particle system (A) is emitted from a plane, with random velocity (average = 0), during the first 50 frames. To add some randomness, I've used a Cloud texture to affect the surface emission density.

Important: the gravity field weight must be set to zero (or you can remove B1 and make B2's falloff power = 0.0) [[ Edit: a value of 0.006 - very small - can lead to a "flat bottom" effect that can be desirable for clouds ]]. To make the particles attract, the Physics should be of Fluid type. I have reduced Stiffness and Viscosity to 0.2 and 1.0, otherwise some fixed-size clusters and fibrils start to appear. The Size setting determines the size of the cloudy features (clusters), in a not so obvious way: you should play around a bit to find your optimal parameters. Also, I've used some Brownian force to introduce randomness.

Diagram

If you want to see actual cylindrical vortices, you can add several Vortex force fields with Tube falloff along the X axis.


Here is my .blend file. Note: you must bake the particle physics yourself!


Update: with the "flat bottoms" edit and a simple smoke simulation, the results looks like this (top = particles; bottom = smoke)

enter image description here

Here is the blend file. To try it out, first you must bake the particle system, then the smoke domain.

$\endgroup$
9
  • $\begingroup$ I've downloaded your blend file and messed around with it. The particles clump together and move around realistically. However, it seems to lack the flat-bottomed, puffy-topped shape of cumulus clouds. Maybe with a few more force fields this could be implemented? I'm not sure as I am new to particles. $\endgroup$
    – Erik
    Commented Aug 5, 2017 at 23:25
  • 1
    $\begingroup$ Really like this answer and how this solution simulates the temperature gradient and "clumpiness" mentioned in the question, all without add-ons or scripting. $\endgroup$ Commented Aug 6, 2017 at 21:40
  • 1
    $\begingroup$ @RichSedman thanks! Actually, in principle, the Particle and Force Field systems give you enough room to create almost every kind of motion, provided that the motion's force equation can be made dependent only on each object's size, mass, position, velocity and charge (i.e. electrostatics and mechanics). In this case, however, we need to cheat a little because temperature and heat exchange are involved too in the problem specification! $\endgroup$
    – Nicola Sap
    Commented Aug 7, 2017 at 7:32
  • 1
    $\begingroup$ Although you have not been selected as the answer, this is still a great solution and is arguably more elegant. It also seems to be more accurate when it comes to how the particles move and the clumping, though it is harder to tweak and the clouds aren't as puffy as I would've liked. $\endgroup$
    – Erik
    Commented Aug 7, 2017 at 21:19
  • 1
    $\begingroup$ @Erik thanks. I like the approach of the selected answer as well, it's something clearly very effective that I couldn't have thought of $\endgroup$
    – Nicola Sap
    Commented Aug 8, 2017 at 5:47
4
$\begingroup$

If you do it with a smoke simulation you can animate the temperature difference. Positive numbers will make smoke rise, negative values will make it fall.

enter image description here

$\endgroup$
2
$\begingroup$

A completely different approach is to write the code that simulates the evolution of the positions and temperatures of the particles according to the laws that you choose, and pass its results to Blender.

Edit: here is the code that I use to import the positions of the spheres. The positions are saved as files (one file per frame, positions_001.dat, etc) containing the positions. The positions of the particles are given by three numbers on a line. It is certainly not the cleanest way to do it.

import os
import bpy
import numpy as np


frame_min = 0
frame_max = 200

dataDir  = 'positions'
dataBase = 'positions_'

def my_handler(scene):  
    locSpheres = ReadFile(dataFiles[scene.frame_current])

    for i in range(len(spheresList)) :
        scene.objects[spheresList[i]].location = locSpheres[i]  


def list_files(directory, scheme) : 
    list_all = os.listdir(directory)
    n = len(list_all)

    list_data = [directory + '/' + dataBase + str(i) + '.dat' for i in range(n)]

    return list_data



def ReadFile(input_file) :
    A = np.loadtxt(input_file)
    n = np.shape(A)[0]
    spheres = [list(A[i,:]) for i in range(n)]
    return spheres


def construct_scene (dataFiles):
    sLocs = ReadFile(dataFiles[frame_min])
    nSpheres = len(sLocs)
    print(str(nSpheres) + ' spheres')

    print('Creating spheres…')
    for i in range(nSpheres) :
        bpy.ops.mesh.primitive_uv_sphere_add(location = sLocs[i])
        bpy.context.selected_objects[0].name = 'Sphere_' + '{0:04}'.format(i)

    global spheresList
    spheresList = ['Sphere_' + '{0:04}'.format(i) for i in range(nSpheres)]


    nFrames = min(frame_max, len(dataFiles))

    bpy.context.scene.frame_start = 1
    bpy.context.scene.frame_end   = nFrames

    print('Updating positions…')
    for f in range(frame_min, nFrames) :
        print('Frame ' + str(f+1))
        bpy.context.scene.frame_set(f+1)

        locSpheres = ReadFile(dataFiles[f])

        for i in range(len(spheresList)) :
            bpy.data.objects[spheresList[i]].location = locSpheres[i]
            bpy.data.objects[spheresList[i]].keyframe_insert(data_path="location", frame=f+1)



dataFiles = list_files(dataDir, dataBase)

print(str(len(dataFiles)) + ' files found')

construct_scene(dataFiles)
$\endgroup$
1
  • $\begingroup$ Please can you elaborate how to manipulate the position of particles in this way. Presumably a handler on change of frame - but how to read and set the list of particles and their properties? $\endgroup$ Commented Aug 10, 2017 at 21:32
1
$\begingroup$

You can animate the gravity (on the field weights) for the particles.

Set it to a negative value to have the particles rise, then make keyframes to bring gravity back to 0 and then to positive values to make the particles fall down.

Note that by default the slider for gravity won't let you slide to values lower than Zero, but if you type a negative number it will accept it.

enter image description here

$\endgroup$
2
  • 3
    $\begingroup$ Unfortunately, I need the some particles to be rising and some to be falling at any given time. $\endgroup$
    – Erik
    Commented Aug 5, 2017 at 3:47
  • $\begingroup$ You could have a field effector that has fall off $\endgroup$
    – 3pointedit
    Commented Apr 26, 2018 at 4:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .