Currently loading the following versions
“@babylonjs/core”: “5.20.0”,
“@babylonjs/gui”: “5.20.0”,
“@babylonjs/loaders”: “5.20.0”,
“@babylonjs/react-native”: “^1.3.2”,
“@babylonjs/react-native-iosandroid-0-69”: “^1.3.5”
I can load my GLTF using `react-native-fs and it works, the file loads and I am able to see it with the exception of the referenced texture images (JPG & PNG)
const file = require(‘…/assets/blend_seperated2.gltf’);
const uri = Image.resolveAssetSource(file).uri;
It’s my understanding that the texture files can’t be loaded this way since React-Native does not serve those files rendered. So after some research i found that the app:/// is supported. However, when I try this the SceneLoader.LoadAsync promise never gets returned it just seems to stall with no error.
When i change the file name to a file that does not exist i do get an error as expected so, I can confirm the loader see’s my file.
I have also tried to load the files through a static server using react-native-static-server but i get the same stalled response nothing loads or errors.
I’m hoping for any guidance on if there is a better way of loading my file with the textures or a way to better diagnose the stalling issue.
The app: scheme is very specific. Depending on the target platform, it will use the standard way of accessing assets (e.g. AssetManager for Android). Unfortunately, this method doesn’t work that well in React Native because it deploys assets differently.
It should never hang though, so that’s a bit weird. Can you put up a repro on GitHub?
@bghgary - Thanks! I was able to figure our the stall… IOS was blocking access. After making some changes to the plist file the GLTF file loads however, the texture files still don’t display. I do see them referenced in the scene data.
Are you trying to load a .gltf with external references to textures? If so, the glTF loader will try to load the files relative to the rootUrl parameter when using SceneLoader. If you can get those assets to load using the full url, it should work with the glTF loader also.
@bghgary - Yes, that’s my goal. Loading a combined .gltf file seems to crash the emulator since our model is very large.
I have a static server running on http://192.168.4.109/ and I can see the reference to the images with the full url in the material data when I log them to the Metro console. The images will also throw an error if they are not accessible so it seems to load them just not display them. My repo is uploading now. I will send a link once it is ready
I had to remove a lot of client material before i could share.
Files located in the www folder get loaded into the static server (setup in app.tsx) which is where I am loading the GLTF. I have tried to load it through an image asset with React Native but, I get the same result of no textures being loaded. Using the App:/// scheme does not work at all for me.
I appreciate any direction you can point me in, hopefully it’s something simple i am over looking.
I don’t see anything specifically wrong. I tried building on Windows for Android, but it gave me a whole bunch of gradle errors about missing plugins and then missing configuration names.