Git Product home page Git Product logo

google-ar-asset-converter's Introduction

Google ARCore Asset Converter

Future from this repo

After Google released the 1.16.0 version of the Sceneform they deprecated SFB and SFB Android Studio Plugin. They are adopting the use of GLTF format instead of the SFB.

Deprecates support for SFB & the SFB Sceneform Android Studio plugin (glTF can be used instead).

Facing this new reality I'm going to not do any update in this repo anymore.

License

Sceneform SDK for Android

Copyright (c) 2018 Google Inc. All rights reserved.

Sceneform is a 3D framework, with a physically based renderer, that's optimized for mobile, and that makes it easy for Java developers to build augmented reality apps.

Please note, we do not accept pull requests.

Getting Started

This repository contains Sceneform binaries to generate .SFA and .SFB files to import on any ARCore projects.

Generating assets

$ ./sceneform_sdk/linux/converter -a -d --mat ./sceneform_sdk/default_materials/obj_material.sfm --outdir ./output/ ./input/andy.obj

API Reference

See the Sceneform API Reference.

Terms & Conditions

By downloading the Sceneform SDK for Android, you agree that the Google APIs Terms of Service governs your use thereof.

Converter and Matc Arguments

To see the single available arguments call

./converter -h

or

./matc -h

repectively.

google-ar-asset-converter's People

Contributors

gdamoreira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

google-ar-asset-converter's Issues

Seg fault when converting glTF asset without normals

Regardless of model complexity, converting a glTF to sfb always fails when it has no normals.
Example glTF:

{
    "accessors": [
        {
            "bufferView": 0,
            "componentType": 5123,
            "count": 36,
            "max": [
                23.0
            ],
            "min": [
                0.0
            ],
            "type": "SCALAR"
        },
        {
            "bufferView": 1,
            "componentType": 5126,
            "count": 24,
            "max": [
                0.5,
                0.5,
                0.5
            ],
            "min": [
                -0.5,
                -0.5,
                -0.5
            ],
            "type": "VEC3"
        }
    ],
    "asset": {
        "extras": {},
        "version": "2.0"
    },
    "bufferViews": [
        {
            "buffer": 0,
            "byteLength": 72,
            "target": 34963
        },
        {
            "buffer": 0,
            "byteLength": 288,
            "byteOffset": 72,
            "byteStride": 12,
            "target": 34962
        }
    ],
    "buffers": [
        {
            "byteLength": 360,
            "uri": "data:application/octet-stream;base64,AAABAAIAAwACAAEABAAFAAYABwAGAAUACAAJAAoACwAKAAkADAANAA4ADwAOAA0AEAARABIAEwASABEAFAAVABYAFwAWABUAAAAAvwAAAD8AAAA/AAAAPwAAAD8AAAA/AAAAvwAAAD8AAAC/AAAAPwAAAD8AAAC/AAAAPwAAAD8AAAA/AAAAvwAAAD8AAAA/AAAAPwAAAL8AAAA/AAAAvwAAAL8AAAA/AAAAPwAAAD8AAAC/AAAAPwAAAD8AAAA/AAAAPwAAAL8AAAC/AAAAPwAAAL8AAAA/AAAAvwAAAD8AAAC/AAAAPwAAAD8AAAC/AAAAvwAAAL8AAAC/AAAAPwAAAL8AAAC/AAAAvwAAAD8AAAA/AAAAvwAAAD8AAAC/AAAAvwAAAL8AAAA/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAA/AAAAvwAAAL8AAAC/AAAAPwAAAL8AAAA/AAAAPwAAAL8AAAC/"
        }
    ],
    "meshes": [
        {
            "name": "Mesh",
            "primitives": [
                {
                    "attributes": {
                        "POSITION": 1
                    },
                    "indices": 0,
                    "mode": 4
                }
            ]
        }
    ],
    "nodes": [
        {
            "mesh": 0
        }
    ],
    "scene": 0,
    "scenes": [
        {
            "nodes": [
                0
            ]
        }
    ]
}

Conversion command:

~/Code/google-ar-asset-converter/sceneform_sdk/linux/converter -b no_norms.gltf

Result:

Segmentation fault (core dumped)

Error: Running matc: Failed to run external command

I got one (pretty large) example OBJ file which is causing the error in the title when I run it server-side on AWS (Linux). The same conversion does succeed locally on Mac OS though.

