Stone Devlog: CSG and Me

Either due to a lack of spare time or a bid to avoid breaking ground on the knapping system, I've been implementing more geometric primitives and operations for my shiny new CSG system. I worked my way through a list of a whole lot of signed distance functions and implemented anything that seemed like it could be useful to me. This landed me at a current total of 13 primitives and 16 operations, with a few more that I intend to come back for.

Working on this has given me the opportunity to toy around with the system and get an idea for how compound operations will play out. With that in mind, I'm not totally satisfied with how things are structured, so instead of going into the nitty-gritty of the system as it currently is, how about we have a quick show and tell? Check this out:

Don't read too deep into it, this is just a series of CSG operations for demonstration purposes. First up, we create a sphere and make it hollow. Then we elongate it. Elongation might just be my favorite operation. It's different than non-uniform scaling in that it essentially splits the object, separates the subdivisions, then reconnects them. Elongating a sphere on one axis does not make an ellipsoid, it splits the sphere in half and reconnects those halves with a cylinder, creating a capsule. 

I'm on a bit of a GIF kick

In our CSG abomination above, we elongate the original sphere by a non-uniform amount on each axis, creating a rounded rectangular prism. After the elongation, we perform a good old rotation, uniform scaling, and translation. Once the object is transformed, we split it by taking the difference with returning favorite geometric primitive: the plane. Hooray, plane splitting is back! Finally, we apply another new operation to mirror the object we created across all three axes.

Okay, an abstract shape made out of a bunch of sequential operations is all well and good, but what can we do with this that would actually be practical? I'm so glad you asked. How about we create a rounded rectangular prism and stack it in two dimensions to make a brick wall:

Or how about an elongated torus, repeated, and rotated to create a chain:

This isn't looking much like a knapping system, but there are some cool possibilities here. Though, that's probably enough stalling. My next order of business will be taking a crack at a prototype for the knapping system. I'm expecting it to be very crude, most likely little more than interactive plane splitting on a cube, but it should give some idea of the sort of geometry this system can produce. It will also give me the chance to feel out the system in practice and make some refinements. Stay tuned to see how that goes.