Hi so I have setup a quad that gets texured by perlin noise. now I just want to clean the perlin noise by adding multiple perlin noise layers together. My problem is I don’t know how it works.
Here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TextureGen : MonoBehaviour
{
[Range(1, 1024)]
public int resolution = 256;
public float refinement = 0.1f;
Texture2D texture;
// Start is called before the first frame update
void Awake()
{
texture = new Texture2D(resolution, resolution, TextureFormat.RGB24, true);
texture.name = "Procedual Texture";
GetComponent<MeshRenderer>().material.mainTexture = texture;
FillTexture();
}
// Update is called once per frame
public void FillTexture()
{
//float stepsize = 1f/resolution;
if(texture.width != resolution)
{
texture.Resize(resolution, resolution);
}
for(int y = 0; y < resolution; y++)
{
for(int x = 0; x < resolution; x++)
{
texture.SetPixel(x, y, new Color(0f, Mathf.PerlinNoise(x * refinement, y * refinement), 0f));
}
}
texture.Apply();
}
}