-
Notifications
You must be signed in to change notification settings - Fork 49
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
Fix ArrayBuffer in handle_special_geometry and loading some DAE files #170
base: master
Are you sure you want to change the base?
Fix ArrayBuffer in handle_special_geometry and loading some DAE files #170
Conversation
Thanks for this! I will take a look at the logic changes & test it later today or tomorrow. One surface things I noticed on a quick skim, though -- some of the new code here uses abbreviations like |
Please also have a look at #138 and see if/how it relates. |
I filed #172 to fix the msgpack stuff. I think the best plan is to land that first, and then return here to revisit the question of geometry merging. |
Sounds good to me, I'll keep an eye out. Thanks! |
Okay, #172 is merged. I'll wait for a new push here before I test & review the changes. |
a484144
to
7ad6e99
Compare
I just rebased my changes. Only thing left is the geometry merging. |
If I'm reading the code correctly, the only remaining bug is with DAE file textures, nothing to do with STL files -- is that right? There are a lot of return-value respelling changes here, but the only place I see a functional change is in DAE loading. I'm going to try to put together a test case that just uses meshcat, without pinocchio & etc. Something like loading one of the UR5 DAE files, but using the standalone-file mechanism of https://github.com/meshcat-dev/meshcat/blob/master/test/meshfile_object_dae.html. So far, in some less-than-rigorous testing, I suspect I'm going to say the same thing here that I did in #139:
I did a quick prototype of that approach, and it successfully loaded some sample DAE files (from the threejs test corpus). It's only like 5 lines of code, something alone the lines of: --- a/src/index.js
+++ b/src/index.js
@@ -1350,6 +1350,19 @@ class Viewer {
configure_obj(scene);
}
});
+ } else if (object_json.object.type == "_meshfile_object" && object_json.object.format == "dae") {
+ let manager = new THREE.LoadingManager();
+ if (object_json.object.resources !== undefined) {
+ manager.setURLModifier(url => {
+ if (object_json.object.resources[url] !== undefined) {
+ return json.resources[url];
+ }
+ return url;
+ });
+ }
+ let loader = new ColladaLoader(manager);
+ let dae = loader.parse(object_json.object.data, "");
+ configure_obj(dae.scene);
} else {
let loader = new ExtensibleObjectLoader();
loader.onTextureLoad = () => { this.set_dirty(); } |
Could you test if #174 solves your problem? |
You're right about the remaining changes, it does something with DAE files. #172 did fix STL and Solo-12. For #174 I'm getting this on the UR5: The mesh looks good I think, except for the pose |
7ad6e99
to
edef6c5
Compare
Hi @jwnimmer-tri, any news on this PR or #174 ? At this point I think we could go for #174 (after figuring out the pose issue) plus my fix for the handling of multiple materials |
The #174 will be the right approach, so that's the one I'd like to aim for. Either way, we need a test case that fails before the fix, and passes afterwards. (Something in the |
No problem, I can help out. What would you require from the test, just being able to load a file successfully? |
The tests are basically in the style of "open it up in a browser and see if the shape looks okay". If there's something special the human needs to look for in the scene, we can have a comment about that inside the file. Something like "you should see three different colors" or whatever. We already have The very most important thing is that the test fails with the (If you like, free to copy the code from #174 into here if that's easier for you to push here.) |
edef6c5
to
5478614
Compare
Hi @jwnimmer-tri, I've added a complex Collada test file in #181. It looks good on the current master/HEAD here. Edit Nevermind, I found a broken Collada file. I'm gonna update the PR #181 accordingly. |
1d9aed3
to
66490d9
Compare
If you haven't seen it yet, please read over these links, and check if the #181 test is hitting this particular console warning:
Perhaps #174 was losing the My general preference remains to try to use three.js (and the meshcat protocol) as intended by their authors, along the lines of #174 -- with |
80bcffd
to
f1b3c78
Compare
I am indeed getting the warning about the Z-UP axis in the console when using #174. The orientation of the meshes is consistent with an error between Y and Z up coordinates I think. I can't figure out how to fix this though. I've tried applying the
I completely understand. Better to do things "correctly". |
index.js: change return signature of merge_geometries + adapt handle_special_geometry + fix handling of multiple materials per group in handle_special_geometry + fix line 35 + simplify handle_special_geometry
f1b3c78
to
5bfcf87
Compare
This PR:
merge_geometries
to return an array containing the merged geometry and material (instead of adding the material toresult
)merge_geometries
This PR fixes an issue we encountered with loading DAE geometry files such as these files for the UR5 robot.
Here's the before:
And after:
Here's a minimum example reproducing the downstream problem:
edit: replaced "STL" by "DAE". sorry for the confusion on my end