Closed MarcelHeu closed 2 years ago
I can't offer you a magic bullet but if you're not already doing it, passing (vertices, faces)
where vertices
contains no duplicates to mesh_plot()
(input form 4 from here) instead of the usual stl.Mesh()
or a 3D vectors
array should reduce the number of vertices roughly 3-fold. If you're not too fussy about pre-render processing speed, something using numpy.unique()
will do:
import numpy as np
def uniquify(vectors):
unique, faces = np.unique(vectors.reshape((-1, 3)), axis=0, return_inverse=True)
return unique, faces.reshape((-1, 3))
Which you'd then apply to the usual bunny example:
import vtkplotlib as vpl
from stl.mesh import Mesh
mesh = Mesh.from_file(vpl.data.get_rabbit_stl())
vpl.mesh_plot(uniquify(mesh.vectors))
vpl.show()
That's the only thing I can suggest short of dropping the resolution of your support structure meshes.
i want to prepare for 3d metal printing.
Wow, I had no idea that that was a thing.
Thanks for your answer and for the hint! I have tried it, but unfortunately it has no big effect on the performance. I got a overall performance improvement, if i turn off several display details, like the lighting, edgevisibility, shading, etc. But then it looks a little bit strange.
Can you get away with reducing those red supports to triangular prisms or cuboids? Or even as just lines (i.e. use vpl.plot()
) - it'll be hideous but more renderer friendly? Other than that, I'm out of suggestions.
The resolution of each support is quite low. Each support structure is a cylinder combined with a cone with 8 corners each. I dont want to reduce it even more or change it for example to a line because of optical reasons. Maybe for these much actors i just need to buy better hardware haha.
Maybe for these much actors i just need to buy better hardware haha.
I think you might. I'm slightly surprised that 2500 actors is causing significant slow down. For me, if I run vpl.scatter(np.random.uniform(-100, 100, (2500, 3)))
(so 2500 meshes with 50 points and 96 triangles each), the frame rate is noticeably slower than it is normally but not nearly slow enough to be cumbersome.
Ohh, hang on. When you say you're using QtFigure2()
are you using QtFigure.add_cursor_tracker()
(possibly using indirectly via add_all()
)? I notice that that makes it run much slower.
You made my day! I was using the cursor tracker and the performance is much better if i turn it off!!!
Hello,
Is there maybe a way to improve the overall renderer performance for handling lot of actors within a vpl.QtFigure2. Below i attached some images as an example. In the first image you see a model i want to prepare for 3d metal printing.
For the preparation i need to attach support structures and i visualised these support structures by plotting each of them with the _vpl.meshplot function. For sure i could concatenate the support structures to one mesh, but i want to have the opportunity to manually delete and add support structures before combining them to one mesh.
There are about 2500 actors within the figure and i got the issue that it starts lagging while handling these amount of actors.
Best regards, Marcel