# Perlin Noise and Octaves

This topic is 4843 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

The perlin noise function I have returns values between -1.0 and 1.0. Should I convert this to 0.0 to 1.0 ((noise/2.0f)+0.5f?) before adding the octaves together? If so, how do I make sure the final result is not > 1.0f without it becoming too dark? At the moment, my octave function looks like...
//
// return noise with octaves
//
float PerlinNoise::NoiseWithOctaves(int in_x, int in_y, float in_startScale, int in_octaveCount)
{
float result=0.0f;
float pers=1.0f;
float falloff=0.5f;
float rawNoise;

// loop through octaves
for (int i=0; i < in_octaveCount; i++)
{
rawNoise=Noise(in_x, in_y, in_startScale)*pers;
result += rawNoise;
in_startScale *= 2;
pers *= falloff;
}

return result;
}



##### Share on other sites
It's been a while since I've worked with perlin noise so shoot me if I'm wrong, but... I think you don't have to worry about the functions adding together to be more than 1.0, because you weight each octave by something...

e.g:

.5 * octave1 + .25 * octave2 + .125 * octave3 ... etc.

So, as long as each octave is < 1.0, the sum won't be either.

EDIT: I dug up some of my old code, hope this helps!

// Fractional brownian motion functiondouble FBM(int nOctaves, int roughness, const Vec3 &point){	// Just calculate the summation of the octaves	// (Optimized)	Vec3f floatPoint = point;	double summation = 0.0;	double maxValue = 0.0f;	for(int i = 1; i <= nOctaves; i++)	{		summation += powf(2, (-i * roughness)) * (Noise3(powf(2, i) * floatPoint));		maxValue += powf(2, (-i * roughness));	}	summation /= maxValue;  //normalize to -1...1	return summation;}

##### Share on other sites
It depends on what you're using the noise data for. When generating procedural textures, it usually makes sense to have the noise function return values on the interval [0, 1], and if subtractive combinations are needed, special-case for them in the octave summation code. For bump maps or other height-based data, it can make sense for values to lie on [-1, 1]. Personally I use two "root" Perlin noise functions, one of which returns values on [0, 1] and the other on [-1, 1]. The one which is most meaningful for a specific instance is the one I choose.

This becomes important if your octaves are not based on simple turbulence (scale input point, sample, weight sample, add to octave list). Most applications of Perlin noise will eventually involve such a case, such as exponentiating each octave to produce cloud-like patterns. In such cases, ranging on [-1, 1] is not only counterintuitive, it is sometimes flat out broken.

1. 1
2. 2
3. 3
4. 4
Rutin
12
5. 5

• 12
• 16
• 10
• 14
• 10
• ### Forum Statistics

• Total Topics
632659
• Total Posts
3007692
• ### Who's Online (See full list)

There are no registered users currently online

×