Skip to content
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

.obj/.mtl loading for drake_visualizer in bowling ball contact simulation. #6352

Conversation

brandon-northcutt
Copy link
Contributor

@brandon-northcutt brandon-northcutt commented Jun 16, 2017

When running

bazel run //drake/examples/contact_model:bowling_ball

the bowling pins fail to render in the simulation and the error

ERROR: In /root/Projects/vtk/vtk/IO/Import/vtkOBJImporter.cxx, line 63
vtkOBJImporter (0x6882ff0): Unable to open file: /root/.cache/bazel/_bazel_root/9ecb0f4ce434715009a64c73d901046c/execroot/drake/bazel-out/clang-3.9-linux-opt/bin/drake/examples/contact_model/bowling_ball.runfiles/drake/drake/examples/contact_model/./pin.obj.mtl

is generated. Indeed, no such pin.obj.mtl file exists. This is caused by VTK's ./IO/Import/vtkOBJImporterInternals.h file line 70 assuming the wavefront's material file name

  // Specify file name of Wavefront .obj file.
  void SetFileName(const char* arg)
  { // by default assume prefix.obj => prefix.obj.mtl
    FileName    = std::string(arg);
    MTLFileName = FileName + ".mtl";
  }

This is a poor assumption because there is no guarantee this .mtl file exists. Maybe we should ask VTK about this.

The failure modes are interesting.

  1. Current state, the above error causes the meshes to fail to load so some objects do not render.
  2. Providing the prefix.obj.mtl mitigates the error, but the .mtl properties are ignored in favor of .urdf material.
  3. Specifying an .mtl in the .obj file causes the .mtl material properties to be used by the graphics engine.

I have added an .mtl file for pins.obj and

bazel run //drake/examples/contact_model:bowling_ball

displays properly.

This issue seems related to #6333.


This change is Reviewable

@liangfok
Copy link
Contributor

I believe this change set will not be necessary given this upstream PR:
https://gitlab.kitware.com/vtk/vtk/merge_requests/2934/

Looks like drake-visualizer will be updated tomorrow:
https://drakedevelopers.slack.com/archives/C2PMBJVAN/p1497556929842307

@brandon-northcutt
Copy link
Contributor Author

Great! Just in time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants