- Home /
Mathf.PerlinNoise not returning in Waves
So, i'm using Perlin Noise to generate terrain, and want results like in this picture: https://www.google.ca/search?q=perlin+noise+waves&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiay7CK9f_JAhVEoYMKHXuOAJkQ_AUIBygB&biw=1536&bih=731#imgrc=ZhSrQQRXKeHh4M%3A (srry for such a long link) but am getting much more random noise like this: https://www.google.ca/search?q=perlin+noise+waves&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiay7CK9f_JAhVEoYMKHXuOAJkQ_AUIBygB&biw=1536&bih=731#tbm=isch&q=random+noise+image&imgrc=zbEFoaJ98uOZjM%3A
Here's my Code: seed = Random.Range(1,10000); tData = GetComponent().terrainData; Texture2D hmap = new Texture2D(tData.heightmapWidth, tData.heightmapHeight); float[,] heights = new float[tData.heightmapWidth, tData.heightmapHeight];
for(int x = 0; x < tData.heightmapWidth; x++)
{
for(int y = 0; y < tData.heightmapHeight; y++)
{
float c = Mathf.PerlinNoise(x + 0.1f * seed,y + 0.1f * seed);
hmap.SetPixel(x,y,new Color(c,c,c));
}
}
hmap.Apply();
tex = hmap;
tex.filterMode = FilterMode.Point;
tex.Apply();
for(int x = 0; x < tData.heightmapWidth; x++)
{
for(int y = 0; y < tData.heightmapHeight; y++)
{
heights[x,y] = hmap.GetPixel(x,y).grayscale;
}
}
tData.SetHeights(0,0,heights);
@$$anonymous$$accabbe I tried what you said and all that happened was it made bigger pixels, but still not "Waves" per say
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Pick up script goes straight to drop action 0 Answers
Unity Build Showing Black Screen on Startup Using Oculus SDK 0 Answers
Items not destroying. 1 Answer