/// <summary> /// Uses the GPU to generate a Texture2D where the pixels in the texture represent noise. /// Set the octaves variable before calling this to a desired value. /// </summary> /// <returns>Texture2D</returns> /// <param name="width"> Width of the texture to generate. </param> /// <param name="height"> Height of the texture to generate. </param> /// <param name="noiseOffsetX"> X Coordinate of the offset for the noise on the texture. </param> /// <param name="noiseOffsetY"> Y Coordinate of the offset for the noise on the texture. </param> /// <param name="noiseScale"> Value to scale the noise coordinates by. </param> /// <param name="normalize"> Whether or not to remap the noise from (-1, 1) to (0, 1). </param> public static UnityEngine.Texture2D GetNoiseTexture(int width, int height, float noiseOffsetX = 0, float noiseOffsetY = 0, float noiseScale = 0.01f, bool normalize = true) { UnityEngine.RenderTexture renderTex = GetNoiseRenderTexture(width, height, noiseOffsetX, noiseOffsetY, noiseScale, normalize); UnityEngine.Texture2D retTex = renderTex.ToTexture2DNoise(true, true); return(retTex); }