-
-
Notifications
You must be signed in to change notification settings - Fork 469
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 rendering of OGRE meshes with materials and textures (ros-pkg ticket #5421) #507
Comments
[ahornung] Both patches extend the OGRE resource package path. 1 implements the same behavior as Gazebo plugins: packages can export their resource path with
This requires to depend on rviz (and thus rx) due to the plugin lookup implementation. For URDF description packages, this pulls in unwanted dependencies. 2 on the other hand relies on a special tag in the URDF which specifies resource paths for all meshes:
This avoids the problems of #1, at the "cost" of an additional URDF tag. No idea what's the best solution, but two looks cleaner to me. |
[ahornung] Forgot to add a downside of #2: It only works for robot meshes from a URDF, but not for visualization_msgs::Marker::MESH_RESOURCE. Maybe both patches make sense to be applied, one for robot meshes and one for "true" rviz extensions which then need to depend on it? |
Any update on this? I guess it will never be merged into Fuerte, but what about Hydro? The patches did not seem to get converted properly from code.ros.org, I'll post them below. Patch No. 1:
This allows packages to export their resource path with
...but requires to depend on rviz (and thus rx) due to the plugin lookup implementation. For URDF description packages, this pulls in unwanted dependencies. Patch No. 2:
This relies on a special tag in the URDF which specifies resource paths for all meshes:
Looks a lot cleaner, but has the "cost" of an additional URDF tag. |
Sorry for ignoring this for a year and a half, I agree it looks important to fix. I hope we can make a fix that is a little smoother than either suggestion above though... it seems to me that mesh files are usually stored in the same or a nearby directory as their associated textures and other resources. How about inside loadMeshFromResource() we strip the final filename off of the mesh file path and add the resultant directory to OGRE's resource path? Would that do it? Would we need to recurse down from there into other directories? Would we need to go up from there into parent directories? Can you post or link to an example that includes the .urdf, .mesh, and material or texture files that are currently ignored? |
True, I would assume the textures to be close to the meshes. Assuming the same directory would be a good start, but I think recursing into subdirectories could also be required. I don't know the usual structure or conventions of an Ogre mesh export, though... "Media/materials" seems to be a common path for them: The meshes we're working with are not publicly available unfortunately, but I could send you an example via email. |
Example via email is fine, but better would be a public example that
|
OK, sent you a mail. There are models that consist of multiple part (partly reused) so mesh files can be in a subtree of a folder. In that case adding every directory does not make much sense. In line with rviz, what about adding |
Well, I'm still not sure. Ogre::ResourceGroupManager::addResourceLocation() has a "recursive" option, so it would be easy to implement something like the What I worry about with a convention like this is that when it works it will seem kind of magical and when it doesn't it will be pretty unclear as to why it doesn't work. I like the
But since the actual "urdf" package wouldn't actually be related, and could conceivably go away or have its name changed and then break this seems like a problem. In that direction, we could make an empty package called "media_exports" which just has some documentation in it explaining what it is for. Then rviz and nao_description could both depend on that, and we would use:
I don't have a feel for the "cost" of adding a tag to URDF. Since it doesn't address the problem of Ogre meshes in marker messages, maybe it is not really in the running. |
In fact, since this issue of needing to depend on a package named by the export tag exists generally, we could call the new package "misc_export". Then anyone could depend on it and thus read kind of arbitrary stuff out of the export section.
|
A benefit of the "media_export" package idea is that you could put common materials in a separate package from the .mesh files that needed them. If we used the scheme where it added the $package/ogre_media when loading a .mesh file from $package, it would not be able to see the materials in the common package. |
Could the functionality of this new |
Well, I was thinking we could use "urdf", since that is a dependency of anything that has a urdf file. However, rviz has a feature where you can send "mesh marker" messages which refer to mesh files, which may in turn need to load texture and material files (and thus need this media-loading behavior). At that point, urdf is not particularly related. |
Then maybe not, just a thought. Otherwise, making a new package seems like the best option. |
Guys, correct me if I'm wrong, but from what I understand, there are two separate issues here:
For (1), you can specify the mesh filename as a package:// URI, which can be resolved into an absolute path, as done in the urdf tutorials on ros.org. Don't know how Gazebo handles that though. For (2), the path to the asset in the mesh file should be relative to the file itself, so adding the path where the mesh file resides as a resource location should do the job. You could allow package:// URIs there as well. |
This issue is about (2). (1) is working fine. The problem is that with Ogre .mesh files, you can't specify a material So that's why I thought the explicit thing would be nice, because On Thu, Aug 1, 2013 at 6:31 PM, David Gossow notifications@github.comwrote:
|
Thanks for the clarification! In that case, my vote would go to creating a media_export package and using the export tag in the package.xml to specify your media paths. |
Sounds good to me too! |
I have a fix for this in 17f5520. You'll also need https://github.com/ros/media_export in your workspace to try it out. See the README.md in media_export for descriptions of what you need to add to your packages which want to export ogre_media_path s. |
Thanks to @ahornung for the code that reads the paths into Ogre! |
I can confirm that it's working great here with RViz from the hydro-devel branch, thanks! By the way, the original code for the paths above was contributed by Stefan Osswald (University of Freiburg). |
OGRE meshes as robot parts (opposed to collada) are not rendered correctly but all red with no shading or texture applied. The problem is that their .material files and textures are only read from one global path, "rviz/ogre_media". This requires copying the materials of all robot parts to this global location (undesirable or even impossible as a regular user with a system-wide installed ROS).
Gazebo fixed this by allowing packages to export resource lookup paths. Two different patches can be applied to RViz to fix the behavior and correctly render OGRE meshes, attached below (last tested with electric released version, patches by Stefan Osswald, University of Freiburg).
The patches are relatively straight-forward, local, and don't affect any other behavior so it would be great to get one of them in for the Fuerte release.
trac data:
The text was updated successfully, but these errors were encountered: