{"record":{"id":"7201c24a7dfba154","repo":"mrdoob/three.js","slug":"three-matrix4-makeorthographic-invalid-coordina","errorCode":null,"errorMessage":"THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ${coordinateSystem}","messagePattern":"THREE\\.Matrix4\\.makeOrthographic\\(\\): Invalid coordinate system: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/math/Matrix4.js","lineNumber":1238,"sourceCode":"\n\t\t\tc = 1 / ( far - near );\n\t\t\td = far / ( far - near );\n\n\t\t} else {\n\n\t\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\t\tc = - 2 / ( far - near );\n\t\t\t\td = - ( far + near ) / ( far - near );\n\n\t\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\t\tc = - 1 / ( far - near );\n\t\t\t\td = - near / ( far - near );\n\n\t\t\t} else {\n\n\t\t\t\tthrow new Error( 'THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t\t}\n\n\t\t}\n\n\t\tte[ 0 ] = x;\t\tte[ 4 ] = 0;\t\tte[ 8 ] = 0; \t\tte[ 12 ] = a;\n\t\tte[ 1 ] = 0; \t\tte[ 5 ] = y;\t\tte[ 9 ] = 0; \t\tte[ 13 ] = b;\n\t\tte[ 2 ] = 0; \t\tte[ 6 ] = 0;\t\tte[ 10 ] = c;\t\tte[ 14 ] = d;\n\t\tte[ 3 ] = 0; \t\tte[ 7 ] = 0;\t\tte[ 11 ] = 0;\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if this matrix is equal with the given one.\n\t *\n\t * @param {Matrix4} matrix - The matrix to test for equality.","sourceCodeStart":1220,"sourceCodeEnd":1256,"githubUrl":"https://github.com/mrdoob/three.js/blob/da05705fa31f02710c19772a2aa70c7454807f0c/src/math/Matrix4.js#L1220-L1256","documentation":"Thrown by Matrix4.makeOrthographic() when the coordinateSystem argument is neither WebGLCoordinateSystem nor WebGPUCoordinateSystem. As with makePerspective, the orthographic depth scaling (c and d) differs between WebGL (-1..1 z) and WebGPU (0..1 z); an unknown system yields no valid matrix.","triggerScenarios":"Calling matrix.makeOrthographic(left, right, top, bottom, near, far, coordinateSystem) with a missing/null/custom coordinateSystem. Building an orthographic camera matrix manually without matching the renderer's depth convention.","commonSituations":"Custom orthographic projection for UI/2D layers. Orthographic camera whose coordinateSystem was never synced from a renderer. Porting WebGL projection math to WebGPU (or vice versa) without updating the system flag.","solutions":["Pass a valid coordinate system as the last argument matching your renderer.","Use renderer.coordinateSystem to source the value.","Confirm the constant is imported and resolves to a real value.","When migrating renderers, audit every makeOrthographic/makePerspective call site."],"exampleFix":"// before: missing coordinate system\northo.makeOrthographic(-10, 10, 10, -10, 0.1, 1000);\n\n// after: explicit valid system\northo.makeOrthographic(-10, 10, 10, -10, 0.1, 1000, THREE.WebGPUCoordinateSystem);","handlingStrategy":"validation","validationCode":"import { WebGLCoordinateSystem, WebGPUCoordinateSystem } from 'three';\n\nfunction makeOrthographicSafe(m, l, r, t, b, near, far, coordinateSystem) {\n  if (coordinateSystem !== WebGLCoordinateSystem && coordinateSystem !== WebGPUCoordinateSystem) {\n    throw new Error('coordinateSystem must be WebGL or WebGPU');\n  }\n  return m.makeOrthographic(l, r, t, b, near, far, coordinateSystem);\n}","typeGuard":"function isValidCoordinateSystem(cs) {\n  return cs === THREE.WebGLCoordinateSystem || cs === THREE.WebGPUCoordinateSystem;\n}","tryCatchPattern":null,"preventionTips":["Always supply the coordinateSystem argument for makeOrthographic.","Match the renderer's depth convention (WebGL vs WebGPU).","Re-audit projection call sites when migrating between renderers."],"tags":["threejs","coordinate-system","matrix4","projection","orthographic"],"backgroundTag":null,"analyzedSha":"da05705fa31f02710c19772a2aa70c7454807f0c","analyzedAt":"2026-08-12T22:51:37.160Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}