Error: Running matc: Failed to run external command

Has anyone seen this error?
Can anyone help point me in the right direction?

I am not sure what to make of it. My other test files work fine and the only notable difference is the size of the input file.

  • Does not seem to reach a memory limit, as far as AWS metrics can show me.
  • It is finding the matc command (removing that executable gives a different error).
  • The error is returned in STDOut not STDErr.

Note: I am posting here in the hope that someone else also using this converter separately might have seen the same error output.

SFA file content is not used to update SFB file

I would expect that, if an SFA file is present for the given SFB and if converter is launched without -a option, the content of SFA is used to update SFB.

Android Studio allows changing SFA file and to update SFB. How can I achieve the same result using converter script?

The reason why I am asking this question is the following: converter script, as well as Android Studio, detects the object as too large and so sets the scale to some (random) value to compensate. I need to set the scale to 100%. In Android Studio, I am used to edit generated SFA files, change the scale to what I need and then rebuild.

sfb file is too big for our models, around 10MB

For other files of one model, the total size is 4 MB. However, the sfb file of this model is around 10MB. Do we really need sfb file? Our app downloads the model in realtime, so we really concern about the size of models.

Converter 1.7.0 maybe flawed

The following command on the 1.7.0 converter:

./converter fj1252.obj

fails with:

- Import failed with 4 errors:
-E: OBJ: failed to locate material mtl1, creating new material
-E: OBJ: vertex index out of range
-E: Unable to load scene: fj1252.obj
-E: OBJ: vertex index out of range
ERROR [third_party/lullaby/tools/model_pipeline/model_pipeline.cc:311] Unable to import model: fj1252
Error: Failed to import 'fj1252.obj'

The converter from 1.6.0 works as expected without errors. Other arguments do not play a role, I tested some of them. Workaround only use the converter from version 1.6.0 or below. This maybe a bug of 1.7.0, so feel free to close this issue as you please. The file is: fj1252.zip

Getting below error while running the convertor script

command used:
./sceneform_sdk/linux/converter -a -d --mat ./sceneform_sdk/default_materials/obj_material.sfm --outdir ./output/ ./input/andy.obj

Error message:

./sceneform_sdk/linux/converter: /lib64/libc.so.6: version GLIBC_2.10' not found (required by ./sceneform_sdk/linux/converter) ./sceneform_sdk/linux/converter: /lib64/libc.so.6: version GLIBC_2.14' not found (required by ./sceneform_sdk/linux/converter)
./sceneform_sdk/linux/converter: /lib64/libc.so.6: version GLIBC_2.7' not found (required by ./sceneform_sdk/linux/converter) ./sceneform_sdk/linux/converter: /lib64/libc.so.6: version GLIBC_2.16' not found (required by ./sceneform_sdk/linux/converter)
./sceneform_sdk/linux/converter: /lib64/libc.so.6: version GLIBC_2.6' not found (required by ./sceneform_sdk/linux/converter) ./sceneform_sdk/linux/converter: /lib64/libc.so.6: version GLIBC_2.12' not found (required by ./sceneform_sdk/linux/converter)

Fbx to sfb file conversion doesn't work

Hi I am trying to convert a fbx file by this command

./converter -a -d --mat /Users/macbookpro/Downloads/google-ar-asset-converter-master/sceneform_sdk/default_materials/fbx_material.sfm --outdir /Users/macbookpro/Downloads/google-ar-asset-converter-master/output /Users/macbookpro/Downloads/Display8.fbx

but I am getting below Error

