Tags: sphere noise polar etc
category: general [glöplog]
How would you generate some sort of perlin noise equality distributed over a sphere, to make some planetioid of sorts?
I have found something that had to do with slicing a sphere in random planes and raise a side and lower the other a few times...
http://local.wasp.uwa.edu.au/~pbourke/fractals/noise/ that thing over there. it should be easy to render it to a cubemap. any other idea?
I know it would not be equaly distributed, but what about 3d perlin noise and sampling in the sphere surface? Maybe it doesn't look bad...
for that I could just generate perlin noise over the cubemap faces. and the difference won't be noticeable... but I may learn something this way ;)
perlin in the vertex shader? I've seen a lot of perlin displaced spheres...
If your texture would be 1024*1024...
for (y=0; y<1024; y++) for (x=0; <1024; x++) {
float a = x/1024.0*pi*2.0;
float b = y/1024.0*pi;
br = noise3d(sin(a)*sin(b), cos(b), cos(a)*sin(b));
...
}
... and then you need just a proper noise3d function.
Also, GIMP has a plugin called Felimage Noise or something, which has spherical mapping, unless you're doing an intro.
for (y=0; y<1024; y++) for (x=0; <1024; x++) {
float a = x/1024.0*pi*2.0;
float b = y/1024.0*pi;
br = noise3d(sin(a)*sin(b), cos(b), cos(a)*sin(b));
...
}
... and then you need just a proper noise3d function.
Also, GIMP has a plugin called Felimage Noise or something, which has spherical mapping, unless you're doing an intro.
Here's a version of the 3D Perlin we used in Muon Baryon and Magnus:
It's pretty hard-coded as it was meant for size-coding, but of course you can parameterize easily. Also this is the human-readable version of the obfuscated code.
Code:
/* Given a position, this function generates a 3D co-ordinates based,
* reconstructible static noise. */
float noise(vec3 position)
{
position.x += position.y * 57. + position.z * 21.;
return sin(cos(position.x) * position.x);
/* The following is an alternative for the previous line:
* return fract(position.x * position.x * .0013) * 2. - 1.; */
}
/* Given a position, this function generates a 3D co-ordinates based,
* reconstructible linearly interpolated smooth noise.
*
* This function uses the noise() function above for its underlying
* noise texture. */
float smooth_noise(vec3 position)
{
vec3 integer = floor(position);
vec3 fractional = position - integer;
return mix(mix(mix(noise(integer),
noise(integer + vec3(1, 0, 0)),
fractional.x),
mix(noise(integer + vec3(0, 1, 0)),
noise(integer + vec3(1, 1, 0)),
fractional.x),
fractional.y),
mix(mix(noise(integer + vec3(0, 0, 1)),
noise(integer + vec3(1, 0, 1)),
fractional.x),
mix(noise(integer + vec3(0, 1, 1)),
noise(integer + 1.), fractional.x),
fractional.y),
fractional.z) * .5 + .5;
}
/* Given a position, this function constructs the oh-so-famous Perlin
* noise. */
float perlin(vec3 position)
{
return smooth_noise(position * .06125) * .5 +
smooth_noise(position * .125) * .25 +
smooth_noise(position * .25) * .125;
}
It's pretty hard-coded as it was meant for size-coding, but of course you can parameterize easily. Also this is the human-readable version of the obfuscated code.
Note: The alternative line was invented by Mentor and me at the Assembly party place 3 hours before the deadline. It doesn't look when used individually but it is pretty fast and has a relatively smaller footprint in the shader sources. So, kudos to Mentor for trial and error :).
http://mathworld.wolfram.com/SpherePointPicking.html
that could help
that could help