CariusLars / ar_flutter_plugin

Flutter Plugin for AR (Augmented Reality) - Supports ARKit on iOS and ARCore on Android devices
MIT License
326 stars 242 forks source link

GLTF doesn't work for iOS 16 #183

Closed lecanhhiep closed 1 year ago

lecanhhiep commented 1 year ago

Hi,

The chicken GLTF works perfectly for both ios and android. But the one I have downloaded on sketchfab doesn't work for ios, just only android.

Do you know why? and how to print ARKit log to console to check?

Thanks!

lecanhhiep commented 1 year ago

Below is GLTF content:

{ "accessors": [ { "bufferView": 2, "componentType": 5126, "count": 4, "max": [ 1.0, 0.33244699239730835, 1.5 ], "min": [ 1.0, -0.33244699239730835, 0.5 ], "type": "VEC3" }, { "bufferView": 2, "byteOffset": 48, "componentType": 5126, "count": 4, "max": [ 1.0, 0.0, 0.0 ], "min": [ 1.0, 0.0, 0.0 ], "type": "VEC3" }, { "bufferView": 1, "componentType": 5126, "count": 4, "max": [ 1.0, 1.0 ], "min": [ 0.0, 0.0 ], "type": "VEC2" }, { "bufferView": 0, "componentType": 5125, "count": 6, "type": "SCALAR" }, { "bufferView": 2, "byteOffset": 96, "componentType": 5126, "count": 4, "max": [ -0.5149319767951965, -0.5149319767951965, 1.5 ], "min": [ -0.9850680232048035, -0.9850680232048035, 0.5 ], "type": "VEC3" }, { "bufferView": 2, "byteOffset": 144, "componentType": 5126, "count": 4, "max": [ -0.7071068286895752, -0.7071068286895752, -0.0 ], "min": [ -0.7071068286895752, -0.7071068286895752, -0.0 ], "type": "VEC3" }, { "bufferView": 1, "byteOffset": 32, "componentType": 5126, "count": 4, "max": [ 1.0, 1.0 ], "min": [ 0.0, 0.0 ], "type": "VEC2" }, { "bufferView": 0, "byteOffset": 24, "componentType": 5125, "count": 6, "type": "SCALAR" }, { "bufferView": 2, "byteOffset": 192, "componentType": 5126, "count": 4, "max": [ -1.0, 0.33244699239730835, 1.5 ], "min": [ -1.0, -0.33244699239730835, 0.5 ], "type": "VEC3" }, { "bufferView": 2, "byteOffset": 240, "componentType": 5126, "count": 4, "max": [ -1.0, -0.0, 0.0 ], "min": [ -1.0, -0.0, 0.0 ], "type": "VEC3" }, { "bufferView": 1, "byteOffset": 64, "componentType": 5126, "count": 4, "max": [ 1.0, 1.0 ], "min": [ 0.0, 0.0 ], "type": "VEC2" }, { "bufferView": 0, "byteOffset": 48, "componentType": 5125, "count": 6, "type": "SCALAR" }, { "bufferView": 2, "byteOffset": 288, "componentType": 5126, "count": 4, "max": [ 0.33244699239730835, -1.0, 1.5 ], "min": [ -0.33244699239730835, -1.0, 0.5 ], "type": "VEC3" }, { "bufferView": 2, "byteOffset": 336, "componentType": 5126, "count": 4, "max": [ 0.0, -1.0, 0.0 ], "min": [ 0.0, -1.0, 0.0 ], "type": "VEC3" }, { "bufferView": 1, "byteOffset": 96, "componentType": 5126, "count": 4, "max": [ 1.0, 1.0 ], "min": [ 0.0, 0.0 ], "type": "VEC2" }, { "bufferView": 0, "byteOffset": 72, "componentType": 5125, "count": 6, "type": "SCALAR" }, { "bufferView": 2, "byteOffset": 384, "componentType": 5126, "count": 4, "max": [ 0.9850749969482422, -0.5149250030517578, 1.5 ], "min": [ 0.5149250030517578, -0.9850749969482422, 0.5 ], "type": "VEC3" }, { "bufferView": 2, "byteOffset": 432, "componentType": 5126, "count": 4, "max": [ 0.7071068286895752, -0.7071068286895752, -0.0 ], "min": [ 0.7071068286895752, -0.7071068286895752, -0.0 ], "type": "VEC3" }, { "bufferView": 1, "byteOffset": 128, "componentType": 5126, "count": 4, "max": [ 1.0, 1.0 ], "min": [ 0.0, 0.0 ], "type": "VEC2" }, { "bufferView": 0, "byteOffset": 96, "componentType": 5125, "count": 6, "type": "SCALAR" }, { "bufferView": 2, "byteOffset": 480, "componentType": 5126, "count": 4, "max": [ -0.5148919820785522, 0.9851080179214478, 1.5 ], "min": [ -0.9851080179214478, 0.5148919820785522, 0.5 ], "type": "VEC3" }, { "bufferView": 2, "byteOffset": 528, "componentType": 5126, "count": 4, "max": [ 0.7071068286895752, -0.7071068286895752, -0.0 ], "min": [ 0.7071068286895752, -0.7071068286895752, -0.0 ], "type": "VEC3" }, { "bufferView": 1, "byteOffset": 160, "componentType": 5126, "count": 4, "max": [ 1.0, 1.0 ], "min": [ 0.0, 0.0 ], "type": "VEC2" }, { "bufferView": 0, "byteOffset": 120, "componentType": 5125, "count": 6, "type": "SCALAR" }, { "bufferView": 2, "byteOffset": 576, "componentType": 5126, "count": 4, "max": [ 0.3324750065803528, 1.0, 1.5 ], "min": [ -0.3324750065803528, 1.0, 0.5 ], "type": "VEC3" }, { "bufferView": 2, "byteOffset": 624, "componentType": 5126, "count": 4, "max": [ 0.0, -1.0, 0.0 ], "min": [ 0.0, -1.0, 0.0 ], "type": "VEC3" }, { "bufferView": 1, "byteOffset": 192, "componentType": 5126, "count": 4, "max": [ 1.0, 1.0 ], "min": [ 0.0, 0.0 ], "type": "VEC2" }, { "bufferView": 0, "byteOffset": 144, "componentType": 5125, "count": 6, "type": "SCALAR" }, { "bufferView": 2, "byteOffset": 672, "componentType": 5126, "count": 4, "max": [ 0.9850749969482422, 0.9850749969482422, 1.5 ], "min": [ 0.5149250030517578, 0.5149250030517578, 0.5 ], "type": "VEC3" }, { "bufferView": 2, "byteOffset": 720, "componentType": 5126, "count": 4, "max": [ -0.7071068286895752, -0.7071068286895752, -0.0 ], "min": [ -0.7071068286895752, -0.7071068286895752, -0.0 ], "type": "VEC3" }, { "bufferView": 1, "byteOffset": 224, "componentType": 5126, "count": 4, "max": [ 1.0, 1.0 ], "min": [ 0.0, 0.0 ], "type": "VEC2" }, { "bufferView": 0, "byteOffset": 168, "componentType": 5125, "count": 6, "type": "SCALAR" }, { "bufferView": 2, "byteOffset": 768, "componentType": 5126, "count": 216, "max": [ 1.0, 1.0, 1.67399001121521 ], "min": [ -1.0, -1.0, -0.037230998277664185 ], "type": "VEC3" }, { "bufferView": 2, "byteOffset": 3360, "componentType": 5126, "count": 216, "max": [ 1.0, 1.0, 1.0 ], "min": [ -1.0, -1.0, -1.0 ], "type": "VEC3" }, { "bufferView": 1, "byteOffset": 256, "componentType": 5126, "count": 216, "max": [ 1.0, 1.0 ], "min": [ 0.0, 0.0 ], "type": "VEC2" }, { "bufferView": 0, "byteOffset": 192, "componentType": 5125, "count": 408, "type": "SCALAR" } ], "asset": { "extras": { "author": "josh.davey (https://sketchfab.com/josh.davey)", "license": "CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)", "source": "https://sketchfab.com/3d-models/3d-gallery-38b73cb73a104a16ae33841ee1decab2", "title": "3d Gallery" }, "generator": "Sketchfab-12.68.0", "version": "2.0" }, "bufferViews": [ { "buffer": 0, "byteLength": 1824, "name": "floatBufferViews", "target": 34963 }, { "buffer": 0, "byteLength": 1984, "byteOffset": 1824, "byteStride": 8, "name": "floatBufferViews", "target": 34962 }, { "buffer": 0, "byteLength": 5952, "byteOffset": 3808, "byteStride": 12, "name": "floatBufferViews", "target": 34962 } ], "buffers": [ { "byteLength": 9760, "uri": "scene.bin" } ], "extensionsUsed": [ "KHR_materials_unlit" ], "images": [ { "uri": "Chair_baseColor.jpeg" }, { "uri": "DSC_0001_baseColor.jpeg" }, { "uri": "DSC_0002_baseColor.jpeg" }, { "uri": "DSC_0003_baseColor.jpeg" }, { "uri": "DSC_0004_baseColor.jpeg" }, { "uri": "DSC_0007_baseColor.jpeg" }, { "uri": "DSC_0012_baseColor.png" }, { "uri": "DSC_0017_baseColor.jpeg" } ], "materials": [ { "doubleSided": true, "extensions": { "KHR_materials_unlit": {} }, "name": "Chair", "pbrMetallicRoughness": { "baseColorTexture": { "index": 0 }, "metallicFactor": 0.0 } }, { "doubleSided": true, "extensions": { "KHR_materials_unlit": {} }, "name": "DSC_0001", "pbrMetallicRoughness": { "baseColorTexture": { "index": 1 }, "metallicFactor": 0.0 } }, { "doubleSided": true, "extensions": { "KHR_materials_unlit": {} }, "name": "DSC_0002", "pbrMetallicRoughness": { "baseColorTexture": { "index": 2 }, "metallicFactor": 0.0 } }, { "doubleSided": true, "extensions": { "KHR_materials_unlit": {} }, "name": "DSC_0003", "pbrMetallicRoughness": { "baseColorTexture": { "index": 3 }, "metallicFactor": 0.0 } }, { "doubleSided": true, "extensions": { "KHR_materials_unlit": {} }, "name": "DSC_0004", "pbrMetallicRoughness": { "baseColorTexture": { "index": 4 }, "metallicFactor": 0.0 } }, { "doubleSided": true, "extensions": { "KHR_materials_unlit": {} }, "name": "DSC_0007", "pbrMetallicRoughness": { "baseColorTexture": { "index": 5 }, "metallicFactor": 0.0 } }, { "doubleSided": true, "extensions": { "KHR_materials_unlit": {} }, "name": "DSC_0012", "pbrMetallicRoughness": { "baseColorTexture": { "index": 6 }, "metallicFactor": 0.0 } }, { "doubleSided": true, "extensions": { "KHR_materials_unlit": {} }, "name": "DSC_0017", "pbrMetallicRoughness": { "baseColorTexture": { "index": 7 }, "metallicFactor": 0.0 } }, { "doubleSided": true, "extensions": { "KHR_materials_unlit": {} }, "name": "None", "pbrMetallicRoughness": { "baseColorFactor": [ 0.16634908536585366, 0.16634908536585366, 0.16634908536585366, 1.0 ], "metallicFactor": 0.0 } } ], "meshes": [ { "name": "Object_0", "primitives": [ { "attributes": { "NORMAL": 1, "POSITION": 0, "TEXCOORD_0": 2 }, "indices": 3, "material": 0, "mode": 4 } ] }, { "name": "Object_1", "primitives": [ { "attributes": { "NORMAL": 5, "POSITION": 4, "TEXCOORD_0": 6 }, "indices": 7, "material": 1, "mode": 4 } ] }, { "name": "Object_2", "primitives": [ { "attributes": { "NORMAL": 9, "POSITION": 8, "TEXCOORD_0": 10 }, "indices": 11, "material": 2, "mode": 4 } ] }, { "name": "Object_3", "primitives": [ { "attributes": { "NORMAL": 13, "POSITION": 12, "TEXCOORD_0": 14 }, "indices": 15, "material": 3, "mode": 4 } ] }, { "name": "Object_4", "primitives": [ { "attributes": { "NORMAL": 17, "POSITION": 16, "TEXCOORD_0": 18 }, "indices": 19, "material": 4, "mode": 4 } ] }, { "name": "Object_5", "primitives": [ { "attributes": { "NORMAL": 21, "POSITION": 20, "TEXCOORD_0": 22 }, "indices": 23, "material": 5, "mode": 4 } ] }, { "name": "Object_6", "primitives": [ { "attributes": { "NORMAL": 25, "POSITION": 24, "TEXCOORD_0": 26 }, "indices": 27, "material": 6, "mode": 4 } ] }, { "name": "Object_7", "primitives": [ { "attributes": { "NORMAL": 29, "POSITION": 28, "TEXCOORD_0": 30 }, "indices": 31, "material": 7, "mode": 4 } ] }, { "name": "Object_8", "primitives": [ { "attributes": { "NORMAL": 33, "POSITION": 32, "TEXCOORD_0": 34 }, "indices": 35, "material": 8, "mode": 4 } ] } ], "nodes": [ { "children": [ 1 ], "matrix": [ 1.0, 0.0, 0.0, 0.0, 0.0, 2.220446049250313e-16, -1.0, 0.0, 0.0, 1.0, 2.220446049250313e-16, 0.0, 0.0, 0.0, 0.0, 1.0 ], "name": "Sketchfab_model" }, { "children": [ 2, 3, 4, 5, 6, 7, 8, 9, 10 ], "name": "a48a81fb3d114956a384ce3014fc8f23.obj.cleaner.materialmerger.gles" }, { "mesh": 0, "name": "Object_2" }, { "mesh": 1, "name": "Object_3" }, { "mesh": 2, "name": "Object_4" }, { "mesh": 3, "name": "Object_5" }, { "mesh": 4, "name": "Object_6" }, { "mesh": 5, "name": "Object_7" }, { "mesh": 6, "name": "Object_8" }, { "mesh": 7, "name": "Object_9" }, { "mesh": 8, "name": "Object_10" } ], "samplers": [ { "magFilter": 9729, "minFilter": 9987, "wrapS": 10497, "wrapT": 10497 } ], "scene": 0, "scenes": [ { "name": "Sketchfab_Scene", "nodes": [ 0 ] } ], "textures": [ { "sampler": 0, "source": 0 }, { "sampler": 0, "source": 1 }, { "sampler": 0, "source": 2 }, { "sampler": 0, "source": 3 }, { "sampler": 0, "source": 4 }, { "sampler": 0, "source": 5 }, { "sampler": 0, "source": 6 }, { "sampler": 0, "source": 7 } ] }

lecanhhiep commented 1 year ago

I found the issue, it works actually, just we need increase scale to 100 times because it's very very small compare to android. lol Vector3(0.2, 0.2, 0.2) -> Vector3(20, 20, 20)