public static Bitmap SplatSimple(ITerrainChannel heightmap) { const float BASE_HSV_H = 93f / 360f; const float BASE_HSV_S = 44f / 100f; const float BASE_HSV_V = 34f / 100f; Bitmap img = new Bitmap(256, 256); BitmapData bitmapData = img.LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb); unsafe { for (int y = 255; y >= 0; y--) { for (int x = 0; x < 256; x++) { float normHeight = heightmap[x, y] / 255f; normHeight = Utils.Clamp(normHeight, BASE_HSV_V, 1.0f); Color4 color = Color4.FromHSV(BASE_HSV_H, BASE_HSV_S, normHeight); byte *ptr = (byte *)bitmapData.Scan0 + y * bitmapData.Stride + x * 3; *(ptr + 0) = (byte)(color.B * 255f); *(ptr + 1) = (byte)(color.G * 255f); *(ptr + 2) = (byte)(color.R * 255f); } } } img.UnlockBits(bitmapData); return(img); }