Forum

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - edz

Pages: [1]
1
Python and Java API / Export normal map from Python
« on: May 21, 2020, 04:33:32 PM »
Is there a way to export the Normal map from the python API ? (I am refering to the Model NormalMap, not the per-camera normal map)

I am using this code, but I do not get any normal maps output as a file:


    # Import new mesh
    chunk.importModel(mesh_file)

    # Bake DiffuseMap Texture
    chunk.buildTexture(texture_size=4096, texture_type=Metashape.Model.DiffuseMap)

    # Export Model and Texture
    chunk.exportModel(os.path.join(output_folder, chunk.label + '.obj'))

    # Bake NormalMap Texture
    chunk.buildTexture(texture_size=4096, texture_type=Metashape.Model.NormalMap)

    # Export Model and Texture (still exports the diffuse JPG....)
    chunk.exportModel(os.path.join(output_folder, chunk.label + '_NORMAL.obj'))


2
Face and Body Scanning / Exporting Model as FBX, markers are not present
« on: February 24, 2020, 11:08:51 PM »
When exporting the model as FBX, there is an option in the dialog to include Cameras and Markers.
Even if Markers is checked, not all markers are exported. It seems to be exporting only the ones with at least one projection? My markers come from an external source, so I have the 3D position in the scene, but I do not have a projection at that time, is there a way to include these markers in the FBX file ? (I'm using markers to store the position of the lights)


3
Python and Java API / buildTexture with subset of cameras
« on: January 29, 2020, 09:52:14 PM »
buildTexture has a parameter called cameras, the documentation only states it is a list of ints. I just want to double check that those are indices to cameras in the same order as chunk.cameras ? I have both grayscale and color cameras, and I want to use only color cameras for texturing. I'm using the following code to select color cameras:

    list_of_cameras_for_texturing = [i for i,c in enumerate(chunk.cameras) if 'CUCAU' in c.label]
    chunk.buildUV(mapping_mode=Metashape.GenericMapping)
    chunk.buildTexture(blending_mode=Metashape.MosaicBlending, cameras=list_of_cameras_for_texturing, texture_size=8192)


This seems to only work only "sometimes". I have got textures build from the other (grayscale) cameras. I am still trying to figure why.

4
Python and Java API / Python Scripting and multiple textures
« on: July 30, 2018, 10:28:02 PM »
In the python scripts, how are we supposed to know which face-vertex maps to which texture index (when using multiple textures).
I use chunk.buildUV(count=4) for example, and chunk.model.texture(page=index) work well. But when looking at the faces with chunk.model.faces, I can get the tex_vertices, which works well for a single texture. But I think the texture index is missing, I suggest adding something like chunk.model.faces[].tex_index to indicate the texture associates with that specific face.



5
Bug Reports / Error with tex_vertices with 1.4.3
« on: July 30, 2018, 10:24:05 PM »
With version 1.4.3, there is a problem with the chunk.model.faces[].tex_vertices values. The index they contain is actually always equal to the vertices index. This should not always be the case, (it is possible that the vertex indices are different from the texture indices). One way to verify this problem is to simple check that len(chunk.model.vertices) != len(chunk.model.tex_vertices) which means that the number of values are different, so most likely the indices should also be different.
Yet, this check always returns True in 1.4.3, but it returns always False in 1.3.5.
[f.tex_vertices for f in chunk.model.faces] == [f.vertices for f in chunk.model.faces]

As an additional test, it we try to use these values (chunk.model.faces[].tex_indices) to generate a mesh in python, it is clear that the indices are wrong and the resulting UV coordinates are all over the place.

In 1.3.5, the values in chunk.model.faces[].tex_vertices are correct.
The values in chunk.mode.tex_vertices are good in both versions.

This is an important feature to be able to write the mesh in our own custom format from the python scripting.

Pages: [1]