blag/content/posts/2019-08-10-geometry-navel-gazing.org
2021-07-27 16:54:37 -04:00

3.7 KiB

— title: "(hand-waving musing on geometry)" author: Chris Hodapp date: "2019-08-10" tags:

  • procedural graphics

draft: true —

(This is copied verbatim from some notes taken on 2019-08-10, aside from corrections I thought were needed.)

SDFs in some sense are duals of other ways of expressing geometry. A lossless transform isn't always possible or sensible. Think of the term "distance transform" though. Interestingly, the domain does not change with this transform - only the range (and then sometimes only its interpretation). The representation of the SDF doesn't change this - e.g. analytical/procedural SDF vs. a 3D texture which samples and interpolates. Think of how an approximate FFT degrades frequency information but still leaves most of the sound intact - and how a sampled SDF still preserves edges.

(Consider inductive bias vs. deductive bias of a representation. What is easy? What is possible?)

Interestingly, the same procedural vs. explicit dichotomy shows up here. (Dichotomy or spectrum?) Perhaps 'explicit' is the wrong word or at least an unhelpful one, because it confuses it with the explicit vs. implicit in geometry. A voxel grid may just be floating-point data, but it can contain an implicit surface via its level set (i.e. isosurface).

So, perhaps the spectrum is just procedural vs. data. A sampled SDF is mostly data, expressing a surface implicitly. The fact that interpolation is a sensible way to handle these samples (since SDFs tend to be smooth, even over edges of the surface) is the "procedural" part of this that is needed.

(margin note: Calling it 'procedural' without a formal procedure being present/reified is perhaps a misnomer)

"Explicit" geometry (e.g. a triangle mesh) is along similar lines. The mesh itself is mostly data. Some renderers and modeling tools add some "procedural" element, such as tesselation. If I generate this geometry myself via a program, however, I retain most of the strengths of a procedural form of geometry, even though most systems can't handle this procedure directly (only its output) - unlike with shaders or sphere tracers.

The interesting part (to me at least) comes from the ability of procedures to be parametric, which acts as a tremendous level to reuse and efficiency, and to express infinite resolutions, sizes, and even levels of detail or variation, ranging from continuity, to noise functions that extend infinitely, to fractals that produce detail infinitely small.

There is still a bit of a split between continuous implicit functions (my terminology might be awful), e.g. things like SDFs but also other implicit surfaces I might use other ways, and things a bit closer to automata, even just explicit representations. More "continuous" descriptions are directly amenable to the whole range of things in vector calculus - gradients and gradient-desncent and optimization and so forth - but this might come at the cost of putting some kinds of recursion/iteration completely out of reach. The more 'explicit' (?) description may be able to express these effortlessly (e.g. thing of cellular automata and context-free grammars) but they lose some of the nice analytical properties, even if they generate things into some continuous space, like being able to render directly with raymarching.

These limitations might be less present than I think. Syntopia's blog has the whole 'folding space' section and expressing a Sierpinski in an SDF while still (I think) preserving differentiation, and all sorts of transforms may still preserve it (including summation) by linearity.

Mandelbrot's an interesting case here in that it has a distance estimate, yet all of the complexity (maybe more) of automata and a recursive system.