JeremyHeleine / Photo-Sphere-Viewer

A JavaScript library to display Photo Sphere panoramas.
854 stars 952 forks source link

Unwanted Image distortion #54

Closed paulorenanmelo closed 7 years ago

paulorenanmelo commented 7 years ago

Hi,

I am really looking forward to implementing Photosphere Viewer, you guys are doing a great job in it.

But so far I can't present it with the current level of distortion caused in my renders. I generated spherical images in Maya/Vray (office.jpg).

See what I mean in the screenshot (photosphereViewer.jpg): left side, the preview from the plugin, right side preview on facebook timeline share (see in this link https://www.facebook.com/photo.php?fbid=933390820098961&set=a.109568755814509.11394.100002841548134&type=3&theater) only works on chrome.

Does anyone know how to approach this? I am new to this script, and couldn't find a clue where to try. Photosphere viewer is not as sharp as well, but I'd put it as a secondary issue, first I'd like to see the images without any distortion, or else everyone dealing with spherical renders of archviz won't be able to use your project.

photosphereviewer office

Please share your thoughts on it Thanks!

JeremyHeleine commented 7 years ago

Hi,

I know there are some distortions appearing with some panoramas. They come from the discretization of the sphere on which the panorama is applied. I don't see any way to enhance the result for now (I'll see with my own 3D renderer).

paulorenanmelo commented 7 years ago

Hello, This guys got it right for this case, but they use a different system, cutting the image into segments and mounting into cubemap. Maybe you can get something from their 3D renderer. http://www.marzipano.net/tool/index.html#

paulorenanmelo commented 7 years ago

Got it Jeremy, Line 500 on photo-sphere-min.js you are creating sphere geometry with 32 divisions, which is not enough for many cases. I changed it for 256 and works fine and solves the issues! But to make sure you won't have problems in very slow devices, I'd recommend 128 (most smartphones should be able to run over 100k~200k polygons with no problems, http://polycount.com/discussion/130371/polygon-count-for-smartphone-applications) sphere of 128 divisions = 32512 polygons (tris) sphere of 256 divisions = 130560 polygons (tris) Can't believe I got the code today and managed to solve it. I won't make a pull request for one line of code, but hope my contribution helps ;) Let me know if I can be of any help Cheers!

JeremyHeleine commented 7 years ago

Hi,

It's a solution, I'll make the change in the next few days (and also add a new option to let anyone change the value without searching for the right line). It's still not perfect, as the problem comes from the fact that the subdivision can't be adapted to any panorama. I think there's a way to limit the number of triangles with a better subdivision, adapted to the panorama. However, it won't be available right now (I'm still not sure that it's really possible).

Anyway, thanks for the suggestion!

JeremyHeleine commented 7 years ago

The change has been made in version 2.8. The numbers of rings and segments are now set to 100 by default, and they can be changed with the options segments and rings.