-
Notifications
You must be signed in to change notification settings - Fork 592
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
Enhancement Ideas #199
Comments
@mikedh awesome list, we'd all love to see some of these changes, stoked to know you're considering things like built-in mesh simplification, etc. A convention I've seen in some other repos is to have each task listed as their own github issue, and give them an Also allows us to start threaded conversations on each of the tasks in your list. Anyhow just a thought! Not sure the extent to which we want to use Issues here :) |
Yeah it would be great to get some of this stuff! In the interest of avoiding a ton of immediately orphaned new issues the process I'd suggest initially would be:
|
@mikedh I'm going to try to tackle textures. Let me know if you have any thoughts -- I was also thinking a new |
Sounds good, discussion for texture in #218 |
@mikedh Hey mike, it's great to see that you mentioned IFC, which I'm quite familiar with. I also used IfcOpenShell to get geometries from IFC file and then voxelize them with trimesh. That's why I found trimesh and created two PRs :) So, maybe I can help in IFC importing. |
Hey @LinJiarui that would be great! I took a look at CIbuildwheel might be a good solution, but is definitely a lot of work! |
Perhaps optimesh is something for you, too. (BTW I just added trimesh to the awesome list.) |
@mikedh Thank you for your trimesh library. Just awesome. |
Hi @bbarroqueiro Thank you for your quick response. |
Hi @bbarroqueiro |
Oh
|
Thank you so much. That's it. I must have missed the .to_kwargs method. Thanks again |
Hello! Was there any progress on mesh simplification/decimation with Trimesh? |
Hello there everyone, my first ever comment on github haha! I think it would be nice to specify dtype for several functions when passing in arrays of points (not always converting to float64 when checking appropriate 3-dimensional). Constantly running into a memory issue when using ray.contains_points. I did see a comment that suggested iterating through, perhaps on the Z axis to avoid this issue, although i do think it could help having the option to use float16 or float 32. |
meshio author here. I think handling the I/O via meshio would be a good idea here. If you're interested I could cook up a PR. |
Hey @nschloe that would be awesome! Super open to PR's! |
OpenMesh has python bindings and decimation. Its not the lightest dependency, but it could provide mesh simplification. Roughly, you can go back and forth between OpenMesh and trimesh like so: def tri_to_om(mesh):
om_mesh = om.TriMesh(np.array(mesh.vertices))
om_mesh.add_faces(np.array(mesh.faces))
return om_mesh
def om_to_tri(om_mesh):
mesh = trimesh.Trimesh()
mesh.vertices = om_mesh.points()
mesh.faces = om_mesh.face_vertex_indices()
mesh.face_normals = om_mesh.face_normals()
mesh.vertex_normals = om_mesh.vertex_normals()
return mesh Decimation looks something like. I find their interface pretty confusing. It took a while for me to make sense of it at all. mod = om.TriMeshModQuadricHandle()
decimator = om.TriMeshDecimater(om_mesh)
decimator.add(mod)
mod = decimator.module(mod)
mod.set_binary(False)
mod.set_max_err(4)
decimator.initialize()
decimator.decimate_to(to)
om_mesh.garbage_collection() Its also possible to lock edges to preserve them during decimation. |
Hi Mike I have seen the issue concerning quadric edge decimation and the potential enhancement using sp4cerat's fast quadric edge decimation. For now I am trying to learn how to do the bindings using Cython, but I am running into some issues, mainly concerning the conversion of numpy arrays into the custom object vec3f defined in sp4cerat's code. (As I have little to no experience with C++) The easiest way to proceed would, in my opinion, to export the mesh as a temporary .OBJ file, doing the reduction using a simple cython wrapper, and loading the new file into trimesh again, but this solution is not elegant at all, and a lot of time would be lost from the conversion, the savings and the loading of objects... On the other hand, this would require the least modifications in the original code. An other idea would to pass the OBJ string directly as an argument into the code, but then I struggle to know if the type of the string in the new function used to pass the OBJ string should be *char ** or stdin or a FILE Stream , and there would still be time spent for the OBJ conversion. But the best way to proceed would be to convert the numpy arrays into the custom type defined by sp4cerat and setting the variables through a new C++ function, but this would be a lot of work and research. I would like to know if you have any ideas about how to do this (or some interesting articles about this topic) or if you have already begun this implementation. I have begun some analysis and will soon begin some testing here Greatings Kristof S. |
@mikedh I've been using this library for quadratic mesh simplification. I think this could be the perfect library for integrating into trimesh. Its got a lot going for it:
simplified = simplify_mesh(np.array(mesh.vertices),
np.array(mesh.faces, dtype=np.uint32),
node_target)
decimated= trimesh.Trimesh(vertices=simplified[0], faces=simplified[1]) I believe it should be cross platform, but there is an outstanding issue on windows that I wasn't able to offer a pull request for. Perhaps someone in this community would be able to address it jannessm/quadric-mesh-simplification#2 CC @jannessm |
@FreakTheMighty: thanks for your support. regarding the vertex attributes. I have implemented this library to use it in the context of geometric deep learning. therefore, I needed an interpolation of feature vectors assigned to vertices. But as @FreakTheMighty mentioned, it can be used very easily for quadric mesh simplification without features. Currently, I am quite busy. Therefore, I would be very glad, if I receive some support for the mentioned issue. |
hey @jannessm that looks awesome! I really like how self contained it is. If I get some cycles I'd love to help get cibuildwheel set up, although unfortunately I'm also kind of slammed this season. I'll try to look at it once I drag Toblerity/rtree#163 over the finish line. |
Hi @mikedh , even if now this issue seems to be solved i managed to wrap Sp4cerat's Fast-Quadric-Mesh-Algorithm in C++ with Cython repo: PySimplify usage is similar:
The tracking of the color and material attributes is not yet implemented, but as it is already implemented in the c++ code it is just a mater of wrapping one more function. I can help to integrating it into trimesh if you plan not to use it as an external dependency. |
@Kramer84, thank you for doing this work! It seems like Issues are not enabled on that repo, is that intentional? |
@FreakTheMighty I forgot it, the issues are now enabled, thanks! |
Hi @mikedh , thank you for this awesome library! |
Hey @tpank if it's just removing a check and adding a unit test absolutely! Happy to take PR's! |
Closing in favor of the updated issue #1557 |
I was pinged recently looking for some projects to help out with, here are some ideas. PR's are always appreciated!
Updated 7/27/2020
meshlabserver
interface or through implementing a vectorized numpy version of quadratic edge collapse: Decimate a mesh #41meshio
pyinstaller
to work withtrimesh
, as per Pyinstaller issues #412numpy
has interest in includingTrackedArray
orndarray.crc
[Upstream Improvement] TrackedArray into scipy/numpy? #283mesh.slice_plane
to speed up on large meshes: Return subset of mesh using bound #630The text was updated successfully, but these errors were encountered: