stride3d/stride · error · Exception

format is not supported.

Error message

{ texImage.Format } format is not supported.

What it means

HeightmapAssetCompiler converts the source texture to R8_UNorm before building the heightmap, and only a fixed set of source pixel formats is supported. If texImage.Format falls outside the accepted B8G8R8X8/R8G8B8A8 (UNorm and SRgb) variants, it throws with the offending format name.

Solutions

  1. Re-save the heightmap image as 8-bit or 32-bit RGBA (R8G8B8A8 or BGRA8888)
  2. Convert the image in an editor (GIMP/Photoshop) to an 8-bit-per-channel RGBA format
  3. Pre-process the image with a script (e.g. ImageMagick: magick in.png -depth 8 -alpha off out.png)
  4. Check the source texture asset's format in the editor's texture properties

Example fix

// before
magick height16.png heightmap.png // 16-bit, unsupported
// after
magick height16.png -depth 8 -alpha off heightmap.png // R8G8B8A8-compatible
Defensive patterns

Strategy: validation

Validate before calling

var fmt = GetImageFormat(path); // e.g. via Magick.NET or System.Drawing
var supported = new[] { PixelFormat.B8G8R8X8_UNorm, PixelFormat.B8G8R8X8_UNorm_SRgb, PixelFormat.R8G8B8A8_UNorm, PixelFormat.R8G8B8A8_UNorm_SRgb };
if (!supported.Contains(fmt)) throw new InvalidOperationException($"{fmt} not supported; re-save as 8-bit RGBA");

Prevention

When it happens

Trigger: Importing a heightmap image whose PixelFormat is not one of B8G8R8X8_UNorm, B8G8R8X8_UNorm_SRgb, R8G8B8A8_UNorm, or R8G8B8A8_UNorm_SRgb (e.g. 16-bit grayscale, R32_Float, or paletted PNG) in DoCommandOverride.

Common situations: Exporting heightmaps from terrain tools as 16-bit or single-channel grayscale images, or saving JPEG/PNG with unusual color depths.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/83b0b49e0eb4e50a. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Assets/Physics/HeightmapAssetCompiler.cs:127

                        case PixelFormat.B8G8R8X8_UNorm:
                        case PixelFormat.R8G8B8A8_UNorm:
                        case PixelFormat.R8G8_UNorm:
                            textureTool.Convert(texImage, PixelFormat.R8_UNorm);
                            break;

                        case PixelFormat.R8G8B8A8_SNorm:
                        case PixelFormat.R8G8_SNorm:
                            textureTool.Convert(texImage, PixelFormat.R8_UNorm);
                            break;

                        case PixelFormat.B8G8R8A8_UNorm_SRgb:
                        case PixelFormat.B8G8R8X8_UNorm_SRgb:
                        case PixelFormat.R8G8B8A8_UNorm_SRgb:
                            textureTool.Convert(texImage, PixelFormat.R8_UNorm);
                            break;

                        default:
                            throw new Exception($"{ texImage.Format } format is not supported.");
                    }

                    // Convert pixels to heights

                    using (var image = textureTool.ConvertToStrideImage(texImage))
                    {
                        var pixelBuffer = image.PixelBuffer[0];
                        var pixelBufferSize = new Int2(pixelBuffer.Width, pixelBuffer.Height);

                        var minFloat = Parameters.FloatingPointComponentRange.X;
                        var maxFloat = Parameters.FloatingPointComponentRange.Y;
                        var isSNorm = (Math.Abs(-1 - minFloat) < float.Epsilon) && (Math.Abs(1 - maxFloat) < float.Epsilon);

                        if (maxFloat < minFloat)
                        {
                            throw new Exception($"{ nameof(Parameters.FloatingPointComponentRange) }.{ nameof(Parameters.FloatingPointComponentRange.Y) } should be greater than { nameof(Parameters.FloatingPointComponentRange.X) }.");
                        }

View on GitHub (pinned to 96fad776d2)