Parse mesh url from url-param search query to load https://f3d.app/web?mesh={mesh_url}
Is your feature request related to a problem? Please describe. Long-time f3d user, however I just discovered the https://f3d.app/web WASM build which does look great so thanks a lot! It would be great if one could pass to the viewer a url-param which indicates a mesh file to load.
Describe the solution you'd like f3d could parse mesh url given search query like the following: https://f3d.app/web?mesh={mesh_url} Regarding at how the webassembly/app.html loads supported meshes on file select, it seem that this could be hacked to initially load a model if the urlparam search query is detected.
Some os urlparams seem to be parsed here, but only to know which os to look for the wasm build.
Describe alternatives you've considered 3dviewer.net does it this way - although a weird hash # replaces the question-mark in the search-query: https://3dviewer.net/#model=${mesh_url}.
Additional context This would make it easier to inspect mesh files lying accessible on the web via a server endpoint using f3d. My interest is integrating f3d 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 here for context
Contribution Would love to contribute, although I don't know mulch about the f3d codebase. Would need some pointers, the implementation probably has to happen in the app.html file, but building/bundling the wasm seem hard once implementation is finished.
This would be a nice improvement indeed!
although a weird hash # replaces the question-mark in the search-query: 3dviewer.net#model=${mesh_url}.
Doing it with a hash seems better in this case actually. If there was anything to do server side we'd need to pass the parameters in the ? part of the URL, but in this case everything is local so we can use the # part that doesn't get send to the server and can be reacted to without reloading the page.
Basically, after the page is loaded and the viewer is set up, the script would look after the # for a model url and download it (locally on the client). Then if you changed the page url from f3d.app/web/#foo.glb to f3d.app/web/#bar.glb the script would be able to detect it and just download the new model without the whole page being refreshed.
Would love to contribute, although I don't know mulch about the f3d codebase. Would need some pointers, the implementation probably has to happen in the app.html file, but building/bundling the wasm seem hard once implementation is finished.
I believe @Meakk recently improved the build/packaging of the wasm version so he may be able to get you started. You may even be able to get away with editing app.html and serving it along the prebuild version of the wasm package win any local http server.
Some os urlparams seem to be parsed here, but only to know which os to look for the wasm build.
This code is only used to recommend the correct download on the Website, it's unrelated to F3D web.
Regarding at how the webassembly/app.html loads supported meshes on file select, it seem that this could be hacked to initially load a model if the urlparam search query is detected.
Sounds like a good idea. You have to download the file to a Uint8Array and write it to the internal filesystem like it's done here
I don't know the implementation details (maybe this page could help?), it's more about web development knowledge than F3D codebase knowledge at this point (and nobody is a web developer in regular contributors as far as I know)
If you want to give it a try, you can build and test F3D WASM very easily by following the guide (Linux, Docker and npm required)
Thanks both for the helpers. I just implemented the suggested changes that I think should allow parsing of a mesh urlparam, but I could not test it on my setup (docker and npm are installed, but I have a windows machine, also tried with WSL and git-bash with no luck).
Here are the suggested changes
https://github.com/f3d-app/f3d/compare/master...jo-chemla:f3d:master
Should I make a PR to include them? Thanks!
Should I make a PR to include them? Thanks!
Yes please :) I'll try it locally and let you know if it works.
For those stumbling here, implementation is done and PR awaiting merge here! https://github.com/f3d-app/f3d/pull/1596 Thanks you all for the feedback during implementation!
PR just got merged and is live, thanks to everyone for the feedback! 🚀
https://f3d.app/web/#model=${modelUrl}
more resilient at parsing mesh extension than 3dviewer.net (via either url extension, response contentDisposition header or user-provided extension)!
Hey @jo-chemla , We have been discussing on discord possible improvements, but it looks like you did not finish onboarding there so I cant add you to that discussion, do you wanna try communicate there ?
https://discord.f3d.app
Hi @mwestphal, I'll try to have a look but I avoid my discord which is pretty overloaded. If you want to summarize the discussion in this thread for possible improvements, please don't hesitate!
Just accepted your request though!
If you want to summarize the discussion in this thread for possible improvements, please don't hesitate!
Definitely, discord is not great for feature discussion.
Created a new thread to track these improvements https://github.com/f3d-app/f3d/issues/1604