Search code examples
meshlab

Switching between two different textures or UV maps in Meshlab


I will be generating a mesh outside of Meshlab, but viewing it in Meshlab. I haven't decided on a format yet. I want to have a single file that would contain all the data - the triangles, uv maps and the textures.

However, I have 2 textures between which I want to switch. They should not be visible at the same time. Imagine I want to show the mesh with some flame texture in one moment, but with a flower texture in another - the user should be able to switch between them. I tried searching for something similar, but all I find are questions on how to combine multiple textures into a single visible one, which is not what I want. There is a way to switch the texture file via Filters->Texture->Set Texture, but I'd like something less cumbersome.

Is there some way in Meshlab to easily switch between textures/UV maps? If yes, for what formats is this supported?


Solution

  • It is sad to say... but current meshlab does support loading files with several textures (for example .ply and .obj), but AFAIK it does not let the user choose the texture/material to apply in each moment. It should be very easy to write a custom plugin to rotate between textures, but it is not done.

    One easy alternative you can use and teach for your users is this:

    • In your external program, create two separate files, each one with one texture. (called texture1.ply and texture2.ply in this example)
    • Open both files with meshlab using command line "meshlab texture1.ply texture2.ply". You can see an strange combination of both meshes by now, because both meshes are being rendered.

    Both meshes active

    • Tell your users that they can change current view with Ctrl-Click in the eye icon near of the name of each mesh. This will activate one mesh and deactivate every else.

    Ctrl-Click in texture2

    • You can rotate/move the camera in any view and repeat Ctrl-Click in the eye icon to change to another mesh, keeping the current camera position.

    enter image description here

    Of course, if you modify a mesh (for example, selecting and deleting some faces) the changes affects only to one mesh, not the other.