I've shown a couple different methods for generating procedural textures, namely Perlin Noise, Cellular Textures, and Fault Formation. And while Perlin Noise and Cellular Textures generally look OK on their own, Fault Formations generally don't. They tend to look harsh with drastic changes from dark to light areas (which actually can be good sometimes). The best way to fight this though is to use some sort of image filtering on the image to soften it up a bit.
So I'm going to show you two methods for doing this... Well sort of and I'll explain later why I say that.
Box Blur
A box blur is a technique where you simply take a "box" of pixels around a particular pixel, add up the sum of those pixels, then take that sum and divide it by the number of items in the box. That becomes the new value for the center pixel of that box. Really simple to do and rather fast at that. In fact here's a basic class that accomplishes it:
BoxBlur.zip (661.00 bytes)
Note that this class uses float values for the array as input and can be used with the Perlin noise, cellular texture, and fault formation classes that I've posted with a bit of work. However for your own purposes, it should give you an idea of what to do. Also note that if you're going to change the code to send in pixels, you're going to have to add up the red, green, blue, and alpha channels separately. Otherwise it simply will not work properly.
Gaussian Blur
Gaussian blurring is a technique similar to box blurring but uses a normal distribution to accomplish it's goal. Really if you want to know the math behind it, I suggest you click on the link. It's pretty common in programs like Photoshop and GIMP. Anyway, I'm not going to show you any code to do this technique because you've already seen it.
See that code for box blurring? Guess what, we can accomplish a Gaussian blur with that. There's no extra code for this method, all we do is run the box blur method three times and we basically accomplish a Gaussian blur (well -/+3% difference anyway). Rather cool, huh?
Anyway, download the code, take a look, leave feedback, etc. and happy coding.
503c856f-628c-4e9e-84f9-f91545ef81b5|3|4.3