Skip to content

feature request: api support for loading textures from obj/mtl file #27

Description

@RussTedrake

i asked (via email)

We're making pretty heavy use of meshcat in class again this term. I'm working on getting it into drake proper so the in-tree examples can use it, too:
RobotLocomotion/drake#9833

But the current implementation that we have uses MeshLambertMaterial for all of the objects -- including the ones loaded from obj files. It looks like Meshcat does support texture maps. But if I leave the materials field = None for that call to SetObject, then I still don't see e.g. the kuka's textures.

Is there an easy fix that is right under my nose?

and the response was

The way textures are handled in meshcat is currently pretty manual. You need to set the map field to an ImageTexture, and that texture in turn needs its image field set to a PngImage. This is much
easier to explain with an example: https://github.com/rdeits/meshcat-python/blob/8b24ac3a72ea56fbb64fca5fcdb1782daa0961bf/src/meshcat/tests/test_drawing.py#L50-L57

Currently, I don't try to do something clever like parse the .mtl file to load the texture, but I suspect that would be possible, perhaps with a Mesh.from_file() constructor.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions