-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Loading colors for meshes from OBJ files in URDFs fails #1934
Comments
Can you answer the 2 questions? The color can be A) assigned in the URDF file using the material tag:
B) assigned in PyBullet programmatically:
Method A and method B should work. Did you try method A and/or B? Which of those 2 methods don't work? |
Thanks for your feedback. I tried Method A, and am able to set the color successfully, but that's not my question and I'm not using the URDF file you're referring to though. The one I'm using is in configuration_2017-07-18 that has ".obj" files as meshes. So, for example, instead of having .dae files, the mesh would reference .obj files as needed |
The URDF file doesn't have any material tag?
PyBullet currently only assigned the color using method A or method B (in the URDF). Here an example:
|
Ah I see, that explanation helps. No, the URDF file does not have materials, and instead relies on meshes which reference ".obj" files, which in turn reference the ".mtl" files. So if the ".obj" file references two ".mtl" files (i.e., for the globe_base.obj file, using the command mtllib globe_base.mtl), it won't load the content in the mtl files? |
And if that's the case, is it possible to replace the visual shape of a link with an output of p.createVisualShape(...)? Currently p.changeVisualShape(obUniqueId, linkIndex, ...) seems to only support outputs from p.loadTexture (which I don't think support .obj files), but since p.createVisualShape loads all of the colors fine, would be great to just replace the visual shape of the link above with its output. |
What is the issue of adding the material field with color in the URDF file? |
When I generate a .obj file from a .dae file, it automatically generates multiple .mtl files that look like this: # Blender MTL File: 'None' Material Count: 2newmtl Material_0.001 newmtl Material_001.001 Happy to add it into the URDF file if you have suggestions on how to automatically convert .mtl files into materials in .urdf files. |
If you run sdf2obj over those obj files, it will convert the mtl colors into the SDF materials automatically. I also just created a pull request that adds flags for loadURDF/loadSDF that uses the colors from MTL. pybullet.URDF_USE_MATERIAL_COLORS_FROM_MTL and pybullet.URDF_USE_MATERIAL_TRANSPARANCY_FROM_MTL. Still, this will only use one color/material per link.
|
Great thank you! Appreciate your help and continued discussion. |
Hi @erwincoumans Do you have any idea why I got this? Some information:
|
It is expected. If you want multiple materials, you need to split the obj into parts, each with their own color/texture. That is what threecubes.py does (it loads the sdf file). Make sure to use p.GUI instead of p.DIRECT in there. |
@erwincoumans
Is this expected or we can just ignore it? |
comment-out the line about egl and ignore it. Did you compile pybullet using pip? |
Got it. I commented out it and now it works fine. I was using |
The |
@erwincoumans The issue is this (#2955). Sometimes it doesn't give a very realistic feeling. We are accustomed to seeing specific robots with specific visuals in real environment. Users would like to see the same visuals in a simulated environment. It would be good if this capability will be added to PyBullet. Thanks. |
The .obj files in the URDF file in configuration_2017-07-18/globe.urdf fail to load colors properly.
However, when I use p.loadURDF(...useMaximalCoordinates=True) or p.createVisualShape("OBJ_FILE") to load the URDF, obj files they load colors file.
Code to reproduce my issue: test.py in zip file below. (replace absolute paths to files with paths to the files in your directory)
simple_test.zip
The text was updated successfully, but these errors were encountered: