- Load a target image of a galaxy
- Divide the image into n by m cells
- For each cell:
- Sum the red, green and blue components of each pixel
- Calculate the average
- Divide by the maximum possible value (255 * width of n * height of m)
- Store this value for this cell -> v
- Calculate the rgb value for this cell with 255 * v
- Generate a certain number of randomly placed pixels with the rgb value found in step 3.5, the number of pixels is a user specified number multiplied by v
- Output image
- Rotate image a fraction of a degree
- Go back to step 1
Here is the result:
Thursday, 13 August 2015
Galaxy Generation Algorithm
Today I've been thinking more about the galaxy generation, so I came up with an algorithm and implemented it. Here is how the algorithm works:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment