file in abyss
フォーマット一覧へ戻る

3D

GLTF glTF JSON

3DシーンをJSONで記述するランタイム向け形式。アセット情報、シーン、ノード、メッシュ、マテリアルなどを持ちます。

Extensions .gltf
MIME model/gltf+json

マジックナンバー

ファイルを解析
オフセット 0 JSON object start
7B
{

構造

  1. asset
  2. scenes
  3. nodes
  4. meshes
  5. materials
  6. buffers
  7. bufferViews
  8. accessors

注意点

  • 通常のJSONと同じ先頭になるため、asset.versionやシーン構造を確認する必要があります。
  • 外部.binやテクスチャを参照するglTFは単体では完結しません。

判定コード例

SIGNATURE = bytes.fromhex("7b")
OFFSET = 0

def is_gltf(path: str) -> bool:
    with open(path, "rb") as f:
        f.seek(OFFSET)
        head = f.read(len(SIGNATURE))
    return head == SIGNATURE

実践的な使い方

ユースケース

glTF JSON は3Dビューア、アセットパイプライン、モデル変換、アバター読み込み、シーン検証などで使われます。コンテナ・拡張子・バイナリチャンク・テクスチャ参照が実装の挙動に影響します。

よくある判定ミス

  • .gltf という拡張子だけではファイルの中身を保証できません。アップロードや変換の処理では、拡張子・MIMEタイプ・先頭バイト・形式固有の構造チェックを組み合わせるべきです。
  • glTF JSON は 7B のようなシグネチャで始まりますが、関連するコンテナや破損ファイルでは追加の検証が必要になる場合があります。

セキュリティ上の注意

形式が判定できたからといって、信頼できない入力が安全とは限りません。パーサ例外・巨大ファイル・想定外のエンコーディング・外部参照を考慮してください。

サンプルの活用

11 個のサンプルで、ビューアの読み込み・拡張子判定・ファイルサイズごとの読み込み時間をテストできます。

サンプルファイル

11 / 11 files
Sample Traits Size Source / license / SHA-256
3D

Box Vertex Colors glTF

Box Vertex Colors glTF is a glTF JSON sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.

01-box-vertex-colors.gltf
Type Sample
3.0 KB
SHA-256 cb6215d4ef8df16a7c53205fd275dcea32dda247c6c1af60187436cadb98c28a
Download
3D

Animated Colors Cube glTF

Animated Colors Cube glTF is a glTF JSON sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.

02-animated-colors-cube.gltf
Type Sample
22 KB
SHA-256 54e837a6976b351f4772fc57076a1edf549c3ab99c8bffb210a1c0b1c7e8fd93
Download
3D

Animated Morph Cube glTF

Animated Morph Cube glTF is a glTF JSON sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.

03-animated-morph-cube.gltf
Type Sample
10 KB
SHA-256 90af46348798c241bd74a0d880800f252c0b7afa6be734978c40e30a204647d8
Download
3D

Simple Instancing glTF

Simple Instancing glTF is a glTF JSON sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.

04-simple-instancing.gltf
Type Sample
10 KB
SHA-256 250b8242f684d8b743b18e35a0f59234f4b7308bbe514d14ab10ff702d9600e6
Download
3D

Metal Rough Spheres glTF

Metal Rough Spheres glTF is a glTF JSON sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.

05-metal-rough-spheres.gltf
Type Sample
405 KB
SHA-256 cbb92e989cdfa3944f5c3c9c266746199492a0f0ca77b694d3859afea5123216
Download
3D

Glass Vase Flowers glTF

Glass Vase Flowers glTF is a glTF JSON sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.

06-glass-vase-flowers.gltf
Type Sample
Large file
2.32 MB
SHA-256 8a1ddbf4a06eef0b18da3ec1980626b7d35e5d31edc9fe3d73781891b0f81a7e
Download
3D

Clearcoat Wicker glTF

Clearcoat Wicker glTF is a glTF JSON sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.

07-clearcoat-wicker.gltf
Type Sample
Large file
1.65 MB
SHA-256 f522f62c246575fbedc7bf5b1ae81fad75e4f175745e899017a7021c8db6c72d
Download
3D

Avocado glTF

Avocado glTF is a glTF JSON sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.

08-avocado.gltf
Type Sample
Large file
10.31 MB
SHA-256 39a339e95a6840e50b9d758d64e24892f02ef9e6ce9a61973c2b509a3f9834c0
Download
3D

Toy Car glTF

Toy Car glTF is a glTF JSON sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.

09-toy-car.gltf
Type Sample
Large file
6.90 MB
SHA-256 6d6eb3eb045bd15adf10dd60b6f79667743eb0683b327822d395e43c90bcd1c7
Download
3D

Water Bottle glTF

Water Bottle glTF is a glTF JSON sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.

10-water-bottle.gltf
Type Sample
Large file
11.40 MB
SHA-256 598ad629764421c72557f5795c2de9ae0f6c2932cbd7390c685ffbaf583d3b98
Download
3D

Box glTF

Box glTF is a glTF JSON sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.

box.gltf
Type Sample
2.8 KB
SHA-256 2803457f6adb3d3326a9ff4ac1cf3cdd4106fb6c78f18312c10da6bba14b7d77
Download

よくある質問

glTF JSON のマジックナンバー(ファイルシグネチャ)は?

glTF JSON ファイルはバイトシグネチャ 7B ("{") で始まります。拡張子に頼らず、この先頭バイトを読み取って形式を判定してください。

glTF JSON のMIMEタイプは?

glTF JSON のMIMEタイプは model/gltf+json です。

glTF JSON の拡張子は?

glTF JSON ファイルは .gltf 拡張子を使います。拡張子は慣習にすぎず中身を保証しないため、シグネチャや構造のチェックと組み合わせてください。

関連フォーマット