Improvement to gyroid infill #981
Replies: 2 comments
-
Hi gyroid is x+y+z=0 from what I remember. It's called for a layer at a certain Z. I'm speaking from memory, so take it with a grain of salt. An improvement to make to the current gyroid is a detection of the bad Z , when it's too near of the direction shift (when it's massively overhangs), to be able to move the z offset of the pattern for this layer (or possibly for the entire object if it has a constant layer height) to avoid the problematic z section. If you want to create your own infill, consider creating a new one as it may be easier than modifying one. |
Beta Was this translation helpful? Give feedback.
-
Hello, |
Beta Was this translation helpful? Give feedback.
-
I have implemented an improvement to the gyroid infill, and want to communicate with the developer of the FillGyroid.cpp file in the code. I don't know if it originated in Slic3r or PrusaSlicer or even SuperSlicer, but since @supermerill merged some PRs about it in PrusaSlicer and manages this SuperSlicer repo, perhaps this discussion area is a good start.
Problems I have observed with the current gyroid infill, especially at low fill density (like below 5%):
I solved these problems mathematically (first using MATLAB) and implemented my new infill in PrusaSlicer, although I am getting some strange glitches that probably arise from my lack of good understanding of the gyroid infill algorithm in PrusaSlicer. If I can get this working, the gyroid would have no horizontal regions, no overhangs, and all layers fully contacting across the pattern.
A sinewave has nearly flat regions (the tops of the peaks and bottoms of the valleys), which aren't good for printing. So I thought "why not base the gyroid on a triangle wave instead of a sinewave?" A triangle wave has no horizontal regions like a sinewave. The triangle wave functions are simply
However, because the gyroid infill involves sines and cosines multiplied together...
...then if we drop in the equivalent triangle waves, we get curvy quadratics - not desired. So I thought it best to start with the square root of a triangle wave so that the product of two of them result in a linear function (not everywhere but in places). So the new gyroid is based on this wave function (where sgn() is the sign of the argument):
Modeling this in MATLAB gave promising results (top-down view). This is less than 1 cycle deep; extending it further results in diamond-shaped holes, as opposed to the round holes in the regular gyroid function:
So I tried this in PrusaSlicer. After adding support for the new fill type in the necessary files, I copied the FillGyroid.cpp and FillGyroid.hpp files to FillTriangleGyroid.cpp and FillTriangleGyroid.hpp respectively, renamed all the functions to avoid duplication, and substituted every occurrence of sin(), cos(), and asin() with tri_sin(), tri_cos(), and tri_asin():
After building it and trying it out, the fill pattern showed some strange gaps that I don't know how to fix. Again, a top-down view of the slicer output:
As you can see, as the waves approach each other toward the flip point, there are no overhangs, unlike with the regular gyroid.
At that point I decided I need to find a person who has a better understanding of FillGyroid.cpp to try to figure out what's wrong. I suspect there's something in the way the module calculates phase shifts during flips but I tried fiddling with that to no avail.
If this can be made to work, I think it would be an improvement over the current gyroid, retaining its good qualities (print speed, zero crossings, true 3D pattern) while adding the benefits of no overhangs and possibly greater strength due to fuller contact between layers.
-Alex
Beta Was this translation helpful? Give feedback.
All reactions