3D KQ(r) texture - Customizable OpenSCAD

April 21, 2024
Description
If you've checked my Randomized Kisquadrille Surface, you'll see that this is basically the same, only that each triangle has its own randomized height, instead of everything being the same size. Otherwise, if you want to know what “kisquadrille” means, read the “Geometry and gory details” section, at the end of this description.
If not, let's just say that it starts with a square grid, split into triangles, then all vertices are messed up, and different heights applied to each triangle. You can alter the results using different random seeds (numbers) and ratios of displacement for the vertices/centers.
This model is ideal for HueForging, and using the heights and steps will give you a lot of control. If you don't have HueForge, you can still use height-based color changes and get a nice result; read the “Checking the Blending Distance” section below.
Notes on the parameters
The parameters have their own description, expliciting what are they for, so they can be easy to handle. There are a couple of things to take into account, though, related to the heights, the base and the offset of the triangles.
The Triangle offset parameter expands or contracts the triangles. (Positive expands, negative contracts.) When it's noticeably positive, the triangles will overlap one another, and possibly go beyond the borders —which may or may not be the intended result. Contracting them ever so slightly, with a minimum (negative) amount, can help to render an object not displaying errors in the slicer (errors which, BTW, don't actually affect slicing and printing —it's just odd geometry). But a more negative amount (like -0.2 or more) will give you an obvious separation of the triangles, grid-like.
If you had nothing below, you would end up with separate pieces. Which again may or may not be the intended result —you can do a Tangram-like mosaic, f.i. But you may want something below to act as a grid (a “slab”), and that is the “base”. The Base height parameter determines the height of that “slab”; set it to 0 to disable it.
Now, if you're using a "grid", make sure that it doesn't interfere with the triangles; make the base height equal to, or (ideally) lower than the Minimum height.
You can determine the heights of the triangles to be “stepped” in layers using the Height steps parameter. The formula is:
(Maximum height - Minimum height) / Height steps = layer height
Note that the number of height steps must (and will) be integer; that's why it's used instead of setting a “layer height” that might give a decimal number of layers.
Also note that the height of each triangle will be shown like a “luminance map” or heightmap; the lighter the color, the higher the triangle, so the triangles at max height will be pure white, and the ones at min height will be pure black, if there is no base (if there is a base, the color will be scaled accordingly).
Generating (tileable) tiles
You can make different patterns that nonetheless tile together seamlessly, as you can see in the pictures. For two borders to tile nicely, they need to have:
- The same number of divisions (columns for top/bottom borders, rows for left/right borders).
- The same seed. Go to the “Sides tiling and randomization” section of the parameters, and make sure that “Border seed type” is set to “Specific seed per border”, and set the seed number that you need.
- The same vertex displacement ratio for the matching borders. Go to the “Sides tiling and randomization” section of the parameters, and make sure that “Border vertex displacement ratio type” parameter is set to “Specific ratio per border”.
This way, you can set a different seed and ratio for the (inner) vertices and centers, without them modifying the borders in any way.
Checking the Blending Distance
Let's get technical-ish…
If you use HueForge, you may already have heard of the BD (blending distance) which is “the same as the TD, but in print height”.
If that ain't the case, let's say that the Blending Distance is the minimum height of a 100% infill print for a given filament to show its full color and stop blending with any color below. Thing is, filaments are not completely opaque —at least, not at low layer heights, such as 0.1mm or lower. So, they blend their color with the filament below —or are slightly transparent if there is none below. This may sound as a bug, but it's actually a nice feature to have, as you can get gradients and transitions of color without having to resort to buying a ton of slightly different filaments.
Even more, another seems-bug-but-may-be-a-feature is an improperly calibrated IS (Input Shaping) and PA (Pressure Advance). As you may see in some of the pictures, this gives an irregular coloring that looks like a brush stroke —giving a less “machine” look to your prints.
The easiest way to find out the BD of a filament is to print a test swatch with the same settings you'll be using in your print. That swatch has some raised squares of increasing height over a flat surface of another color (like black or white). When the squares start looking the same, the filament has reached (and surpassed) its BD.
If you're interested in this, you may either check my Detailed TD calibration step test for HueForge (which is intended for HF and uses 0.08 and 0.04mm layer heights) or try out to make your own swatches with my OpenSCAD swatch generator.
And if you're interested in color blending… hey, you definitely should check out HueForge. Personal license costs less than a roll of filament, it really takes 3D printing to the next level, the community is amazing and Steve is a great guy. (And if you're wondering, no, I'm in no way affiliated with, sponsored by or whatnot whatever by HF. I just really like it.)
Geometry and gory details
The basis for this is a kisquadrille (or tetrakis square) grid, which is a grid of squares where all squares are divided into 4 triangles with a new vertex at the center of the square; that's the “kis” operator.
The vertices are then displaced “randomly” on X and Y, or only one axis if they're border vertices. Center of the resulting quadrilateral is found (by averaging) and displaced.