gigascience / gigadb-website

Source code for running GigaDB
http://gigadb.org
GNU General Public License v3.0
9 stars 15 forks source link

3d image viewer #2054

Open only1chunts opened 1 month ago

only1chunts commented 1 month ago

User story

As a website user
I want to be able to interact with 3d images in the GigaDB dataset page So that I can continue to explore the images online

Acceptance criteria

Given I am on a dataset page e.g. https://gigadb.org/dataset/100987 When I click to '3D Models' tab Then I can see the 3D models associated to the dataset AND interact with them using my mouse and clickable buttons

Additional Info

Currently we utilise the online viewer provided by SketchFab, apparently that is going to be phased out and no longer available after 2025, no exact date yet. For current example see dataset 100987

We have the .stl model files in GigaDB anyway, so we should find a way to use those in a 3d viewer instead of relying on an external provider.

Complete list of all GigaDB related models actually hosted to SketchFab (update 7-Nov 2024)

Product Backlog Item Ready Checklist

Product Backlog Item Done Checklist

rija commented 1 month ago

investigate feasibility of adopting webXR (open standards, supported by modern web browsers without plugin) for this work

rija commented 1 month ago

Not for the .STL format, but for glTF/GLB formats: https://modelviewer.dev

rija commented 1 month ago

Or we can write our web STL viewer: https://tonybox.net/posts/simple-stl-viewer/

molcretb commented 2 weeks ago

Edited the 'Additional Info' section with up-to-date list of all GigaDB-related models actually hosted to SketchFab: link

For some of these models, I couldn't make sure that the model file we have in GigaDB (or Zenodo repo) matches the version hosted to SketchFab (either it's a different format, different names or multiple version - like "replicate1.stl, replicate2.stl... but only one model.stl file in SketchFab), so I downloaded the SketchFab model files locally to my PC, waiting to transfert them to a dedicated place in GigaDB (column 'SketchFab local copy to Bastien PC'=yes in associated spreadsheet).

As an alternative to SketchFab, in addition to the previously mentioned tools, there is also ViewerSTL, which can open STL and OBJ files (the main formats we have - few others are PLY or LAS). It looks ok for our needs and there is a JavaScript plugin for it and dedicated GitHub (if it can makes the install to GigaDB easier).

Depending of the chosen widget, we might need to convert the PLY and LAS files (and any other files not handled by the widget), which doesn't seem to be a big deal. Following this conversion, we would need to update the related GigaDB datasets with new files (also apply for the files I downloaded locally).

luistoptal commented 2 weeks ago

@molcretb @rija if I understand correctly up to now all the 3d model assets have been stored in sketchfab, and as we move out of sketchfab, we should probably store the assets somewhere else. I imagine a good candidate is our own server (a S3 bucket), and then rendering the models in the gigadb website directly using a js plugin or library for rendering these types of files

does that sound right?

I think we will need to provide a way for the users to enter these files (the fuw editor fulfills this role, I suppose)

only1chunts commented 2 weeks ago

@luistoptal yes, you have the essence of it. We do infact already host most of the files in our public GigaDB server on Wasabi already, and it is those files that will be rendered in the viewer. @molcretb will be taking care of getting any missing files from Sketchfab into the relevant GigaDB dataset. As for how authors provide them, its no different to any other file we expect the authors to provide so there will be no special treatment required for them beyond what is being developed in the FUW.

rija commented 1 week ago

Hi @luistoptal, as @only1chunts said :-)

For the purpose of this ticket, you can assume that the files are already stored in their final destination and have a public url to address them.

I am not yet sure how to go about integrating a new viewer for those files. May be you can help with a trade-off analysis of the options mentioned in this ticket?

@molcretb, that ViewerSTL project hasn't been updated in 3 years, that's a red flag for code security ;-)

luistoptal commented 1 week ago

@rija I'm writing the PR for this. I opted for implementing a 3D viewer with three.js

I concluded similarly that we should not use libraries that do not seem to be maintained or have very low usage. Three.js is the default way to handle 3D models in JS world and it's build on top of the webGL API. I also prefer to avoid using more abstractions / frameworks than necessary, so three.js seemed like the best option