4
\$\begingroup\$

I have implemented a basic particle system using transform feedback in openGL, hoping to replicate a dust cloud.

I have looked at methods of adding turbulence, such as vortices found here.

But they do not give the desired effect. The guide discusses the idea of using perlin or simplex noise to add turbulence.

But I don't understand how this is done?

Would you use a pre-generated noise texture and take sample data from it?

Or calculate data at run time in the shader?

What is the basic idea behind implementing noise turbulence?

Edit: My main question would be, how do you get a turbulent velocity from noise values?

\$\endgroup\$
  • \$\begingroup\$ I believe textures are often used because it is still cheaper to sample from a texture than to compute the noise values on the fly. \$\endgroup\$ – glampert May 1 '15 at 3:46
  • \$\begingroup\$ But how do you get a turbulent velocity from the noise texture? \$\endgroup\$ – getmad12 May 1 '15 at 8:57
  • \$\begingroup\$ I suppose the texture would already have the pre-calculated coefficients?... \$\endgroup\$ – glampert May 1 '15 at 17:36
  • 2
    \$\begingroup\$ Brutal Legend got nice results with a technique called Curl Noise - worth taking a read of the published papers on it. \$\endgroup\$ – DMGregory May 5 '15 at 2:29
1
\$\begingroup\$

If you want 3D I gues one easy way of getting a velocity for a particle would be to input it's location into a noise function trice with a different seed for each one and then use the output numbers an x, y and z velocities.

Another and better way would be to generate two random numbers with the method I mentioned before: rand1 and rand2 that will be between 0 and 1 and use them to get a random uniformly ditributed poin point on a sphere witch can be used as a dirrection vector and scaled as needed. Like so:

    theta = 2 * PI * rand1;
    phi = acos(2 * rand2 - 1.0);
    velX[i] = cos(theta) * sin(phi) * scale;
    velY[i] = sin(theta) * sin(phi) * scale;
    velZ[i] = cos(phi) * scale;

A good way of doing this is to use 4D perlin noise, with the first three dimentions being position and the fourth being the seed. To increase performene you can make an array of the velocities and the velocitie closest to a particle will effect it. You can also add variations to the flow by adding time to the seed but it won't be as efecient because you'll have to recompute the values.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.