This is more of a developer’s question about threes.js. I’m trying to create a small app that loads existing G-code and displays a representation of the extrusion. I’m curious about the best way to render the extrusion. I’ve noticed that in Kiri, the performance is exceptionally fast when there are many lines. However, it’s worth noting that my extrusion is not linear, so the lines can sometimes become thicker or thinner.
Any assistance you can provide would be greatly appreciated. Thanks!
this is the next frontier for Kiri’s FDM render engine. extrusion needs to change thickness for “arachne-like” walls. it’s just a lot of work and a rewrite of parts that were written long before these concepts were implemented in slicers.
having said that, I spent a lot of time time optimizing the existing render pipeline. most of the heavy lifting is done in workers so that the ui does not stutter or pause. in theory it’s parallelizable.
threejs has something called InstancedMesh. I think you will want to use that. create a pipe-like extrusion mesh of some unit scale. then you will re-used that one mesh object and just scale and repeat it (via references) for each segment of the gcode. this is far more efficient than constructing the entire geometry of the extrusion. it saves memory and reduces the load on the gpu pipeline. I will be implementing this in one of the upcoming releases.
Thank you so much! I really appreciate your response and KIRI slicer is an inspiration and amazing resource.
Thanks