Jump to content
  • Advertisement

Archived

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

TerranFury

Plasma/Clouds

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

I've been mulling over some ideas, experimenting with them in code, and would like to have your opinions. Everybody knows the standard midpoint-displacement algorithm for generating plasma/clouds. But I thought, let's go back to one dimension... There are two ways to generate a 1d "plasma" line - that looks like, say, a horizon. One is, again, fractal random midpoint displacement. The other is a random walk. They generate the same results. In other words, in 1d, "plasma" is the acccumulation (sum) of many random numbers in the range (-n, n). So what I was thinking is this: We can extend midpoint displacement to an arbitrary number of dimensions. Can we extend the random walk to an arbitrary number of dimensions? The approach I attempted was this: If 1d plasma is a vector containing the accumulation of many random numbers, then could 2d plasma be a matrix containing the accumulation of many 1d plasma vectors? So you start with a row of pixels. It's essentially an x-d vector, where x is the width of the sreen. For a mental image, picture this in grayscale. Black is -1, white is +1. This row is generated by a random walk. Now, for the next row, you do another random walk, and add that (scaled by some constant 0<k<1) to the previous row. For 3d plasma, then, I would accumulate many 2d plasmas in much the same fashion. But here's the thing: It doesn't really work. I wrote a program that spits out RAW images that I view in Photoshop; the results don't look like the fractal clouds you get from midpoint displacement. Instead, you can clearly see seperate rows and columns. The clouds aren't smooth along the diagonals. So, I'm curious to know if anyone else has experimented with this sort of approach. Is there any established algorithm I don't know about that sort of resembles what I've described? Thanks a lot for any comments. [edited by - TerranFury on January 12, 2004 2:53:59 PM]

Share this post


Link to post
Share on other sites
Advertisement
The reason why the texture looks like it does is because all columns are computed individually. If you added some form of correlation between neighbouring columns in the rows you should get somewhat better results. But then again, it isn''t a really good approach to start with.

If you want good looking clouds all you need to do is pass perlin-noise through a processing function(1-e^(-x) or something).

Share this post


Link to post
Share on other sites
See, that''s the thing: Each row DOES depend on the row that precedes it. It is the previous row plus 1d-plasma (which can have negative values), just as each value generated by a random walk is equal to the previous value plus or minus some random number. So each row DOES depend on the previous row. And within each column, the maximum difference between adjacent pixels is equal to the maximum range of the 1d plasma, divided by some constant. If that value (MAX/k) is equal to the maximum stepsize in the 1d random walk, then the maximum difference between adjacent pixels in rows and in columns should be the same. And it is.

I agree that there isn''t ENOUGH dependency on adjacent pixels, but I just can''t seem to figure out what that dependency that I''m missing is...

Share this post


Link to post
Share on other sites
you are missing the diagonal dependancies

this is now a 2d plane, and dependancies occur at more than just orthoganal horizontal and verticals

even with diagonal dependacies you will notice some slight artifacts, you really need to go at all directions... but diagonals is as far as is really practical with this method

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!