mpetroff / pannellum

Pannellum is a lightweight, free, and open source panorama viewer for the web.
https://pannellum.org/
MIT License
4.26k stars 722 forks source link

CubeMap Tour and iOS Safari Browser Crash #854

Open DStillingfleet opened 4 years ago

DStillingfleet commented 4 years ago

Hi Matthew

Hope you are well.

I know you have to rely on simulation software to test iOS features, but I wanted to run something past you, or maybe another Pannellum user has any answers.

There's a lot of background info here to share before the questions will make any sense.

I'm running with iOS is 13.3 on an iPhone 6S. Pannellum is 2.5.6.

I have created a 33 location virtual tour which can be "walked" in either direction, the starts are hosted at https://www.virtualmountains.co.uk/BlackMountains/TourControlV40-101.html and https://www.virtualmountains.co.uk/BlackMountains/TourControlV40-133.html.

Scenes are added dynamically, the next location's scenes added and loaded before moving, and then the javascript removes the previous location's scenes from Pannellum.

The tour has a 3D VR mode in which I have used 1024 px x 1024 px cube maps, 48 cube maps in total per location as each location uses 8 pannellum viewers. Whilst only 2 pannellum viewers are visible at one time, the 3D requires switching between 4 pannellum viewers depending on the angle of view, and I double this by having two pairs; one to zoom during location transitions, and the other to load the next location's scenes.

All this works pretty well until the 19th location is reached, which ever starting point you chose. At this point the safari browser white screens and makes a vain attempt to reload.

I think I previously read that Pannellum uses cube maps direct on html5 canvases rather than webgl, is this correct? If so, is this a separate canvas per cube map?

I did some testing on my iPhone to generate as many 1024 px x 1024 px canvases (with photos in them) as possible. It reached 64 such canvas before stopping. So producing 48 canvas for each cube map at a location should not be a problem. But may be I'm not removing the old scene quick enough and there is occasionally more than 64 canvases. If so, why might this only happen on the 19th location of the tour?

Pannellum has an on "load" event, upon which I remove the old scene. May be an on "remove" event could be used to confirm that the scene (and canvas if one or more has been in use) has been removed. Would that be difficult?

No such problems on a LG V20 running Android 8.0. Which indecently could load 144 of the 1024 px x 1024 px canvas before dropping all the canvas's content.

Any thoughts as two how to get around this, I'll be happy to hear them.

Best wishes

Derek

mpetroff commented 4 years ago

Pannellum uses WebGL for cube maps, except when WebGL isn't supported, where it uses a fallback renderer that uses CSS 3D transforms. Only a single <canvas> is used (except for when the fallback viewer is used or when an equirectangular images is too big an needs to be split into two different textures). The number of scenes does not affect this. Except for the currently displayed scene, nothing is stored except for the scene configuration itself, so adding additional scenes has very little effect on memory usage.

Based on your description of the issue, it sounds like Safari is running out of memory. However, I tested your page in Chrome on both Linux and Android, and I can't find any obvious memory leaks. It's possible that there's a memory leak in Safari, but I find this somewhat unlikely. You might be able to check this by profiling memory usage with Safari's remote debugging developer tools on a Mac.

DStillingfleet commented 4 years ago

Hi Matthew

Thanks for the quick reply and useful information.

Alas I don't have access to a Mac so that I can use the remote debugging tools.

But you are probably right about Safari running out of memory.

I'm using the generate.py script to create the cube maps (from a DOS batch file) and changed the output quality from 90 to 75, and the reduction in files size for all the cube maps (I'm only using the cube maps in the fallback directory) meant that I can move a few locations further in the tour, although how much further is inconstant.

Guess I'll have to track down a Mac somehow to really get this resolved.

Best wishes

Derek

On 18 April 2020 at 01:20 Matthew Petroff notifications@github.com wrote:

Pannellum uses WebGL for cube maps, except when WebGL isn't supported, where it uses a fallback renderer that uses CSS 3D transforms. Only a single <canvas> is used (except for when the fallback viewer is used or when an equirectangular images is too big an needs to be split into two different textures). The number of scenes does not affect this. Except for the currently displayed scene, nothing is stored except for the scene configuration itself, so adding additional scenes has very little effect on memory usage.

Based on your description of the issue, it sounds like Safari is running out of memory. However, I tested your page in Chrome on both Linux and Android, and I can't find any obvious memory leaks. It's possible that there's a memory leak in Safari, but I find this somewhat unlikely. You might be able to check this by profiling memory usage with Safari's remote debugging developer tools on a Mac.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/mpetroff/pannellum/issues/854#issuecomment-615519653 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AC47ZDG3POVS2ZP273AHECTRNDW5TANCNFSM4MK2GKZA .
mpetroff commented 4 years ago

There's a tool that's supposed to allow use of Chrome or Firefox for remote debugging of iOS Safari: https://github.com/RemoteDebug/remotedebug-ios-webkit-adapter

I've never used it, so I don't know how well it works.

DStillingfleet commented 4 years ago

I’ll take a look.

Thank you Matthew.

On 19 Apr 2020, at 21:52, Matthew Petroff notifications@github.com wrote:

 There's a tool that's supposed to allow use of Chrome or Firefox for remote debugging of iOS Safari: https://github.com/RemoteDebug/remotedebug-ios-webkit-adapter

I've never used it, so I don't know how well it works.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

DStillingfleet commented 4 years ago

Hi Matthew

Thanks for pointing me in the direction of https://github.com/RemoteDebug/remotedebug-ios-webkit-adapter.

I’ve setting it up and running, lots of steps initially, but simple enough. But am not seeing any errors, but then I don’t see my console.logs either. So I’ll work with the developers and see what help they can give. I’ll let you know what I find.

Best wishes

Derek

From: Matthew Petroff [mailto:notifications@github.com] Sent: 19 April 2020 21:53 To: mpetroff/pannellum pannellum@noreply.github.com Cc: Derek Stillingfleet Derek@VirtualMountains.co.uk; Author author@noreply.github.com Subject: Re: [mpetroff/pannellum] CubeMap Tour and iOS Safari Browser Crash (#854)

There's a tool that's supposed to allow use of Chrome or Firefox for remote debugging of iOS Safari: https://github.com/RemoteDebug/remotedebug-ios-webkit-adapter

I've never used it, so I don't know how well it works.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mpetroff/pannellum/issues/854#issuecomment-616223371 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AC47ZDCOP2YPZ7H5WV2CIE3RNNQBZANCNFSM4MK2GKZA . https://github.com/notifications/beacon/AC47ZDEPPXE2DUEUCCO4TX3RNNQBZA5CNFSM4MK2GKZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOES5NFCY.gif

DStillingfleet commented 4 years ago

Just to tie up some loose ends on this one (or not), this problem may be the same as recently reported in issue 907.

I managed to get the remote debugging tool for iOS working (there was some missing code). But no errors at all are reported when safari for iOS crashes and reloads the web page. So I'm still scratching around for a solution.

Using cube maps seems to allow more scene changes than equirectangular panoramas before the browser crashes.

I'm now trying to experiment with multi resolution panoramas. I have a separate question about these which I'll create an issue for.