Jump to content
  • Advertisement

Archived

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

The_Fallen

Clouds again

This topic is 5533 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 currently implementing clouds for my sky, and there are some problems... I''m doing it like this: http://freespace.virgin.net/hugo.elias/models/m_clouds.htm The only difference in my implementation is, that I use the graphics hardware for blending the four perlin maps together. It looks like this: http://www.husser.de/clouds.jpg In the corners there are the 4 perlin maps (have a look in the paper to see how they are created). The left one in the middle is the blended texture with all the four perlin maps. But how to create the "filter" function (would be the image middle right), that is described in the paper? I don''t have access to the blended texture, do I? Can I do the same effect using some blending? I think you could do it with pixel shader, but my gf2mx doesn''t support that... Can anyone help? thx, fallen

Share this post


Link to post
Share on other sites
Advertisement
Well, I don't know how you would do it in your case, but I'd rather blend them together "physicaly" (add each pixel (on image) together and divide it by 4 , and you get the average pixel).

finalImage[x][y] = (first[x][y]+second[x][y]+third[x][y]+fourth[x][y])/4; // final image pixel
// X & Y are the coordinates of the pixel on map

You then have one texture and you can throw other four away.

But this takes you some time, to compute the image.


[edited by - unknownnick on May 27, 2003 9:35:42 AM]

Share this post


Link to post
Share on other sites
Yeah, I''ve already thought about that. But at the moment the stretching and smoothing of the textures is done by OpenGL. Blending by myself would mean, that I would have to stretch and smooth by myself, too...
So this isn''t really an option I think...

Share this post


Link to post
Share on other sites
This "filter" function you mention,is this for the cloud-cover subtraction and exponential? It seems you have already blended the octaves and it''s time to transform them.
I don''t think you can do the exp in HW on a GF2, you need texture lookups for it. The two ways I can see are to make the blending and "filter" pass in SW, or, buy a new GFX card

Share this post


Link to post
Share on other sites
Damn, that''s not what I wanted to read... But thx!
But how to smooth a picture in SW? I''ve never done that before...

Share this post


Link to post
Share on other sites
I think he didn''t use the same texture four times, but he created different ones.

So there isn''t a question about stretching (I don''t know what did you mean by smoothing). You hust create four textures, and every next one is the half of the first one.

Than you have to do the tiling, and blending. All by yourself.

But again, this is very slow!

Share this post


Link to post
Share on other sites
Amost chatting this...

You want to blend textures and at the same time scale them, bilinearly I guess?
Copy the highest octave into the final buffer and scale the buffer by 2. Blend the next octave and scale by 2. Repeat for all octaves.
This scaling should be done using bilinear filter, atleast.


  
/* Block of 4 texels in buffer */
ab
cd

/* Scaled */

a-b-
|\|\
c-d-
|\|\


You must fill in the missing space between the texels by interpolating the values beside, in this 2x case, just a simple average. Note that the diagonal average should be the average of 4 texels.

Share this post


Link to post
Share on other sites
hum... SW smoothing?

I''ve been reading some topics about perlin noise and such... the topic should be here--> http://www.gamedev.net/community/forums/topic.asp?topic_id=158235

Smoothing included. I hope this is what you want.


...humm does the rest of the world sleep or is this european forum?

Share this post


Link to post
Share on other sites
Fractal perlin textures are a pain in the neck because you just can't cheat and come up with good results.

The Hugo Elias article is extremely popular, but IMHO it doesn't properly explain the concept. Here's how perlin textures work.

1. For the point x,y,z, find the perlin noise value
2. Set our weight value to 1
3. Multiply x,y,z by some factor
4. Multiply weight value by some factor
5. Find perlin noise, multiply it by weight value
6. Add perlin noise to total
7. Repeat steps 3-6 some number of times

By changing the number of repeats (octaves), the scaling factor from step 3 (lambda) and the weighting factor in step 4 (omega) we can get many many different patterns. Somewhere in there is a nice cloud pattern.

So you're not actually creating multiple textures; you're creating one texture by doing some crazy math on it. It's also very very slow if you use too many iterations. I suggest trying to stay under 5 octaves if at all possible.


[edit] I misunderstood the original question...

Here's my suggestion. Start with the initial, basic texture that "looks" the biggest (i.e. is not scaled). Give it an alpha of 1. Reduce the texture by 50%, tile it to cover the same space as the first texture, and layer it on top with an alpha of 0.25. Repeat for the next 2, increasing alpha by 0.25 each time. Change the alpha increment if you need more than 4 octaves.

[edited by - ApochPiQ on May 27, 2003 10:08:24 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!