import a mesh as a geom

Discussion in 'Modeling' started by Yibiao Zhao, Oct 31, 2015.

  1. I am working on a project that uses Mujoco as a general physics/graphics engine to understand real world scanned 3D scene.

    1. I have a simple question: how can I import a mesh into the Mojoco engine? Vikash gave me a hint that I may try something like this:

    <geom name="apple" class="0" type="mesh" mesh="apple.stl" pos="0.3 -.2 .5"/>

    But Mujoco keep showing errors:

    Error: mesh 'apple.stl' not found in geom 1
    Object name = apple, id = 1, line = 38, column = 9

    I've put everything in a same folder, I do not think it's file path problem. Here is the model I tried:

    an CAD apple
    https://www.dropbox.com/s/qwyltlrfjojvebe/apple.stl?dl=0


    2. Ultimately, I want to import scanned 3D objects with associated texture like this:

    a scanned 3D model
    https://www.dropbox.com/s/he86gsbtef676cx/cylinder.zip?dl=0

    So I also request a new feature of importing a ".obj" mesh. There are public c/c++ ".obj" parsers available.

    Thank you!
     
  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    You have to load the mesh as an asset, give the asset a name, and then reference the name in the geom definition. Look at the MPL family of models distributed with MuJoCo HAPTIX, they use meshes. The part of the MJCF documentation describing assets will be on the website tomorrow - I was writing it before I saw your post:)

    Regarding your second question, did you mean meshes that have per-vertex color, or meshes with textures applied to them via texture mapping? Currently you can load textures (again using assets) although texture coordinate generation is automatic and will not match your scanned object. Loading meshes with per-vertex color is on the todo list but not at the top of the list... apart from parsing, it needs changes in the low-level model structure as well as the rendering code.

    Why exactly do you want to import scanned objects with their color? Is it a computer vision application or do you just want to make the scene look realistic? In general, MuJoCo's visualizer is aimed at scientific computing rather than state-of-the-art graphics. The rationale is that people who want visual realism are better off doing simulation in MuJoCo and using Unity or Unreal Engine for rendering - in which case they will have to manage their graphics-related assets outside MuJoCo. Of course that doesn't mean MuJoCo's renderer should not be improved... it is just a matter of figuring out where to draw the line.
     
  3. I am working on a computer vision application and i need meshes with texture. Is there any improvement in MuJoCo's renderer? Generally, is MuJoCo appropriate for such applications?
     
  4. Emo Todorov

    Emo Todorov Administrator Staff Member

    You can map textures on meshes but the texture coordinates are generated automatically, and you have some high-level control over this process. The next release will allow explicit texture coordinates to be loaded from file. It will be out in a couple of months.