Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse mesh url to load in threejs editor via search query/urlparam #29246

Open
jo-chemla opened this issue Aug 28, 2024 · 3 comments
Open

Parse mesh url to load in threejs editor via search query/urlparam #29246

jo-chemla opened this issue Aug 28, 2024 · 3 comments
Labels

Comments

@jo-chemla
Copy link
Contributor

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 a threejs_project urlparam. This would probably happen inside the dev/editor/index.html

Alternatives

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 radiantearth/stac-browser#465 for context

@Mugen87 Mugen87 added the Editor label Aug 28, 2024
@jo-chemla
Copy link
Contributor Author

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.

@mrdoob
Copy link
Owner

mrdoob commented Sep 12, 2024

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?

@jo-chemla
Copy link
Contributor Author

jo-chemla commented Sep 12, 2024

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 radiantearth/stac-browser#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants
@mrdoob @Mugen87 @jo-chemla and others