I have an OBJ mesh with multiple texture image materials with face texture
coordinates. The input OBJ file correctly separates each texture by
placing "usemtl material0000" in the face declarations ('f ...').
I have a typdef that defines my mesh class:
`typedef OpenMesh::TriMesh_ArrayKernelT<> Mesh;`
To open the OBJ file, I set `mesh.request_halfedge_texcoords2D()`. I have
verified texture coordinates are correct.
I'm trying to save the mesh (no modifications), but cannot get the OBJ
output to have the correct texture material lines written to the file.
Specifically, the face indices should be separated by 'usemtl matXX' for
each different material.
I've tried enabling and disabling face colors in my loading function. With
face colors enabled, I only get the 1st material. All other materials are
missing.
When I disable face colors, but have FaceTexCoord enabled, line 330 of
OBJWrite.cc ignores the line to write the 'usemtl mat' line.
Is this a bug, or am I missing something? Thanks in advance,
Jan-Michael
Reading code:
* OpenMesh::IO::Options ropt;*
* ropt += OpenMesh::IO::Options::FaceTexCoord;*
* ropt += OpenMesh::IO::Options::FaceColor;*
* _mesh.request_vertex_normals();*
* _mesh.request_face_normals();*
* _mesh.request_halfedge_texcoords2D();*
* _mesh.request_face_colors();*
* if (!OpenMesh::IO::read_mesh(_mesh, path, ropt))*
* {*
* return false;*
* }*
Writing code:
* OpenMesh::IO::Options wopt;*
* if (_mesh.has_vertex_normals())*
* wopt += OpenMesh::IO::Options::VertexNormal;*
* //update textures*
* if (_mesh.has_halfedge_texcoords2D())*
* {*
* wopt += OpenMesh::IO::Options::FaceTexCoord;*
* wopt += OpenMesh::IO::Options::FaceColor;*
* }*
* return OpenMesh::IO::write_mesh(_mesh, path, wopt);*
Hi,
When I use a trimesh with default traits ( OpenMesh::TriMesh_ArrayKernelT<> mesh; )
the default scalar type that is used is float. So after adding some vertices and indices, when I call
mesh.update_normals();
a compiler warning is generated, because 0.0 is interpreted as double in line 407 in PolyMeshT_impl.hh
changing it to
vectorize(_n, Scalar(0.0));
avoids this warning. The same probably also applies for other functions in PolyMeshT_impl.hh that use vectorize
Best Regards!
Martin
--
Martin Schultz
Developer - Integration
ModuleWorks GmbH
Henricistr. 50
52072 Aachen
Germany
martins(a)moduleworks.com<mailto:martins@moduleworks.com>
https://www.moduleworks.com
HRB 11871
Amtsgericht Aachen
Geschäftsführer Yavuz Murtezaoglu
Hi,
I was wondering if you can explain exactly how the `add_face` function in
the poly connectivity class works.
I've been trying to understand how it works by reading the code, but I
can't figure all the corner cases.
I've also posted a question here (
https://computergraphics.stackexchange.com/questions/8771/halfedge-data-str…)
which
also points the specific bit I don't understand.
Can you help?
Thank you so much.
Hello!
I am trying to make use of OpenMesh inside of a Visual Studio 2017 project, but I am running into compile errors that arise from trying to include files from OpenMesh. Here are a couple images illustrating this:
Includes:
Errors:
For context, I downloaded the OpenMesh (7.1) binary for Windows. I thought that all I would need to do is set values in the project settings to point to the lib, headers, and dlls.
Thanks,
Robert
Hi,
I am new to OpenMesha and currently working with the python bindings to build a quick prototype of my code before moving to c++.
attached a simple icosahedron structure. I defined 12 vertices and 20 faces.
When using the vf circulator I experience that not all neighbouring face of a vertex are found. I also found that the number of faces is sensitive to the order of the vertex handles when defining a face.
when looking at the indices some are set to -1.
Is this expected behavior or am I missing something fundamental?
Please find the minimal example below.
Any help or comments would be greatly appreciated!
Best regards,
Marc Siggel
import OpenMesh as om
import numpy as np
mesh = om.TriMesh()
mesh_notebook = {}
face_notebook = {}
radius = 3.0/4.0/np.pi
phi = 0.5*(1+np.sqrt(5))
a = radius / np.sqrt(phi*np.sqrt(5))
mesh_notebook[0,"handle"] = mesh.add_vertex([a*phi,0,a])
mesh_notebook[1,"handle"] = mesh.add_vertex([a*phi,0,-a])
mesh_notebook[2,"handle"] = mesh.add_vertex([-a*phi,0,-a])
mesh_notebook[3,"handle"] = mesh.add_vertex([-a*phi,0,a])
mesh_notebook[4,"handle"] = mesh.add_vertex([a,a*phi,0])
mesh_notebook[5,"handle"] = mesh.add_vertex([-a,a*phi,0])
mesh_notebook[6,"handle"] = mesh.add_vertex([-a,-a*phi,0])
mesh_notebook[7,"handle"] = mesh.add_vertex([a,-a*phi,0])
mesh_notebook[8,"handle"] = mesh.add_vertex([0,a,a*phi])
mesh_notebook[9,"handle"] = mesh.add_vertex([0,-a,a*phi])
mesh_notebook[10,"handle"] = mesh.add_vertex([0,-a,-a*phi])
mesh_notebook[11,"handle"] = mesh.add_vertex([0,a,-a*phi])
face_notebook[0,"handle"] = mesh.add_face(mesh_notebook[7,"handle"], mesh_notebook[0,"handle"], mesh_notebook[9,"handle"])
face_notebook[1,"handle"] = mesh.add_face(mesh_notebook[9,"handle"], mesh_notebook[7,"handle"], mesh_notebook[6,"handle"])
face_notebook[2,"handle"] = mesh.add_face(mesh_notebook[9,"handle"], mesh_notebook[6,"handle"], mesh_notebook[3,"handle"])
face_notebook[3,"handle"] = mesh.add_face(mesh_notebook[7,"handle"], mesh_notebook[1,"handle"], mesh_notebook[10,"handle"])
face_notebook[4,"handle"] = mesh.add_face(mesh_notebook[7,"handle"], mesh_notebook[10,"handle"], mesh_notebook[6,"handle"])
face_notebook[5,"handle"] = mesh.add_face(mesh_notebook[10,"handle"], mesh_notebook[6,"handle"], mesh_notebook[2,"handle"])
face_notebook[6,"handle"] = mesh.add_face(mesh_notebook[0,"handle"], mesh_notebook[1,"handle"], mesh_notebook[7,"handle"])
face_notebook[7,"handle"] = mesh.add_face(mesh_notebook[6,"handle"], mesh_notebook[3,"handle"], mesh_notebook[2,"handle"])
face_notebook[8,"handle"] = mesh.add_face(mesh_notebook[0,"handle"], mesh_notebook[4,"handle"], mesh_notebook[8,"handle"])
face_notebook[9,"handle"] = mesh.add_face(mesh_notebook[8,"handle"], mesh_notebook[4,"handle"], mesh_notebook[5,"handle"])
face_notebook[10,"handle"] = mesh.add_face(mesh_notebook[8,"handle"], mesh_notebook[3,"handle"], mesh_notebook[5,"handle"])
face_notebook[11,"handle"] = mesh.add_face(mesh_notebook[1,"handle"], mesh_notebook[4,"handle"], mesh_notebook[11,"handle"])
face_notebook[12,"handle"] = mesh.add_face(mesh_notebook[4,"handle"], mesh_notebook[5,"handle"], mesh_notebook[11,"handle"])
face_notebook[13,"handle"] = mesh.add_face(mesh_notebook[5,"handle"], mesh_notebook[11,"handle"], mesh_notebook[2,"handle"])
face_notebook[14,"handle"] = mesh.add_face(mesh_notebook[0,"handle"], mesh_notebook[1,"handle"], mesh_notebook[4,"handle"])
face_notebook[15,"handle"] = mesh.add_face(mesh_notebook[3,"handle"], mesh_notebook[2,"handle"], mesh_notebook[5,"handle"])
face_notebook[16,"handle"] = mesh.add_face(mesh_notebook[0,"handle"], mesh_notebook[8,"handle"], mesh_notebook[9,"handle"])
face_notebook[17,"handle"] = mesh.add_face(mesh_notebook[9,"handle"], mesh_notebook[8,"handle"], mesh_notebook[3,"handle"])
face_notebook[18,"handle"] = mesh.add_face(mesh_notebook[1,"handle"], mesh_notebook[10,"handle"], mesh_notebook[11,"handle"])
face_notebook[19,"handle"] = mesh.add_face(mesh_notebook[2,"handle"], mesh_notebook[10,"handle"], mesh_notebook[11,"handle"])
print(len(mesh.faces())) # should be 20
for edge in mesh.vf(mesh_notebook[0,"handle"]):
print(edge.idx()) # should be 5
for j,i in face_notebook:
print(face_notebook[j,i].idx()) # some are defined as -1 - default behavior?
Hello again,
I am trying to add a float data type to each face in my mesh. I am
following the storing custom properties tutorial but I am a little confused
on how to assign each face with an actual value.
For example:
OpenMesh::FPropHandleT<float> fprop_float;
mesh.add_property(fprop_float, "fprop_float");
mesh.property(fprop_float).set_persistent(true);
mesh.face(mesh.face_handle(1)) = 1.12;
Thank you very much for your help and quick responses.
- William
Hello,
I am just getting started with OpenMesh and learning the halfedge
structure. I am trying to split a face and then split it again to
ultimately create areas of different densities that looks something similar
to the picture below.
I have tried to use the following code:
int main(){
MyMesh mesh;
// generate vertices
MyMesh::VertexHandle vhandle[5];
vhandle[0] = mesh.add_vertex(MyMesh::Point(0, 0, 0));
vhandle[1] = mesh.add_vertex(MyMesh::Point( 0, 10, 0));
vhandle[2] = mesh.add_vertex(MyMesh::Point( 10, 10, 0));
vhandle[3] = mesh.add_vertex(MyMesh::Point(10, 0, 0));
vhandle[4] = mesh.add_vertex(MyMesh::Point(5,5,0));
mesh.add_face(vhandle[2], vhandle[1], vhandle [0]);
mesh.add_face(vhandle[2], vhandle[0], vhandle [3]);
mesh.split(mesh.face_handle(0), vhandle[4]);
mesh.split(mesh.face_handle(1), vhandle[4]);
// This face_handle is generated from the previous split// and is the
one causing errors
mesh.split(mesh.face_handle(2), vhandle[1]);
However when I try to load the output.off file into a mesh viewer I get the
error, "warning mesh contains 0 vertices with NAN coordinates and two
degenerated faces". Do you have any recommendations on how to create a mesh
with a large amount of faces? I am relatively new to c++ as well as mesh
generating so I feel like I'm taking the most difficult approach to this.
Thank you in advance for your help and I apologize if something like this
has been answered in the documentation but I could not find it.
- William
Hi,
Is there any methods or functions in OpenMesh which one can call to
join/combine two meshes so that it becomes one and hopefully the ability to
have a resulting mesh with the minimum number of edges ?
Cheers
--
Nicholas Yue
Graphics - Arnold, Alembic, RenderMan, OpenGL, HDF5
Custom Dev - C++ porting, OSX, Linux, Windows
http://au.linkedin.com/in/nicholasyuehttps://vimeo.com/channels/naiadtools
Hi,
today we released OpenMesh 8.0.
This release now relies on compilers supporting C++11 or higher.
Therefore Visual Studio 2013 is no longer supported.
The major upgrade in this release is the integration of an Eigen3
wrapper providing a direct replacement of the integrated vector type
(Vec3d/Vec4d). You can now use Eigen3 vectors as the basic data type
inside OpenMesh.
We also improved several readers and writers. Furthermore the new
SmartTagger class has been added which can be used to tag primitives in
the mesh while providing an O(1) reset of the tagging.
Next to this, we removed the glut requirement from the apps.
As usual the full change log is available on our website:
http://www.openmesh.org/media/Documentations/OpenMesh-8.0-Documentation/a04…
Best,
Jan Möbius
--
Jan Möbius
Department of Computer Science VIII
Aachen University of Technology (RWTH)
Ahornstrasse 55, 52074 Aachen, Germany
Phone ++49 (0)241 80-21802
Fax ++49 (0)241 80-22899
mailto:moebius@cs.rwth-aachen.de
http://www.rwth-graphics.de