urdf2webots icon indicating copy to clipboard operation
urdf2webots copied to clipboard

Webots does neither use color nor textures from wavefront (.obj) files

Open astumpf opened this issue 3 years ago • 12 comments

RViz can take use of color and texture information from the wavefront (.obj) files...

Screenshot from 2022-02-04 21-15-15

...but Webots cannot...

Screenshot from 2022-02-04 21-12-17

In both cases the same urdf with the identical file system structure is used. I'm glad for any suggestions how to fix this issue.

astumpf avatar Feb 04 '22 20:02 astumpf

Hello @astumpf, thanks for the report.

May I ask you your files so I can debug and track where is the issues in our code?

BenjaminHug8 avatar Feb 07 '22 08:02 BenjaminHug8

Hello @astumpf, thanks for the report.

May I ask you your files so I can debug and track where is the issues in our code?

I can try to compile an example. Do you have any public available business mail I can send to?

astumpf avatar Feb 07 '22 08:02 astumpf

Yes, please send to [email protected].

omichel avatar Feb 07 '22 09:02 omichel

@astumpf did you send a minimal example to [email protected] so we can investigate this issue? (Maybe you did but I can not found a mail related to this issue)

BenjaminHug8 avatar Mar 07 '22 13:03 BenjaminHug8

@astumpf did you send a minimal example to [email protected] so we can investigate this issue? (Maybe you did but I can not found a mail related to this issue)

Not yet, I'm sorry :-(

astumpf avatar Mar 07 '22 13:03 astumpf

I've just sent a minimal example to your support mail. Please let me know if this works for you.

astumpf avatar Apr 05 '22 23:04 astumpf

I think this is currently a limitation. URDF geometry tags (with obj files) are converted to Webots Mesh nodes, which as the name implies discards both textures and materials that might be included in the .obj file and merges all meshes into one. On the Webots side we are in the process of merging a new node called ColladaShape https://github.com/cyberbotics/webots/pull/4285 which, as the name entails, provided a .dae file it generates both the mesh and the corresponding appearance. In practice however, despite the name, I don't think there's fundamentally much difference in the handling of collada and wavefront files, so with limited changes to that PR it could (in theory) be made to support both. It would however require a new name, to take inspiration from URDF it could be called VisualShape or something, it's the best I can come up with at the moment. More importantly than the name, @omichel should we consider making a more generic node that supports both formats?

ad-daniel avatar Apr 07 '22 12:04 ad-daniel

I think this is currently a limitation. URDF geometry tags (with obj files) are converted to Webots Mesh nodes, which as the name implies discards both textures and materials that might be included in the .obj file and merges all meshes into one.

I'm currently not on my dev OS to 100% confirm that, but I'm pretty sure that currently the generated proto refers to the .obj file directly. The mesh is not included as Mesh nodes in the final proto. At least the provided minimal example does not result having any mesh nodes.

In the past, we've used collada files where Webots used to consider only color data but no textures. Unfortunately, I can't test this anymore.

astumpf avatar Apr 07 '22 12:04 astumpf

I'm currently not on my dev OS to 100% confirm that, but I'm pretty sure that currently the generated proto refers to the .obj file directly. The mesh is not included as Mesh nodes in the final proto. At least the provided minimal example does not result having any mesh nodes.

Yes, the Webots Mesh node is provided the url/path to the obj directly, but under the hood when Webots parses it, it strips all textures/materials.

In the past, we've used collada files where Webots used to consider only color data but no textures. Unfortunately, I can't test this anymore.

That's how it used to behave, currently in the develop branch it generates a ColladaShapes node (technically it's a PROTO, which is what the new node will replace), so it includes both mesh and appearance for collada files.

ad-daniel avatar Apr 07 '22 12:04 ad-daniel

I think this is currently a limitation. URDF geometry tags (with obj files) are converted to Webots Mesh nodes, which as the name implies discards both textures and materials that might be included in the .obj file and merges all meshes into one. On the Webots side we are in the process of merging a new node called ColladaShape cyberbotics/webots#4285 which, as the name entails, provided a .dae file it generates both the mesh and the corresponding appearance. In practice however, despite the name, I don't think there's fundamentally much difference in the handling of collada and wavefront files, so with limited changes to that PR it could (in theory) be made to support both. It would however require a new name, to take inspiration from URDF it could be called VisualShape or something, it's the best I can come up with at the moment. More importantly than the name, @omichel should we consider making a more generic node that supports both formats?

Yes, that sounds like a very good idea.

omichel avatar Apr 07 '22 13:04 omichel

I'm wondering when will there be an update in this regard, since a lot of progress was apparently already made a long time ago?

astumpf avatar Aug 08 '22 08:08 astumpf

Yes, we actually implemented the CadShape node in Webots R2022b to be released very soon. That should resolve the issue.

omichel avatar Aug 08 '22 08:08 omichel

I can confirm that this looks pretty nice now. Thanks a lot!

astumpf avatar Oct 06 '22 08:10 astumpf