public static Texture CreateDummyHeightTextureDependentOnWorldSpacePosition(MyRectangle worldSpaceRectangle, float repreatLength) { var tex = new Texture2D(240, 240, TextureFormat.RFloat, false); float[] rawTextureData = new float[tex.width * tex.height]; for (int x = 0; x < tex.width; x++) { for (int y = 0; y < tex.height; y++) { var uvInTexture = new Vector2(x / 240f, y / 240f); var worldSpacePosition = worldSpaceRectangle.SampleByUv(uvInTexture); rawTextureData[x + y * tex.width] = Mathf.Repeat(worldSpacePosition.x + worldSpacePosition.y * 4, repreatLength) / repreatLength; } } tex.LoadRawTextureData(CastUtils.ConvertFloatArrayToByte(rawTextureData)); tex.Apply(); return(tex); }