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

Is it possible to use Deep Zoom format with Pannellum? #154

Closed tomas-nz closed 8 years ago

tomas-nz commented 8 years ago

I am currently using Deep Zoom panoramas projected with SaladoPlayer (Flash based). I would love to use Pannellum as a fall-back when Flash is not available in the client browser. I would ideally reuse my existing Deep Zoom files to avoid their duplication. Pannellum's multiRes format seems similar to Deep Zoom but files are organized differently. I have attached examples of the structure for the same original panoramic image. Reading documentation about parameter "path" for multiRes images, I don't see a way to achieve the mapping using only this parameter. Would you consider adding support for Deep Zoom panoramas into Pannellum?

DeepZoom example.txt multiRes example.txt

151026_mt_titiroa_f.xml:

<?xml version="1.0" encoding="utf-8"?>
<Image TileSize="512" Overlap="1" Format="jpg" ServerFormat="Default" xmnls="http://schemas.microsoft.com/deepzoom/2009">
<Size Width="5632" Height="5632" />
</Image>

config.json:

{
    "type": "multires",

    "multiRes": {
        "path": "/%l/%s%y_%x",
        "fallbackPath": "/fallback/%s",
        "extension": "jpg",
        "tileResolution": 512,
        "maxLevel": 5,
        "cubeResolution": 5496
    }
}
mpetroff commented 8 years ago

It's not possible directly, but it probably would be possible using symbolic links on the server side. I'm not all that familiar with the Deep Zoom file format, but it seems the biggest issue is that the zoom levels are numbered differently. If you were to link the directories to match Pannellum's zoom level numbering scheme, you probably could get it to work. I'm not really interested in adding support for specific alternative tiling formats.

tomas-nz commented 8 years ago

Thanks, Matthew! This was a hint in the right direction. I managed to re-map my example panorama and make it work in Pannellum by adding symbolic links for each zoom level directory:

cd panoramas/dz_151026_mt_titiroa
for x in * ; do
  if [ -d "$x" ]; then
    cd $x
    for y in * ; do
      if [ -d "$y" ]; then
        ln -s $y pannellum_$((10#$y - 10#8))
      fi
    done
    cd ..
  fi
done

Then my config changed a bit - using cube size from DeepZoom xml file and different paths. I am not sure if the fallbackPath would work like this but I don't know how to test it:

    "multiRes": {
        "basePath": "/panoramas/dz_151026_mt_titiroa",
        "path": "/151026_mt_titiroa_%s/pannellum_%l/%x_%y",
        "fallbackPath": "/151026_mt_titiroa_%s/pannellum_1/0_0",
        "extension": "jpg",
        "tileResolution": 512,
        "maxLevel": 5,
        "cubeResolution": 5632
    }
mpetroff commented 8 years ago

The fallback isn't going to work well since it needs a single, higher resolution image for each cube face. If you want to test it, you need to temporarily disable WebGL in your browser (set webgl.disabled to true in Firefox's about:config; Chrome used to have a option in chrome://flags but it doesn't seem to be there anymore).

tomas-nz commented 8 years ago

When I tried to disable WebGL I got following error message instead of fallback images in Firefox 46.0, Mint 17.3 (I copied in fallback folder from multiRes version and fixed the fallbackPath before testing): no_webgl

mpetroff commented 8 years ago

I forgot that Firefox doesn't render the CSS 3D transforms properly, so the fallback renderer is disabled for it. Since Google seems to have removed the flag to disable WebGL, you have to disable it by launching the browser from the terminal, e.g. chromium-browser --disable-webgl or google-chrome --disable-webgl.

tomas-nz commented 8 years ago

Thanks a lot! I managed to put it all together:

My first panorama that has it all implemented is here: https://tomassobekphotography.co.nz/pano36.php

tomas-nz commented 8 years ago

I was celebrating too soon. I noticed that on the most detailed zoom level there was a subtle inconsistency in one part of the panorama. I guess the slightly different cube sizes add up somewhere (even though the original image and tile sizes are identical). So I just have to include the whole multiRes tree.

Thanks anyway for a brilliant piece of software!

kaefert commented 5 years ago

Hello @tomas-nz ! I did for one of my panoramas the same as described here: Link separate renumbered level directories from my SaladoPlayer format for each wall to use in a Panellum config.json.

I did not find any inconsistencies but before I implement the same way for many panoramas I wanted to ask you to please describe the problems you found that made you decide to include a whole separate multiRes tree for Panellum.

tomas-nz commented 5 years ago

Hi @kaefert , I cannot say I remember exactly. I think there were slight misalignments between tiles on the most detailed level. But I don't use SaladoPlayer any more, since I found a way to include background music in Panellum. Just in case it interests you, here is more info - https://tomassobekphotography.co.nz/articles/how-to-create-spherical-panoramas.php#website

kaefert commented 5 years ago

Ah maybe you where using the SaladoConverter which if I remember correctly had a default overlap of 1 pixel which Panellum doesn't have. I generate my tiles myself (with imagemagicks) since none of the pananorama specific tools I tried yet worked well for huge panoramas.

Ah yes I can see in your SaladoPlayer config the Overlap="1" parameter.

ps.: Beautiful work you're doing there :) My panoramas are less artistic pleasing for the eye but simply serve the purpose of seeing distant objects on the horizon for judging the feasibility of establishing radio links.

See http://www.panoramen.wien.funkfeuer.at/panellum.htm#config=panoramen/aktive-knoten/obdo9_2019-04-17_248k/panellum.json for example

kaefert commented 5 years ago

So I found some of my older lower resolution panoramas have the default SaladoConverter generated tile overlap too...

I'm gonna try and experiment with specifying a smaller tile size in the panellum config json to maybe correct for the misallignment. If the artifacts are too bad I'll have to regenerate the tiles of those panoramas without overlap..

indus commented 3 years ago

997 would allow the use of the deep zoom format (and others). Path would look like:

"path": "/%l0/%s%y_%x",
kaefert commented 3 years ago

My Salado Layers are numbered different somehow. They start around 9 or 10 with the lowest resolution and go up to something around 16 for the highest resolution.

To workaround this issue in 2019 I've written a script that creates softlinks from the lowest level to "panellum_1" and incrementing the number for each following level.