aardappel / lobster

The Lobster Programming Language

Home Page:http://strlen.com/lobster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

meshgen: subtractive/negative geometry

janEntikan opened this issue · comments

The only way to get, for example, a crater in a sphere is by adding a negative sphere that removes from- , instead of adding to the generated geometry.

image
(some image I found online, left is additive, right is subtractive)

This would add considerable artistic flexibility.

Ah, as I just mentioned in discord:

This could in theory be supported, but is probably a bit tricky given the additive nature of how things are currently implemented (i.e. it does not "sample" the composite implicit function for each point in the grid once, it actually "adds" each single implicit function to the grid one by one)

And that to some extend also makes it simpler since it would not have to worry about ordering of operations in the case of cutting, since that is already fixed by the mg_ call evaluation order.

Concretely, you'd add a var to ImplicitFunction that indicates add (1) or substract (-1), then somehow update dv in FillGrid taking that value into account (how? that I wouldn't know off the top of my head). Then add an mg_substract(on:bool) that turns it on or off for the shapes while on.