Karthik Saxena
Karthik Saxena

Reputation: 888

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

enter image description here

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.

enter image description here

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

Upvotes: 5

Views: 5059

Answers (3)

Sejpalsinh Jadeja
Sejpalsinh Jadeja

Reputation: 355

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.

Upvotes: 0

Canato
Canato

Reputation: 3978

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)

enter image description here

Inside this folder add the .obj and .mtl

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

enter image description here

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')

Upvotes: 1

Steven Mohr
Steven Mohr

Reputation: 1167

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.

Upvotes: 0

Related Questions