cc-archive / cccatalog-frontend

[PROJECT TRANSFERRED] CC Search is a search tool for CC-licensed and public domain content across the internet.
https://github.com/WordPress/openverse-frontend
MIT License
162 stars 196 forks source link

Sketchfab Proof of Concept #1229

Closed zackkrida closed 3 years ago

zackkrida commented 4 years ago

Fixes

Related to #1045 by @annatuma

Description

Here's a fully-functional sketchfab implementation! A new sketchfab viewer component was created that wraps Sketchfab's existing viewer code, loads their script, and renders the viewer.

Technical details

This is production-ready—the one missing thing is some kind of fallback if Sketchfab fails to load for some reason. Which isn't likely but would still be useful to have.

Screenshots / Demo Links

Checklist

- [x] My pull request has a descriptive title (not a vague title like `Update index.md`). - [x] My pull request targets the *default* branch of the repository (`main` or `master`). - [x] My commit messages follow [best practices][best_practices]. - [x] My code follows the established code style of the repository. - [ ] I added tests for the changes I made (if applicable). - [x] I added or updated documentation (if applicable). - [x] I tried running the project locally and verified that there are no visible errors. [best_practices]:https://gist.github.com/robertpainsi/b632364184e70900af4ab688decf6f53 ## Developer Certificate of Origin
Developer Certificate of Origin ``` Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 1 Letterman Drive Suite D4700 San Francisco, CA, 94129 Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. ```
zackkrida commented 4 years ago

Actually, one more thing that'd be rad—to make the viewer taller on mobile (about 80% of the viewport) instead of the current 16/9 aspect ratio. Gives mobile users more room to scroll.

zackkrida commented 4 years ago

^ This checks out, sketchfab does it this way too:

image

annatuma commented 4 years ago

Exciting progress!

Two questions:

Also, we talked about adding a 3D tab to Search, with (at first) only Sketchfab included, but many similar filters to what we have for images. This makes sense to me, in order to draw more attention to 3D objects in the platform, especially now that the experience of viewing them will be improved. Can you create a ticket (if we don't already have one) to scope that out, and we can plan for it in the next sprint or two?

zackkrida commented 4 years ago

@annatuma I will add the fallback and the aspect ratio fix on this branch directly. When I make a ticket for the 3D tab i'll link it here!

zackkrida commented 4 years ago

@mathemancer this is super useful, thanks. can you elaborate on performance concerns? Is it when the model is loading, when scrolling/interacting with the model, etc? Appreciate it.

mathemancer commented 4 years ago

@mathemancer this is super useful, thanks. can you elaborate on performance concerns? Is it when the model is loading, when scrolling/interacting with the model, etc? Appreciate it.

It seems to be mostly an issue when interacting, and only with some models. For an example of one that is particularly laborious for my machine, see https://sketchfab-poc.vercel.app/photos/72fd92e4-0b60-4484-84aa-4d271b6095f6 .

It takes longer to load than the others, and then actually moving the model around is quite jumpy, with a low framerate. Also, the fan in my laptop sounds like a jet engine. On the other hand, the model at https://sketchfab-poc.vercel.app/photos/309d83e4-a80d-41bc-ba0a-2157e94b2ab6 has none of those problems. I.e., it loads quickly, and manipulating the model goes smoothly.

The problems seem to worsen considerably when using Firefox compared to Qutebrowser (QtWebEngine -- chromiumish).

I first wondered if it's about the size of the model, but the network inspector doesn't show any huge difference there.

zackkrida commented 3 years ago

Added a fallback to the image if sketchfab's script is blocked, unavailable, or fails.