-
-
Notifications
You must be signed in to change notification settings - Fork 422
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
Decouple ThreeJS from MindAR #104
Comments
@Blitzy That's a very good point! but I couldn't figure out a way to decouple it without losing the high level API. The raw tracking part is independent of THREE.js, but people will need to write a lot more code to get a working application. Welcome any suggestions. |
In the simplest form you could just make Three.js an external dependency in the weback configs. https://webpack.js.org/configuration/externals/ This would allow users of MindAR to provide their own copy of Three.js and allow them to use updated versions of Three.js as they release quite frequently. It also allows you to keep doing the Three.js specific things that are being done. However, I would not recommend relying on Three.js at all and simply have some sort of output pipe for the anchor transforms/matrices from MindAR that can be applied directly to whatever objects the devs want to apply it too. This is cleaner and keeps MindAR closer to a dependency-free utility API instead of its own rendering framework. It also lets author's setup Three.js the way they want/need to for their project. Obviously just making Three an external dependency in webpack is the shortest path 😋 |
I run into the same problem, my solution is basic : in your main.js
replace the top part of MindARThree by :
Done. Notice : we load mindar-image.prod and not the mindar-image-three.prod ;) |
In the latest release, I've decoupled the threejs code as much as possible. Now only two files require threejs I also tried to make the dependency |
I also gave a try on externals but it was not working if three wasnt imported at the top script. |
I think the best architecture woud be like threejs "examples" where peoples can go in and take what they want :) |
As a related issue, there is a breaking change in three.js v137 that apply importmap (I personally have never heard of importmap before). In short, all the threejs examples got updated, the Now I couldn't even get v137 to work :( So we probably need to proper solution to handle three.js in the long term. See if anyone has some good advice. |
My solution here work with the latest version of threejs : #104 (comment) Also I think its a bit similar to the solution offer by Jeeliz library and his JeelizThreeHelper. |
@Makio64 Yes, I think your solution could be a good workaround for now for people who wants high level control over threejs, until a better solution come up. |
Hello @hiukim, thanks for your great contribution to the WebAR world!! Would you know how to rotate the camera to see it upside down just like Instagram? |
I have a problem same you |
This question belongs in it own thread. But here is a CSS solution
Apparently, this solution will not work on firefox. |
I would love a way to get the canvas coordinates and pose of the matched image before invoking Three.js. in fact, I have use cases that do not need three.js or any AR. Simply being able to create and track an arbitrary image is important for more than AR. |
Hi @Makio64 do you have a more detailed insight into how you're doing this? The instructions here are a little confusing for me, do you happen to have a live example showing how you've implemented the code in full? |
The Three.js variants of the MindAR library are including Three.js in the bundle. Three.js should instead be left as an external dependency of MindAR. As of writing, MindAR is inextricably tied to a bundle version of Three.js r132.
The text was updated successfully, but these errors were encountered: