public void SetMatrix() { if (!pure) { shader.SetInput(matrix); } }
private IEnumerator Generate() { var offset = new Vector3(); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { for (int k = 0; k < size; k++) { offset.x = (i / (float)size); offset.y = (j / (float)size); offset.z = (k / (float)size); var noise = ground - offset.y - transform.position.y; noise *= groundFactor; for (int x = 0; x < perlings.Length; x++) { noise += PerlinNoise(perlings[x].x, perlings[x].y, offset - realOffset + transform.position); } /*noise += PerlinNoise(1f, 1.8f, offset - realOffset + transform.position); * noise += PerlinNoise(4f, -0.2f, offset - realOffset + transform.position); * noise += PerlinNoise(10f, 0.05f, offset - realOffset + transform.position); * noise += PerlinNoise(2f, 0.3f, offset - realOffset + transform.position); * noise += PerlinNoise(1.5f, -0.8f, offset - realOffset + transform.position);*/ matrix[GetIndex(i, j, k)] = noise; progress = i / (float)size + j / (float)(size * size) + k / (float)(size * size * size); slider.value = progress; } } yield return(null); } slider.gameObject.SetActive(false); shader.parameters.Target = target; shader.SetInput(matrix); Debug.Log("Cube Done"); }