Open jo-chemla opened 2 months ago
In case it is useful, here is a merged f3d PR I did to support search-query url-params for models and extension. Example url: https://f3d.app/web/#model=https%3A%2F%2Fgroups.csail.mit.edu%2Fgraphics%2Fclasses%2F6.837%2FF03%2Fmodels%2Fteapot.obj
Not entirely sure if this would make sense for the threejs editor to parse only mesh urls vs full threejs projects jsons. Another still-open Potree PR I did parses either datasetUrls
JSON parseable array (so equivalent to the f3d case), or a potree project from url
or potree project from encoded json
, where the project js object encodes dataset urls, their materials, viewer settings etc, so probably akin to a threejs project object.
Note for the f3d case parsing mesh urls, a prerequisite was to detect mesh extension to select the adequate loader. The selected flow to detect mesh type was: if extension is provided by the user as url-param, enforce it in the loader, otherwise, get mesh-type from Response Header Content-Disposition
if available, otherwise from parsing url filename.extension
.
It would be useful for the threejs editor to support importing mesh files on load, by parsing a search-query or urlparam.
Can you elaborate that? Why would it be useful? What use cases world it enable?
Thanks for getting back. The use-case is similar to what I've implemented for f3d or potree, allowing users to share mesh datasets (or potree tilesets) or threejs projects via a single url that opens a 3d viewer with the provided data for the users to explore it. Like a threejs-editor based version of model-viewer which imports a scene provided by url rather than having the user load the threejs-editor and load the project via file.
The context around this is we (iconem) use OGC (Open Geospatial Consortium) standards like STAC (Spatio Temporal Asset Catalogs) to share 3d-scans and by-products we produce (monuments, cities, archaeological sites etc) within the archaeologists/architects/GIS & CAD communities. We are trying to extend the STAC specification to support 3d - both standard static textured meshes and OGC 3d-tiles, which is eg the format of Google 3D Cities uses - and some tooling of the ecosystem to easen the query and visualization of geospatial assets. That STAC-browser PR https://github.com/radiantearth/stac-browser/pull/465 implements direct link for any 3d mesh asset of the catalog that opens-up a 3d-viewer, which references the mesh to open via a url-param.
Description
It would be useful for the threejs editor to support importing mesh files on load, by parsing a search-query or urlparam. The simplest solution would simply to load a single mesh file, but this could be extended to loading an arbitrary threejs project, or collection of meshes files via their urls.
Solution
The mesh urls could be parsed via a
meshes
array search query like https://threejs.org/editor?meshes=[{mesh_url}]. The threejs project could be parsed via athreejs_project
urlparam. This would probably happen inside the dev/editor/index.htmlAlternatives
Equivalent feature requested on f3d web viewer. 3dviewer.net does it this way https://3dviewer.net/#model=${mesh_url}, but this does not work with every mesh url.
Additional context
This would make it easier to inspect mesh files lying accessible on the web via a server endpoint using the threejs editor. My interest is integrating a mesh viewer within STAC-browser (Spartio-Temporal Asset Catalogs) which is made to explore and standardize geospatial assets, among which meshes are an important part - see PR https://github.com/radiantearth/stac-browser/pull/465 for context