2019-09-20 12:53:05.577 converter[576:11382] FATAL (null)
2019-09-20 12:53:05.579 converter[576:11382] FATAL Dumping stack:
#00 pc 0000000104f9a510 /Users/macbookpro/Downloads/google-ar-asset-converter-master/sceneform_sdk/mac/./converter (ion::base::logging_internal::Logger::~Logger()+128)
#1 pc 0000000104f6b33f /Users/macbookpro/Downloads/google-ar-asset-converter-master/sceneform_sdk/mac/./converter (lull::tool::CompactBoneIndex(int)+266)
#2 pc 0000000104f6b981 /Users/macbookpro/Downloads/google-ar-asset-converter-master/sceneform_sdk/mac/./converter (lull::tool::GatherBoneIndexMaps(std::__1::vector<lull::tool::Bone, std::__1::allocatorlull::tool::Bone > const&, std::__1::vector<lull::tool::Vertex, std::__1::allocatorlull::tool::Vertex > const&, std::__1::vector<unsigned char, std::__1::allocator >, std::__1::vector<unsigned char, std::__1::allocator >)+379)
#3 pc 0000000104f5b42c /Users/macbookpro/Downloads/google-ar-asset-converter-master/sceneform_sdk/mac/./converter (lull::tool::ExportModelInstance(lull::tool::Model const&, lull::ModelInstanceDefT*, lull::ModelPipelineRenderableDefT*, lull::tool::ExportOptions)+134)
#4 pc 0000000104f5fcde /Users/macbookpro/Downloads/google-ar-asset-converter-master/sceneform_sdk/mac/./converter (lull::tool::ExportModel(std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, lull::tool::Model, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, lull::tool::Model> > > const&, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, lull::tool::TextureInfo, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, lull::tool::TextureInfo> > > const&, lull::tool::ExportOptions, lull::ModelPipelineDefT*)+924)
#5 pc 0000000104f54af3 /Users/macbookpro/Downloads/google-ar-asset-converter-master/sceneform_sdk/mac/./converter (lull::tool::ModelPipeline::Build(lull::tool::ExportOptions)+47)
#6 pc 0000000104f52d00 /Users/macbookpro/Downloads/google-ar-asset-converter-master/sceneform_sdk/mac/./converter (lull::tool::ModelPipeline::Import(lull::ModelPipelineDef const*, lull::tool::ExportOptions)+7296)
#7 pc 000000010446d2e0 /Users/macbookpro/Downloads/google-ar-asset-converter-master/sceneform_sdk/mac/./converter (sceneform::converter::Converter::Run()+5876)
#8 pc 000000010446af94 /Users/macbookpro/Downloads/google-ar-asset-converter-master/sceneform_sdk/mac/./converter (main+3924)

is there something wrong with the command

abstracting sceneform_sdk files

I'm curious how the sceneform_sdk files get abstracted from the sdk, could you provide some insight on how this is done?

Thanks!

Only one texture from fbx model

When i try to convert model from fbx file it gets only one texture applied to .sfb
FBX:
image

.SFB:
image

to convert i use command:
./sceneform_sdk/windows/converter -a -d --mat ./sceneform_sdk/default_materials/fbx_material.sfm --outdir ./output/ ./input/wheel.fbx

I see that .sfa file contain information about every material, but only one is applied to model.
Thanks for help

E/Filament: Panic

If I convert fbx to sfb and try to use it with com.google.ar.sceneform:animation:1.10.0 my app crashes with:
E/Filament: Panic
in filament::Material *filament::Material::Builder::build(filament::Engine &):86
reason: Material version mismatch. Expected 3 but received 2.
2019-06-25 16:05:31.929 27367-27367/com.google.ar.sceneform.samples.hellosceneform A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 27367 (.hellosceneform), pid 27367 (.hellosceneform)

Could you update it to 1.10.0 version to make it work with com.google.ar.sceneform:animation:1.10.0 ?

Binaries

Could you tell me where did you find this binaries? Thanks.

Error: Textures declared in source assets were not found on disk

Hello! I try convert a model from .fbx format to .sfb. The model contains links to textures, and when I try to convert it I got:

Command to converter:
./converter -a -d --mat ../default_materials/fbx_material.sfm ~/correct_path_to_fbx/sun.fbx

Output from converter:

WARNING: 2 textures declared in source assets were not found on disk:
> - Tex\Sun01_A.png
> - Tex\Sun02_A.png

The directory ~/correct_path_to_fbx contains Tex\Sun01_A.png and Tex\Sun02_A.png

Actually, I got sfb-file, but it doesn't include textures.

What am I doing wrong?

Changing textures at runtime

Hi, thanks for this, it really helped with my app. However, I am having issues with changing the texture of sfb renderables converted from obj by this converter. Have you had to do so? If so, how did you accomplish it? renderable.material.setTexture appears to do nothing at all. All I have to do is change the color. Thanks!

How to use this converter in android device in runtime?

Hi, i want to use this converter on an Android device, for runtime converting .obj to .sfb.
My code does not work.

