简体   繁体   中英

Import Sceneform Asset option gives error while generating SFB file using OBJ file

I have an OBJ file for the 3D Object and I'm using Import Sceneform Asset to convert it to SFA but while doing so it is always giving me error stating Failed to find 'sampledata/models/plc.mtl' on disk

在此处输入图片说明

You can see red boxes.

In one them you can see gradle has created the background code for sceneform.asset but due to mtl missing it cannot go further.

Also, in the default google's arcore project the SFB file is in raw folder but it is creating in assets folder.

See the below image.

在此处输入图片说明

Can anyone please help me out with this. I'm a newbie to ARCore Development.

Please follow this, and if have any problem let me know

You need the .obj and .mtl . Create a folder in Android using the Sample Data Directory (to avoid this making part of your project)

在此处输入图片说明

Inside this folder add the .obj and .mtl

Go to Android Preferences > Plugins and search for "Google Sceneform Tools (Beta)"

在此处输入图片说明

Clicking with the right button on the .obj you can select "Import Sceneform Asset" This will create the .sfb and .sfa file, already ready to use.

And in your App Gradle you should find new lines like this:

sceneform.asset('sampledata/NAME_OF_FILE.obj',
    'default',
    'sampledata/NAME_OF_FILE.sfa',
    'src/main/assets/NAME_OF_FILEl')

You should have a plc.mtl somewhere. It's the file that defines the materials used in the OBJ file. Just copy it in your models folder and everything should work. Usually it comes together with the OBJ file so check the source where you got your OBJ from.

I face the same error and I resolve it by adding this line in build.gradle(:app)

sceneform.asset('path of obj', 'default','path for sfa','path for sfb')

In my case it was

sceneform.asset('sampledata/Hamburger.obj', 'default','sampledata/Hamburger.sfa','src/main/res/raw/hamburger')

And make sure if you are putting output in res directory remove caps from filename. Hope it's work for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM