-
Notifications
You must be signed in to change notification settings - Fork 606
Is there a way to load models from server #35
Comments
The generated sfb file contains all of the data for the model, so if you copy just the sfb file to a web server, you can then load the renderable via a url:
The download will automatically happen on a background thread. Alternatively, you could write your own mechanism for downloading the .sfb files (zipped together or otherwise) and load them using a file:// URI or from an InputStream. |
Thank you for reply. In sceneform sample app I observed that the model is already configured in gradle file as below - , in this case model is already available, so if I download the new model from server then how will I mention my newly downloaded file in gradle. |
You can use a gradle project (it doesn't need to be the same project as your application) to convert the raw assets (obj + mtl) into an sfb in advance and then store just the sfbs on your web server. The sfbs you download from the web server do not need to be mentioned in your build.gradle. res/raw can only contain resources that are packaged with the apk. When downloading an sfb, you can load the Renderable using a URL directly, save them in device storage and access them using a "file://" URI, or load them from an inputstream directly. |
@dsternfeld7 I have got Unable to load Renderable Unable to load Renderable registryId='file:///storage/emulated/0/Download/lion3.sfb' File is exist. |
If you pass Uri of the .sfb file to setSource() method , it is not working, giving I tried like this and its able to render - getFilePath() method will return path of the .sfb file. |
How to load a model from a file input stream ???? I downloaded the file from server using the download manager and its path is Content://downloads/all_download/190. its the .sfb file. |
@ishaang10 ModelRenderable.builder()
.setSource(context, Callable<InputStream> {
return@Callable FileInputStream(%downloaded_file_absolute_path_string%)
})
.build() Nevertheless I am not sure that a |
In Sceneform sample app we are loading models from model folder, in case I have more then 20 models assume for any shopping app then if I put all those models in asset folder, apk size will increase, so my question is can we load models means 'model related files like obj, mtl, png, sfa, sfb' from server and save to local then go for rendering.
The text was updated successfully, but these errors were encountered: