Comments (5)
Hi,
Sorry for taking a little longer as planned, providing the URI as mentioned by @mariansam makes me progress with the issue a little bit more. So what I did is constructed the file URI so that it it looks something along these lines:
{uri:
file://${RNFS.DocumentDirectoryPath}/AR/oobject_bpanther_anim.vrx}
Using obj files now loads the model successfully I don't even need to provide the mtl
file and pngs / jpgs
in the resources array although the docs mentioned this as a step.
And after a few hours of debugging why my VRX weren't display properly I discovered that it was actually loading using this method I updated the scale and it was also displaying my VRX model properly. So thanks for helping me figuring this and I'll close this up now
from viro.
Hi @mikeslinkman thanks for engaging!
I see in your example there are a bunch of PNGs also being accessed from the local file system, also presumably after having been downloaded. Were there any issues with those, or is it just the VRX that causes the problem?
from viro.
Hi, I think this might be a really similar issue to #3, here's my response to that one:
Hi @mikeslinkman, we already had a similar issue on the ViroCommunity Discord server. Your problem might be a missing protocol in the
uri
. Try addingfile://
before every file path you want to load. Eg.{uri: `file://${RNFS.DocumentDirectoryPath}/AR/object_mtl.mtl\`},But I'm not 100% sure with about this, try it out and let us know.
from viro.
Hi,
Thanks for getting back to me, first in response to @bilewinters because this might be due to a misconception on my end. As I've read through the docs (and I'm aware they are outdated, but I guess they give some sort of implementation idea) for the model to load properly I should also put additional files referenced by the model in the resources array. However this is something I read regarding OBJ files so it might be that this is not required for VRX files.
For now I've chosen to use a model provided in the samples from original Viro team. I've downloaded them in a zip without errors and afterwards I tried packaging them with the project and at that point the model was showing properly.
This leads me to believe that @mariansam is up to something with the solution provided. I'll try this out later today and will update if this fixed the issue
from viro.
- Review the documentation: https://docs.viromedia.com/
- Search for existing issues: https://github.com/viromedia/viro
- Use the latest ViroReact release: https://docs.viromedia.com/docs/releases
Environment
Please provide the following information about your environment:
- Development OS: Mac
- Device OS & Version: Android 10 iOS version 14.2
- Version: Community Version RN 0.63.3
- Device(s): Oneplus 6 iPhone 11 and more
Description
Currently I'm trying to display a VRX file that I have downloaded from my API. We do not want to include the AR models within our project since AR is not the core part of our application and a decent portion of our user base might not even touch that part. I Expect that our database of AR objects will increase over time and we do not want to bother users with AR objects they will never use.
So I understand the downloading part is not part of this library and I believe this is not where the issue is originating from. This is verified by temporarily bundling the downloaded VRX model. Then it will load and display the model as expected. But when loading it from internal storage the error callback
console.log(event.nativeEvent.error);
simply informs meModel loading failed
without any additional information.Reproducible Demo
Below is all code specific to our Viro implementation. For testing purposes I've used the black panther model for the sample since this ensures I'm using a valid model
const ARNavigator = ({navigation, route}) => { const HelloWorldSceneAR = () => { const onInitialized = (state, reason) => { console.log('state: ', state, 'reason: ', reason); } const _onError = (event) => { console.log("OBJ loading failed with error: " + event.nativeEvent.error); } const _onModelLoad = (event) => { console.log("Model loaded: " + event.nativeEvent); } return ( <ViroARScene onTrackingUpdate={onInitialized}> <ViroAmbientLight color="#FFF" /> <Viro3DObject type="VRX" onError={_onError} scale={[.9,.9,.9]} rotation={[0, 0, 0]} position={[-0.1, -1.5, -2]} onLoadEnd={_onModelLoad} resources={[ {uri: `${RNFS.DocumentDirectoryPath}/AR/object_bpanther_Base_Color.png`}, {uri: `${RNFS.DocumentDirectoryPath}/AR/object_bpanther_Metallic.png`}, {uri: `${RNFS.DocumentDirectoryPath}/AR/object_bpanther_Mixed_AO.png`}, {uri: `${RNFS.DocumentDirectoryPath}/AR/object_bpanther_Normal_OpenGL.png`}, {uri: `${RNFS.DocumentDirectoryPath}/AR/object_bpanther_Roughness.png`} ]} source={{uri: `${RNFS.DocumentDirectoryPath}/AR/oobject_bpanther_anim.vrx`}} /> </ViroARScene> ) } return ( <ViroARSceneNavigator autofocus={true} initialScene={{ scene: HelloWorldSceneAR }} style={{flex: 1}} /> ) }
I'll keep a lookout on the issue and if I come across additional information ill update the post. If any addiotional information is required I'll try to update it as quickly as possible
source={{
uri: https://xxx/icecreamman_anim/icecreamman_anim_pbr.vrx
,
headers: {
'content-type': 'application/octet-stream',
},
}}
do not forgot to put content-type in headers
from viro.
Related Issues (20)
- Touch an element with viro react HOT 2
- build issue iOS, libViroReact.a[arm64][2](VRTPortalScene.o)) HOT 2
- Expo plugin is not working with monorepo HOT 1
- onTouch event is not working HOT 2
- TypeError: Cannot read property 'setJSMaterials' of null on Android using Expo HOT 5
- cant use startVideoRecording on Android 13 HOT 2
- Video doesn't stop on most of iPhone/iOS versions when AR scene is unmounted causing memory leaks HOT 1
- ViroVideo and ViroSound not working HOT 4
- how create a text input field inside viroVRSceneNavigator HOT 1
- viro react FrescoBackgroundExecutor-1 error on android for 360 image HOT 2
- Crash on Android due to fresco class not found HOT 7
- Android: crash when adding a camera to a 3D scene HOT 4
- How to blend color and texture for ViroMaterial? HOT 1
- Expo app crashes / shuts down when opening a ViroARScene with Viro3DObject (Expo SDK 51) HOT 9
- How to extract video stream?
- on iOS viroImage onClick don't use the viroscene top position but always the top of the screen.
- Support for Meta Quest 3
- Error while updating property 'height' in shadow node of type: VRTVideoSurface
- cant use startVideoRecording on Android 13 HOT 3
- Crash when using ViroARPlaneSelector in Android
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from viro.