Archived

This topic is now archived and is closed to further replies.

Creating wind turbulence

This topic is 5126 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I''m interested in animating a piece of cloth with some wind turbulence. How would one go about achieving this? Right now, I create a random displacement map of for my cloth and animate it using a sin function so it looks like it''s moving back and forth a bit. What''s a better way? I would like to keep a displacement map ( maybe noise function? ) and just animate this displacement map. This displacement map would be added to the actual cloth to reach the desired effect. Oh, by animating the displacement map, I mean: mad cloth_vertex_pos, cloth_vertex_pos, displacement, sin ( time ) As you can see, it just displaces the cloth_vertex_pos with the function sin( time ). Any thoughts? Thanks!

Share this post


Link to post
Share on other sites
You might look into using Perlin noise (or even a Worley cellular texture) to generate your displacement map. Your best bet is going to be to add up several different "sizes" of a function to produce a complex-looking map; you can find information about this by looking around for fractal texture generation or procedural texture generation. Hugo Elias has a good article on Perlin noise which should get you started.

Share this post


Link to post
Share on other sites
Realistic modeling of the turbulence would require flow equations interacting with the cloth, which is a rather unrealistic plan. Perlin noise can give nice turbulentic-looking wind as well. The problem is that computing the noise for each cloth element can turn out to be very slow.

From your post it''s not clear wether you''re physically modelling the dynamics of the cloth or not. But in the case you are, a nice alternative is to use a single wind force for the cloth. It is very fast, and the cloth dynamics will automatically make the wind affect the cloth in an unpredictable but physically plausible way, giving a quite realistic look to the cloth. Given a wind vector w, you can add a random component to it on each frame like this:

w = w*(1-a) + RandomWind()*a;

if a = [0,1], it''s easy to see that w will never exceed the bounds of wind directions generated by RandomWind().

Oh, a little primer for cloth dynamics and wind for it is also available on the page of Hugo Elias.

- Mikko Kauppila

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
A different direction from the other two recommendations: Stam''s classic modal analyis paper dealt with the same problem for trees in turbulent wind fields.

Share this post


Link to post
Share on other sites
Hello and thanks for the replies.

To clear things up, I'll give more information on what I'm trying to do. I'm trying trying to create some ship sails. It doesn't have to be based on a physical model. As long as it looks realistic and it's fast, I'm satisfied.

Imagine a ship sail ( square-shaped cloth ). As the ship moves, the sail will move too as if affected by wind. So currently, I displace the sail by a parabolic function ( displacement = x^2 + y^2 ). The faster the ship moves ( ie. greater the wind speed), the more I displace the sail. Right now, it doesn't look realistic because it's just parabolic. I want to add some turbulence to achieve more of a realistic look. This cloth is not based on the mass/spring model but on just vertex displacements.

I'm interested in the perlin noise method. Once I create a noise function by adding up several other noise functions, how would I animate it? Does it mean I have to update my noise based time? How would I achieve this?

Thanks in advance!

[edited by - revearz on December 1, 2003 11:47:13 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
With Perlin Noise you will need to generate a set of displacement maps that animate through time. If you make it seamless along the time dimension then you can get by with a small set of precalculated maps that you simply cycle through in each frame.

Share this post


Link to post
Share on other sites
Hi .. thanks for the replies. I managed to get a perlin noise generator up and running ( ripped from Hugo Elias ) but I''m stumped on how to animate the noise. Anyone have hints on this? Thanks!

Share this post


Link to post
Share on other sites
Hi, care to elaborate more?

To create noise, currently I have:


for ( nZ = 0; nY < nSizeZ; ++nZ )
{
for ( nY = 0; nY < nSizeY; ++nY )
{
for ( nX = 0; nX < nSizeX; ++nX )
{
noise = Noise3D( nX, nY, nZ );

// Bias and clamp

noise = ( noise * 0.5f ) + 0.5f;
if ( noise < 0 ) noise = 0.0f;
if ( noise > 1 ) noise = 1.0f;

// Store noise

}
}
}


Assuming I put time in the Z dimension and I want loop the animation every 30 frames ( nSizeZ = 30 ), do I just switch to the next displacement map ( nZ + 1 ) after every frame? What do I do when I need to loop back to nZ = 0? Since it's just noise, then there won't be a smooth transition between nZ = 29 and nZ=0. Do I need to make it tilable somehow? Thanks in advance.


[edited by - revearz on December 2, 2003 3:39:00 PM]

Share this post


Link to post
Share on other sites
Yes. You need to make it tilable, perhaps only in the Z-dimension which should be easy enough. Something along the following lines should work:

F(x) = ((w - z)f(x, y, z) + z * f(x, y, z - w)) / w

Where z iterates over [0, w] and f(x, y, z) is the 3-D noise function.

The number of textures will determine the step size for z. i.e w / nSizeZ.

Share this post


Link to post
Share on other sites
Hi .. just confirming something:

F(x) = ((w - z)f(x, y, z) + z * f(x, y, z - w)) / w

If I place this in the triple for loop in the above post, would it be:


float x = nX / 8.0f,
y = nY / 8.0f,
z = nZ / 8.0f,
w = nSizeZ / 8.0f;

noise = ((w - z)Noise3D(x, y, z) + z * Noise3D(x, y, z - w)) / w;


Thanks!

Share this post


Link to post
Share on other sites
I'm assuming you're texture size is nSizeX by nSizeY and nSizeZ is number of textures. Assuming you are mapping the x coordinates from 0 to 8, y from 0 to 8 and z from 0 to 8, then:

x = 8.0f * nX / nSizeX
y = 8.0f * nY / nSizeY
z = 8.0f * nZ / nSizeZ

The w that I mentioned in the formula would then be 8.0f.

Hope this helps.


------------------------------------------------
DaWizard
http://www.geocities.com/ahmadkabani
------------------------------------------------


[edited by - DaWizard on December 5, 2003 1:38:42 PM]

Share this post


Link to post
Share on other sites