BabylonJS/Babylon.js · error · Error

Missing arrays in SOG data.

Error message

Missing arrays in SOG data.

What it means

ParseSogDatas reconstructs splat positions from min/max bounds stored in the SOG metadata. It requires data.means.mins and data.means.maxs to be arrays; if either is missing or of the wrong type, splat positions cannot be dequantized and this error is thrown. It indicates the SOG file's metadata is incomplete or malformed.

Source

Thrown at packages/dev/loaders/src/SPLAT/sog.pure.ts:166

async function ParseSogDatas(data: SOGRootData, imageDataArrays: IWebPImage[], scene: Scene): Promise<IParsedSplat> {
    const splatCount = data.count ? data.count : data.means.shape[0];
    const rowOutputLength = 3 * 4 + 3 * 4 + 4 + 4; // 32
    const buffer = new ArrayBuffer(rowOutputLength * splatCount);

    const position = new Float32Array(buffer);
    const scale = new Float32Array(buffer);
    const rgba = new Uint8ClampedArray(buffer);
    const rot = new Uint8ClampedArray(buffer);

    // Undo the symmetric log transform used at encode time:
    const unlog = (n: number) => Math.sign(n) * (Math.exp(Math.abs(n)) - 1);

    const meansl = imageDataArrays[0].bits;
    const meansu = imageDataArrays[1].bits;
    // Check that data.means.mins is an array
    if (!Array.isArray(data.means.mins) || !Array.isArray(data.means.maxs)) {
        throw new Error("Missing arrays in SOG data.");
    }

    // --- Positions
    for (let i = 0; i < splatCount; i++) {
        const index = i * 4;
        for (let j = 0; j < 3; j++) {
            const meansMin = data.means.mins[j];
            const meansMax = data.means.maxs[j];
            const meansup = meansu[index + j];
            const meanslow = meansl[index + j];
            const q = (meansup << 8) | meanslow;
            const n = Scalar.Lerp(meansMin, meansMax, q / 65535);
            position[i * 8 + j] = unlog(n);
        }
    }

    // --- Scales
    const scales = imageDataArrays[2].bits;

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Regenerate the SOG asset so its metadata includes means.mins and means.maxs arrays.
  2. Validate the SOG meta JSON (Array.isArray(meta.means.mins) && Array.isArray(meta.means.maxs)) before parsing.
  3. Check for a version mismatch between the exporter that produced the file and the loader version; upgrade the loader.
  4. Re-upload/repair truncated metadata files on the hosting server.

Example fix

// before
const meta = JSON.parse(metaText);
parseSogMeta(meta); // throws if meta.means.mins missing
// after
const meta = JSON.parse(metaText);
if (!Array.isArray(meta?.means?.mins) || !Array.isArray(meta?.means?.maxs)) {
  throw new Error("SOG meta.json is missing means.mins/maxs");
}
parseSogMeta(meta);
Defensive patterns

Strategy: validation

Validate before calling

const meta = JSON.parse(metaText);
if (!Array.isArray(meta?.means?.mins) || !Array.isArray(meta?.means?.maxs)) {
  throw new Error("SOG meta.json must contain means.mins and means.maxs arrays");
}

Type guard

function hasSogMeansBounds(meta: unknown): meta is { means: { mins: number[]; maxs: number[] } } & Record<string, unknown> {
  const m = meta as any;
  return !!m && Array.isArray(m.means?.mins) && Array.isArray(m.means?.maxs);
}

Try / catch

try {
  await parseSogMeta(metaText, engine);
} catch (e) {
  if (String(e.message).includes("Missing arrays in SOG data")) {
    console.error("SOG metadata missing means bounds — regenerate or repair meta.json", e);
  } else throw e;
}

Prevention

When it happens

Trigger: ParseSogDatas invoked (via ParseSogMeta) on metadata JSON where means.mins or means.maxs is absent, null, or not an array.

Common situations: Hand-written or tool-generated SOG metadata missing the means bounds; truncated meta.json uploads; schema drift between SOG exporter versions and this loader.

Related errors


AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30). Data as JSON: /api/errors/c4f36058bc708d83. Report an issue: GitHub.