playcanvas / model-viewer

3D model viewer supporting glTF 2.0 and PLY (3d Gaussian Splats)
https://playcanvas.com/viewer
MIT License
421 stars 61 forks source link

glTF Viewer Shows Different Size Than In Editor #133

Open rpaladin opened 2 years ago

rpaladin commented 2 years ago

Original Post https://forum.playcanvas.com/t/solved-imported-glb-keeps-disappearing/22796/1

Imported binary GLB with morph targets (and embedded textures) displays different sizes in the PlayCanvas glTF 2.0 Viewer than in the PlayCanvas Web Editor.

Model Source:

https://github.com/RandomPandaStudios/hosting/blob/main/AC_PlayerModel_Red.glb

glTF Model Preview:

https://playcanvas.com/viewer/?load=https://raw.githubusercontent.com/RandomPandaStudios/hosting/main/AC_PlayerModel_Red.glb

willeastcott commented 1 year ago

@rpaladin I was just reviewing this old issue. The model viewer has gone through many updates since this was logged. The GLB looks like it's correctly rendered in the viewer now. Can you confirm? If all is well, we can close the issue.

rpaladin commented 1 year ago

Hi @willeastcott. I just checked. I'm not sure if the PlayCanvas Viewer issue still exists.. It appears that if the window is resized + maximized on start (instead of starting in maximized window mode initially), the window aspect ratio / resolution isn't updated to reflect the new window mode + size. I'm not sure if this was perhaps what I was experiencing originally.

Chrome

Start Window Maximized:

image

Start Window Un-maximized + small size: -> Set maximized

image

Edge

Start Window Maximized:

image

Start Window Un-maximized + small size: -> Set maximized

image

Firefox

Start Window Maximized:

image

Start Window Un-maximized + small size: -> Set maximized

image

willeastcott commented 1 year ago

I don't seem to be able to reproduce this. I just tried in Chrome and Edge. Here's what I saw in Edge, for example:

https://github.com/playcanvas/model-viewer/assets/697563/fcde032c-9fba-446d-a9b7-df121bfd04cb

rpaladin commented 1 year ago

I think you're not able to reproduce it because your browser window is already in maximized mode. I can consistently reproduce the issue when I:

  1. Start the window unmaximized.
  2. On (or after) viewer load, maximize the window.
  3. The ratio/size of the window should not update for the newly maximized window.
marklundin commented 1 year ago

Ok I can kind of replicate this. If you start with a small window with narrow/tall aspect ratio then maximise to a wide aspect ratio, the content zooms out. I think this is because the FOV adapts or does not change correctly with the window size