Perlin noise questions

Hello, im having troubles again haha :slight_smile:

Im using standard perlin noise to render some heightmaps and stuff, nothing big.

But now im trying to use perlin noise to generate clouds (no cloud maps, but island like):

Also im trying to add turbulence to an circle like this:

http://www.noisemachine.com/talk1/imgs/flame.gif

But i cant figure out how these methods work, i tried various stuff (with horrible output), and searched loads of thread, but most people just use an library.
Simply using an library wont really help me understanding, so i hope i can find some help here.

So can someone point me to some good resorces or give some basic explanation?
Thanks for reading anyways.

I’m far from a math expert, but I just used a perlin-noise thing in my game, based on a SimplexNoise (like Perlin noise, only faster). Here’s the code I used as inspiration / starting point (originally from Stefan Gustavson, Linköping University):

http://webstaff.itn.liu.se/~stegu/simplexnoise/SimplexNoise.java

p.s. I expect that really understanding this will be quite a task…

once apon a time there was a link on twitter from aras_p where he showed of a procedural explosion effect done only in the pixel shader in a webgl example which is now used in unity i guess.
sadly I couldn’t find the link anymore :slight_smile:

update found something similiar it:http://www.clicktorelease.com/code/perlin/explosion.html

I have implemented simplex noise already but it just creates maps like this:

I really want one randomized and centered blob. (so there are no edges visible at the borders of the image).

Thank you, but this guy is using some librarys to archive this.

I just want to know the theory of adding turbulence to an circle and generating an random blob.
I dont get how this is done from basic perlin (or simplex) noise.

Bout that, I know there are algorithms for generating islands which are surrounded by water, so I googled for “island generation noise” and found this:
http://breinygames.blogspot.de/2012/06/generating-terrain-using-perlin-noise.html
the intresting part is the “Island map”. Propably not a fast algorithm, but maybe there are others (I’ll go and google-fu more…). Also, he has a link to the google project, so you could check out the source… (python! eeeew…)

Found this one to, the problem is he only uses perlin noise in his first (failed try).
In his solution he chooses an random pixel and increases the value, then the neightbour etc (like lightning, but only one direction).
He does this with an x amount of pixels, until an island is visible.

No, he uses Perlin noise in the first as well as in the second try.
In the second try he multiplies the “Island map”'s values by the Perlin noise values, which one could call combining the two maps.
So… He basicly uses both Perlin Noise and a Island map.

I’ve been working on a tutorial on how to use, as a way to teach myself about it. I’m still learning and experimenting myself about this.

http://hexara.com/SimplexBuilder.html

The last section that I’ve gotten to starts to describe the types of modulations you are asking about, but for a vertical gradient, not a radial or an island shape so much. (The “Terra Map” section deals a bit with islands.)

In brief, I think you need to combine the randomizing effect of the noise with another equation or functions that makes the core shape you are going for.

For the radial effect, for example, lets say you have a function that goes from 1 in the center to 0 at the radius. Have these numbers “modulated” (Perlin’s term) by the noise via addition would be a solution. It the noise ranges from -0.25 to 0.25, and you use a min and max to stay within 0 to 1, adding will create a randomized field of values, also from 0 to 1 but with a fair bit of randomness in the transition.

Then, of course, you make the 0 to 1 values map to your colors, etc.

Here is a graphic that has my first attempts at this. I’m looking forward to taking the time to nail that solar flare example from Perlin’s slide show, and the animation of it.

http://hexara.com/Images/solarflare.JPG

http://hexara.com/Images/solarflareCloseup.JPG

I should try drawing a black circle over it…

This next link is an animation of the flames that is in the tutorial segment I am currently working on. It kinda works. Like I said, I’m new to this, too.
http://hexara.com/SimplexFlames.html

If you have a specific island shape in mind, you can work off of that, or I guess it is also possible to generate random “islands” by using the noise and clipping the output in some fashion or another. For example, the output is -1 to 1, and lets say you get a good island if you used only the values above 0.7. Add an operation like this:


    if (noiseVal < 0.7) noiseVal = -1;

And then use other scaled amounts of noise to modulate those island values again with some sort of clipping to eliminate modulation of the ocean areas.

That is just an idea off of the top of my head. There are probably other was as well to get the results you want. If you have a good grip on how the numbers are generated and used, you can make them do all sorts of shapes. I try to make this all clear in the tutorial.

And if the tutorial text isn’t clear, I’d sure appreciate feedback for improvements!

I’m also thinking of further development of the tool and open sourcing it, so that the “visualizer” portion can be used to generate useable code.

http://hexara.com/Images/solarflareCloseup2.JPG

It seems I need to fine tune the relationship of the radial gradient to the noise a bit still. Maybe too much amplitude at the low octaves. But it is in the ballpark.

Great work!

Some things you should do: Do this noise in 3 Dimensions, to make it animate, and also multiply each 2D-layer of the animation by a value, which is low in the beginning layers, getting higher to the mid, and getting lower to the end.

For example assume you need a 512x512 pixel explosion effect, which has 32 animation frames.
Then you’d create the radial mask (or use the island-noise), and multiply each layer by the mask’s values or add them to each layer.
And then use an (propably cubic) interpolated number to multiply each layer by, which is for example 0 for the first frame, interpolated to 1 in the 24th frame and going down to 0 in the 32nd frame.

