Sign in to follow this  

Moving Cloud

This topic is 3926 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

Hello, I am trying to implement movement of clouds with the help of information written on this link: http://freespace.virgin.net/hugo.elias/models/m_clouds.htm But I don't really understand how he moves the clouds. I am using 4 octaves. So I have 4 images ( maps ). The smallest map has a size of 32x32. I have a function to create perlin noise for one image. So here is my code:
void moveClouds(float time)
{
   if(time % 2 == 0)
   {
      map1=map2;
      createPerlinNoise(map2,32*2);
      changeSize(map2,32,32);
   }
   if(time % 4 == 0)
   {
      map2=map3;
      createPerlinNoise(map3,32*2);
      changeSize(map3,32,32);
   }
   if(time % 16 == 0)
   {
      map3=map4;
      createPerlinNoise(map4,32*2);
      changeSize(map4,32,32);
   }
   createCloud();
}

I hope somone can help me.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Oh, I remember that demo
pretty cool stuff


As far as I know, he doesn't 'move' the clouds. He just interpoplates from one noise function to another over time.
The smooth blend from one to the next fools your eyes into seeing motion.

Share this post


Link to post
Share on other sites
mmmh... I dont think u understand what you are doing here. I've never implemented the algorithm, but if you read carefully the article it's actually fairly simple.

what you want to do is "morph" from one perlin noise texture to the next.
now the trick is that your clouds are displayed by combining different noise textures with different "frequencies".

So what you should have is an interpolation routine for each "frequency", independantly of each other. In the article, he shows you the pseudo code for only one such frequency.

One thing he mentions is that you should morph the textures at different rates, depending on which frequency they represent. For example, the highest frequency texture (which represent the smallest details) should be updated often, whereas the lowest frequency texture (which represents the bulk of the cloud) should evolve slowly.

let's say, you have 3 frequencies:
texture1 is 128x128, then from it you get the smaller 64x64 texture2, then from that texture3 which is 32x32.
you would update texture1 every second, texture2 every .5 sec, and texture3 every .25 sec (these are random numbers, but notice that the higher frequencies will be updated more often, as recommanded in the article).

The interpolation is between a given frequency texture and its next incarnation, not between frequencies!
For example, at the update time for texture1, you create texture1b which is the "target" texture. Until the next update for texture1, the actual texture1 that you use to create the overall cloud texture is an interpolation between texture1 and texture1b...

hope this helps?

Share this post


Link to post
Share on other sites
I dont think you should be doing a float%2 or any number.

Your time is a float then you do time%2 etc. I've no idea what this will do. Its probably undetermined between different compilers.

I'm sure your time should be an integer. Even an incremented integer each frame as a test.

Share this post


Link to post
Share on other sites

This topic is 3926 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this