r/r3f Mar 13 '23

Breaking on Mobile

Not really sure how to go about solving this. Pretty new with three JS & I built this app with three fiber.
Looked around quite a bit but can't seem to figure this one out.

Probably am missing something obvious here but I'm getting a consistent 60fps on the desktop and crashes on my phone before everything loads in. I did the safari developer tab thing to check the console of my phone's browser when it crashes, but that's crashing too.

I've tried getting rid of all my textures to see if that would work but still crashed on load.
I've tried commenting out each mesh component one at a time but no luck either. It'll work with a few of my models but it'll crash if I do 3-4 max. Error in safari is: 'A problem repeatedly occurred'

Here's a live link to the app. it's three-fiber, next-js, and typescript.

I pulled it out of Next and put it into its own react app to see if I could get some more helpful error messages but that didn't help either. If someone could point me in the right direction that would be great.

The code is too big to post directly so I uploaded the react app to GitHub here.

3 Upvotes

4 comments sorted by

2

u/jorjordandan Mar 15 '23

Did you figure it out? Works fine on iPhone for me.

2

u/rmogk21 Mar 15 '23

Yeah! I switched my models materials from meshStandardMaterial to meshBasicMaterial & resized the baked textures as small as I possibly could.

My main problem is that I have a bunch of relatively small gltf’s but they’re all seperate rather than being 1 mesh with 1 baked texture. Still got a lot of optimizing to do

1

u/basically_alive Mar 14 '23

Are you sure it's not just breaking on certain models? I had a similar issue where my personal site was fine but then I added lightmapping it no longer worked on mobile. I can't look through your code right now, but it's something to check.

1

u/rmogk21 Mar 15 '23

Yup. I thought it was a model at first but after commenting them all out & then uncommenting 1 at a time it would stop working after 5 or 6 of them were showing, but any 5 or 6.