I’m just trying to do that too now :slight_smile:

to get a good circle shape for your sun.
you could try polar coordinates

So… you create 1 Dimensional noise, which changes the outline of a circle?
So the outline of the circle sometimes is more far from the middle of the circle than others…

So [i]r(θ) = 16 + (4 * noise(θ))[/i] ?

Thanks!
I didnt expect it was that easy, i thougt about this option, but thought it would be ugly.

My cloud:

No i can experiment with this function to create the nice solar flares and plasma clouds.
Also transforming objects will be possible, like smashing an sphere untill it looks like an astroid.
Really awsome, this was exact what i was looking for.

My code to change an circle to an cloud:


    private static SimplexNoiseGenerator gen = new SimplexNoiseGenerator((long)(Math.random()*Long.MAX_VALUE));
    
    public static Texture genCloud(float diameter){
        BufferedImage b = //create image
        int[] pixels = ((DataBufferInt)b.getRaster().getDataBuffer()).getData();
        int acces;
        float radius = diameter * 0.5f;
        float smallradius = diameter * 0.4f;
        
         for(int x=0; x<diameter; x++){
            for(int y=0; y<diameter; y++){
                    float value = genPixel(x - radius, y - radius, smallradius);
                    
                    acces = x + y*200;
                    pixels[acces] = new Color(1f, 1f, 1f, value).hashCode();
            }
        }
        
        try{
            //Generate texture
        }catch(Exception ex){ return null; }
    }
    
    private static float genPixel(float x, float y, float radius){
        float dist = 1 - (SimpleMath.dist(x, y) / radius);
        float val = (dist + (float)gen.noise(x*0.01, y*0.01, 0, 5, 3, 0.4f)*0.35f);

        //gen.noise(x*0.01, y*0.01, 0, 5, 3, 0.4f) explained:
        //x, y, z, octaves, frequency, amplitude.


        return SimpleMath.clamp(val);
    }

Nice. :slight_smile:

by the way, where did you get the graphic of the cloud on your first post? I recognize the solar flares from Perlin’s slide show. The cloud is rather remarkable, and I am do not know how to generate it. In particular, the edge is so much more distinct and smooth than is usual.

Also, there are some definite directional lighting effects. Was the graphic accompanied by an article?

The cloud in the first post is most likely a ray traced volumetric noise, and maybe post-processed and rendered with sprites (textures with puffs of smoke).

If you’re going for realistic, then the your going to need to go with some light scatter model. If you want to muck with some pure noise solution, then you could try using the same “trick” as pure noise marble.

a quite “simple” way to generate 3d volumetric smoke with noise(so no fluid simulation with massiv particles) can be done as following:

-render in a deffered(normal+depth) way some smoke bubbles (simple spheres)
-displace the gbuffer with 3d noise, taking as input the world positions
-render the smoke, additional to the normal direct lighting one can use the smoke thikness to apply some simple scattering effect.

some smoke I did some years(?) ago

https://lh5.googleusercontent.com/dj3H4g8ptfJozKJ1DErzPpizAFMul0im9tqAJb_9rhvnUZlfKG4evtx91LTq8qLLvMD4tY_MeB4JiS5bTv6TrweXWGHspzd1zvtMDbGKgYDz

The cloud is made by someones custom engine i guess…
Found it in someones showcase: http://www.peterkutz.com/

@RobinB – thanks for the link! That fellow has done some interesting work. I can’t offer any further insights as I have done nothing with 3D yet.

@riven – you were right about the volumetrics

@Danny02 – nice cloud! But I am at a loss to follow your explanation as to how you created it. I’m thinking more will become clear when I have time to study 3D graphics more, learn what these volumetric processes are all about.

@Roquen – “light scatter model” – again probably more 3D stuff for me to get to, pertaining to shaders and the like? But what are you referring to when you use the term “marble” in the noise context? Is this specifically the ribbons that can result with the use of a sin function? Or with the use of the abs function (turbulent noise)?

OK, I can hear people saying: did you try searching on the question?
Yep. Found this:
http://physbam.stanford.edu/cs448x/old/Procedural_Noise(2f)Perlin_Noise.html
Lot’s about marbling there!

One can create marbling by embedding it in a color map. I supposed it would be possible to make the map marbling colors be ribbon based and have the two sides mimic shading…

I did try messing around with my settings for the solar flare and got something closer to Perlin’s example. I think it still needs a couple more octaves to improve the detail. The image is doubled since my 256 field is kind of small.

http://hexara.com/Images/solarImprovedCloseUp.JPG

I intend to put the settings into the tutorial, to allow people to click it up in the tool and tinker with it. (Though it won’t have the dark circle in the center.)

Nice work, wish i could do that with my generated stars, but 20 textures of 2000 x 2000 is a bit to much (with some creative shading i could bring it to 5 textures, but its still a lot).
Instead i expanded my function to create an map of random clouds to render;

Those are red, because it should be something like gas clouds (in space).
The color is going to be random (for groups of clouds).