multires and multiple 404
Hello,
This library looks really well and I really do appreciate the job you did.
I have a question regarding multires. I have generated the tiles. All of them generated fine. The filenames were generated , using f, l and r letters.
When I uploaded the files to my website I can see a lot of requests for files starting with u and d, all of them ending in 404.
The image is a partial panorama and I specified haov and vaov when running generate.py.
Do you have any ideas why would this happen? Can it be something that I misconfigured? The panorama loads well, but all those 404 increase the loading time a lot.
I understand that each face of the cube is coded using f, r, l etc. If I have a partial panorama, limited also on vertical, is it possible to disable the requests for d and u?
Thank you for your support.
This is to be expected. Pannellum's current multiresolution format has no concept of partial panoramas, but the viewer ignores 404 errors, and the generate.py script doesn't write tiles to disk when the entire tile matches the background color, as is the case for partial panoramas. If you want to avoid 404 errors, you can replace line 202 of the generate.py script:
https://github.com/mpetroff/pannellum/blob/4382de1604c2121985ea99bfdc789407bf7735f9/utils/multires/generate.py#L202
with if True: to force the creation of all tiles. This is something I want to resolve with a future replacement of Pannellum's multiresolution format.
This patch does not seem have effect any more, at least for the case of partial panorama generated with --haov 170 --vaov 60 params, lots of 404 for missing tiles.
The previous patch didn't work if entire cubemap faces were missing. The following should:
diff --git a/utils/multires/generate.py b/utils/multires/generate.py
index 4788de9..587513d 100755
--- a/utils/multires/generate.py
+++ b/utils/multires/generate.py
@@ -248,6 +248,9 @@ for f in range(0, 6):
faceExists = os.path.exists(os.path.join(args.output, faces[f]))
if faceExists:
face = Image.open(os.path.join(args.output, faces[f]))
+ else:
+ face = Image.fromarray(np.array([[[0, 0, 0, 0]]], dtype=np.uint8))
+ if True:
for level in range(levels, 0, -1):
if not os.path.exists(os.path.join(args.output, str(level))):
os.makedirs(os.path.join(args.output, str(level)))
@@ -265,7 +268,7 @@ for f in range(0, 6):
print('level: '+ str(level) + ' tiles: '+ str(tiles) + ' tileSize: ' + str(tileSize) + ' size: '+ str(size))
print('left: '+ str(left) + ' upper: '+ str(upper) + ' right: '+ str(right) + ' lower: '+ str(lower))
colors = tile.getcolors(1)
- if not partialPano or colors == None or colors[0][1] != colorTuple:
+ if True:
# More than just one color (the background), i.e., non-empty tile
if tile.mode in ('RGBA', 'LA'):
background = Image.new(tile.mode[:-1], tile.size, colorTuple)
Thanks @mpetroff, it works. Should that really be a common behaviour for partial panorama perhaps (to create all missing tiles to avoid errors)?
There's a tradeoff between having extra files on disk and having 404 errors. Years ago I decided that it was better to have the 404 errors, since they all they do is pollute the logs, while extra files on disk take up (a small amount of) space and make uploading the files to a server take longer by having more files. One could certainly argue that this is the wrong side of the tradeoff, and I can probably be convinced that it would be better to generate the blank tiles.