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

Viewer3D: add support for vertex-colored meshes #550

Merged
merged 3 commits into from
Jul 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions meshroom/nodes/aliceVision/Meshing.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ class Meshing(desc.CommandLineNode):
uid=[0],
advanced=True,
),
desc.BoolParam(
name='colorizeOutput',
label='Colorize Output',
description='Whether to colorize output dense point cloud and mesh.',
value=False,
uid=[0],
),
desc.BoolParam(
name='saveRawDensePointCloud',
label='Save Raw Dense Point Cloud',
Expand All @@ -230,17 +237,17 @@ class Meshing(desc.CommandLineNode):

outputs = [
desc.File(
name="output",
label="Output Dense Point Cloud",
description="Output dense point cloud with visibilities (SfMData file format).",
value="{cache}/{nodeType}/{uid0}/densePointCloud.abc",
uid=[],
),
desc.File(
name="outputMesh",
label="Output Mesh",
description="Output mesh (OBJ file format).",
value="{cache}/{nodeType}/{uid0}/mesh.obj",
uid=[],
),
desc.File(
name="output",
label="Output Dense Point Cloud",
description="Output dense point cloud with visibilities (SfMData file format).",
value="{cache}/{nodeType}/{uid0}/densePointCloud.abc",
uid=[],
),
]
7 changes: 7 additions & 0 deletions meshroom/ui/components/scene3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ def faceCount(self, entity):
count += sum([attr.count() for attr in geo.attributes() if attr.name() == "vertexPosition"])
return count / 3

@Slot(Qt3DCore.QEntity, result=int)
def vertexColorCount(self, entity):
count = 0
for geo in entity.findChildren(Qt3DRender.QGeometry):
count += sum([attr.count() for attr in geo.attributes() if attr.name() == "vertexColor"])
return count


class TrackballController(QObject):
"""
Expand Down
11 changes: 10 additions & 1 deletion meshroom/ui/qml/Viewer3D/MaterialSwitcher.qml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ Entity {
},
State {
name: "Textured"
PropertyChanges { target: m; material: diffuseMap ? textured : solid }
PropertyChanges {
target: m;
// "textured" material resolution order: diffuse map > vertex color data > no color info
material: diffuseMap ? textured : (Scene3DHelper.vertexColorCount(root.parent) ? colored : solid)
}
}
]
}
Expand All @@ -80,6 +84,11 @@ Entity {
diffuse: root.diffuseColor
}

PerVertexColorMaterial {
id: colored
objectName: "VertexColorMaterial"
}

DiffuseSpecularMaterial {
id: textured
objectName: "TexturedMaterial"
Expand Down