- Home /
Mathf.PerlinNoise is always returning "0.4652731" regardless of the input
Hello everyone, I am working on a terrain generation script using unity`s perlin noise, but for some odd reason it always returns "0.4652731" regardless of the input. I used the following code:
float prntFloatA = Mathf.PerlinNoise(1, 1);
print("#" + prntFloatA);
float prntFloatB = Mathf.PerlinNoise(1, 3);
print("#" + prntFloatB);
float prntFloatC = Mathf.PerlinNoise(37, 62);
print("#" + prntFloatC);
this is the simple version, previously i was trying to create a 100x100 texture and i got the same number every time so im prety sure all inputs will give me the same #. i am using an old-ish pc which i suspect could be the problem but i would like someone to confirm it. Thanks a lot and i would realy apreciate if you had some advice or some other method to create a procedural terrain.
looks like you need to use fractions, whole numbers in the params will always give the same result: http://answers.unity3d.com/questions/486449/how-does-mathfperlinnoise-work.html
Answer by Kurdle_4855 · Aug 09, 2016 at 05:55 PM
You need to use fractions, Integers won't work. For example, just change it to 1.1, 2.1 etc.