viro
viro copied to clipboard
Unable to load .obj file with .mtl
Requirements:
Please go through this checklist before opening a new issue
- [x] Review the documentation
- [x] Search for existing issues in: viromedia/viro & ViroCommunity/viro
- [x] Use the latest ViroReact release
Environment
Please provide the following information about your environment:
- Development OS: Mac
- Device OS & Version: iOS version 14.7.1
- Version: ViroReact version 2.20.2 and React Native version 0.65.1
- Device(s): iPhone 7
Description
Using a fresh clone of the starter-kit
repo to try to render my 3D object but all I'm seeing is the "Hello World". I have tried adding ViroAmbientLight
as per docs and I'm using the resources
prop to require all my files.
This is my code:
<ViroARScene onTrackingUpdated={onInitialized}>
<ViroAmbientLight color="#ffffff" />
<ViroText
text={text}
scale={[0.5, 0.5, 0.5]}
position={[0, 0, -1]}
style={styles.helloWorldTextStyle}
/>
<Viro3DObject
scale={[0.1, 0.1, 0.1]}
position={[0, -0.5, -1]}
source={require('./res/car/prius.obj')}
resources={[
require('./res/car/prius.mtl'),
require('./res/car/Prius_Color.png'),
require('./res/car/Prius_Normal.png'),
require('./res/car/Prius_Rough.png'),
require('./res/car/Tire_Normal.png'),
require('./res/car/Tire_Rough.png'),
require('./res/car/Plate.png'),
]}
type="OBJ"
/>
<ViroAmbientLight />
</ViroARScene>
Anyone know what's wrong and/or how to fix this issue?
@potatoengineer: Any updates? I have the same problem :(
@saeedtkh or @potatoengineer I was able to reproduce what you are seeing. I've created a repo in my diagnosing app found here
The Statue of Liberty shows the issue in this image. It seems to be missing the textures
I've got a hunch as to why this isn't working.
In my starter kit, I have a LibertyStatue.obj file. There is a material referenced in this file:

I think that the material is being resolved to my local computer with whatever is resolving the material (something in virocore) and not the asset LibertyStatue_TEST.mtl. This would mean when I run on my device, the .obj parser which resolves mtl files is trying to find a file at the wrong location
I've not included this resource in my 'resources' array, and changing the string in the obj file causes a different error.
Resource mtl not used:
error with original file name:
change in .obj file
error with new file name:
I'm Also Still Facing the issue to Load .obj File in React Native Project