- Home /
Is this reading the full range of Perlin Noise?
Hi all =]
I have written a script to take samples across the Mathf.PerlinNoise spectrum, and am surprised at the result. So I have come to ask, is this a full sweep of the Perlin Noise 'map', or am I just getting a high-res sample of a small area? I have done more subdivisions (higher resolution of samples between 0-1), but it just follows the pattern in the pictured curve. I am passing values between zero and one to values in static function PerlinNoise (x : float, y : float) : float (I hope!). Is this the full output? My (limited) understanding was the greater the number of samples (the more times you sub-divided between 0-1), the more uneven the output would become (i.e. heaps of jaggies). This is the first time I have used perlin, so if I'm waaay off, please tell me =]
var step : Vector2 = Vector2( starFieldSize.x / starCount.x, starFieldSize.y / starCount.y );
var index : int = 0;
for (var v:int = 0; v < starCount.y; v ++)
{
for (var i:int = 0; i < starCount.x; i ++)
{
// get perlin var for X-Y (i-v) coords
var perlinCalc : Vector3 = new Vector3( (i * step.x), (v * step.y), 0 );
perlinCalc.z = Mathf.PerlinNoise( perlinCalc.x / starFieldSize.x, perlinCalc.y / starFieldSize.y );
Debug.Log ( "perlinCalc + " + perlinCalc + " : perlin = " + perlinCalc.z );
starPos[index ++] = new Vector3( perlinCalc.x - randomizePos.x + (2.0 * perlinCalc.z * randomizePos.x), perlinCalc.y - randomizePos.y + (2.0 * perlinCalc.z * randomizePos.y), 0.0 + (randomizePos.z * perlinCalc.z) );
}
}
Answer by ScroodgeM · Aug 25, 2012 at 08:29 PM
why do you limit yourself in 0...1 range in input parameters?
Oh, so I was just reading a small sample! So a value greater than one increases the noise in the returned float .... after immediately changing the line :
//perlinCalc.z = $$anonymous$$athf.PerlinNoise( perlinCalc.x / starFieldSize.x, perlinCalc.y / starFieldSize.y );
perlinCalc.z = $$anonymous$$athf.PerlinNoise( $$anonymous$$athf.Abs(perlinCalc.x), $$anonymous$$athf.Abs(perlinCalc.y) );
I finally had a result I was after. Thankyou =]
Your answer
Follow this Question
Related Questions
Perlin Noise Implementation 2 Answers
Help Perlin Noise for Cubes? 1 Answer
Need help with undocumented Mathf.PerlinNoise 1 Answer
Perfomance Issue With Minecraft Clone. 0 Answers