/* public void FillTexture()//random * { * if (texture.width != resolution) * { * texture.Resize(resolution, resolution); * } * * Vector3 point00 = new Vector3(-0.5f, -0.5f); * Vector3 point10 = new Vector3(0.5f, -0.5f); * Vector3 point01 = new Vector3(-0.5f, 0.5f); * Vector3 point11 = new Vector3(0.5f, 0.5f); * * * float stepSize = 1f / resolution; * Random.seed = 42; * for (int y = 0; y < resolution; y++) * { * Vector3 point0 = Vector3.Lerp(point00, point01, (y + 0.5f) * stepSize); * Vector3 point1 = Vector3.Lerp(point10, point11, (y + 0.5f) * stepSize); * for (int x = 0; x < resolution; x++) * { * Vector3 point = Vector3.Lerp(point0, point1, (x + 0.5f) * stepSize); * texture.SetPixel(x, y, Color.white * Random.value); * } * } * texture.Apply(); * }*/ public void FillTexture()//value//perlin { if (texture.width != resolution) { texture.Resize(resolution, resolution); } Vector3 point00 = new Vector3(-0.5f, -0.5f); Vector3 point10 = new Vector3(0.5f, -0.5f); Vector3 point01 = new Vector3(-0.5f, 0.5f); Vector3 point11 = new Vector3(0.5f, 0.5f); float stepSize = 1f / resolution; for (int y = 0; y < resolution; y++) { Vector3 point0 = Vector3.Lerp(point00, point01, (y + 0.5f) * stepSize); Vector3 point1 = Vector3.Lerp(point10, point11, (y + 0.5f) * stepSize); for (int x = 0; x < resolution; x++) { Vector3 point = Vector3.Lerp(point0, point1, (x + 0.5f) * stepSize); texture.SetPixel(x, y, Color.white * NoiseMethod.Value3D(point, 22)); // } } texture.Apply(); }