val root = getExternalFilesDir(null).toString() + "/google-ar-asset-converter"

val command = "chmod u+x $root/sceneform_sdk/linux/converter -a -d --mat $root/sceneform_sdk/default_materials/obj_material.sfm --outdir $root/output/ $root/input/andy.obj"

val process: Process = Runtime.getRuntime().exec("$command")

E/ERROR: chmod: -a: No such file or directory
chmod: -d: No such file or directory
chmod: --mat: No such file or directory
chmod: --outdir: No such file or directory

Do you have any idea how to fix this error?

Getting error file converting files from POLY

Getting below resource not found error, when I try to convert file from Poly to .sfb format.
Image is generated but colors are not rendered properly.

ubuntu@ubuntu:~/Downloads/google-ar-asset-converter-master$ ./sceneform_sdk/linux/converter -a -d --mat ./sceneform_sdk/default_materials/obj_material.sfm --outdir ./output/ ./input/human_male.obj
Warning: Imported asset was very large (683.8 x 1763.7 x 398.2 m)
Setting scale to: 0.0025113 to compensate
Info: Generated SFA from ./input/human_male.obj

WARNING: 20 textures declared in source assets were not found on disk:

  • D:\VirtualSpeech\App\Unity\VS_google_cardboard_v31\Assets\avatars\male_high_res\man1.fbm\man1_Body_Opacity.png
  • man1_Body_Normal_Normal_Bump.tga
  • D:\VirtualSpeech\App\Unity\VS_google_cardboard_v31\Assets\avatars\male_high_res\man1.fbm\man1_Body_Specular.png
  • D:\VirtualSpeech\App\Unity\VS_google_cardboard_v31\Assets\avatars\male_high_res\man1.fbm\man1_Body_Diffuse.png
  • man1_Bottom_Normal_Normal_Bump.tga
  • D:\VirtualSpeech\App\Unity\VS_google_cardboard_v31\Assets\avatars\male_high_res\man1.fbm\man1_Bottom_Specular.png
  • D:\VirtualSpeech\App\Unity\VS_google_cardboard_v31\Assets\avatars\male_high_res\man1.fbm\man1_Bottom_Opacity.png
  • D:\VirtualSpeech\App\Unity\VS_google_cardboard_v31\Assets\avatars\male_high_res\man1.fbm\man1_Bottom_Diffuse.png
  • D:\VirtualSpeech\App\Unity\VS_google_cardboard_v31\Assets\avatars\male_high_res\man1.fbm\man1_Top_Opacity.png
  • man1_Top_Normal_Normal_Bump.tga
  • D:\VirtualSpeech\App\Unity\VS_google_cardboard_v31\Assets\avatars\male_high_res\man1.fbm\man1_Top_Specular.png
  • D:\VirtualSpeech\App\Unity\VS_google_cardboard_v31\Assets\avatars\male_high_res\man1.fbm\man1_Top_Diffuse.png
  • D:\VirtualSpeech\App\Unity\VS_google_cardboard_v31\Assets\avatars\male_high_res\man1.fbm\man1_Shoes_Opacity.png
  • man1_Shoes_Normal_Normal_Bump.tga
  • D:\VirtualSpeech\App\Unity\VS_google_cardboard_v31\Assets\avatars\male_high_res\man1.fbm\man1_Shoes_Specular.png
  • D:\VirtualSpeech\App\Unity\VS_google_cardboard_v31\Assets\avatars\male_high_res\man1.fbm\man1_Shoes_Diffuse.png
  • D:\VirtualSpeech\App\Unity\VS_google_cardboard_v31\Assets\avatars\male_high_res\man1.fbm\man1_Hair_Opacity.png
  • man1_Hair_Normal_Normal_Bump.tga
  • D:\VirtualSpeech\App\Unity\VS_google_cardboard_v31\Assets\avatars\male_high_res\man1.fbm\man1_Hair_Specular.png
  • D:\VirtualSpeech\App\Unity\VS_google_cardboard_v31\Assets\avatars\male_high_res\man1.fbm\man1_Hair_Diffuse.png
    (use -I to add other search folders)
    Info: Wrote SFA (json) to ./output/human_male.sfa (2555 bytes)
    Info: Wrote SFB to ./output/human_male.sfb (1393752 bytes)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.