Proc. meshes code: get some figures in

This commit is contained in:
Chris Hodapp 2021-08-07 11:55:18 -04:00
parent e48bc38c85
commit 45c31eec27

View File

@ -13,24 +13,40 @@ draft: true
# (TODO: pictures will make this post make a *lot* more sense, and it # (TODO: pictures will make this post make a *lot* more sense, and it
# may need a lot of them) # may need a lot of them)
Context Free is one of my favorite projects since I discovered it {{< load-photoswipe >}}
about 2010. It's one I've written about before (TODO: link to my
posts), played around in (TODO: link to images), presented on, as well [[https://www.contextfreeart.org/][Context Free]] is one of my favorite projects since I discovered it
as re-implemented myself in different ways (see: [[https://github.com/hodapp87/contextual][Contextual]]). That is about 2010. It's one I've [[../2011-08-29-context-free/][written about before]], played around in (see
sometimes because I wanted to do something Context Free couldn't, such some of the images below), presented on, as well as re-implemented
as make it realtime and interactive, and sometimes because myself in different ways (see: [[https://github.com/hodapp87/contextual][Contextual]]). That is sometimes because
implementing its system of recursive grammars and replacement rules I wanted to do something Context Free couldn't, such as make it
can be an excellent way to learn things in a new language. (I think realtime and interactive, and sometimes because implementing its
it's similar to [[https://en.wikipedia.org/wiki/L-system][L-systems]], but I haven't yet learned those very well.) system of recursive grammars and replacement rules can be an excellent
way to learn things in a new language. (I think it's similar to
[[https://en.wikipedia.org/wiki/L-system][L-systems]], but I haven't yet learned those very well.)
# TODO: Set captions?
{{< gallery >}}
{{< figure page="images" resource="placeholder/dream20191115b.jpg" caption="Something">}}
{{< figure page="images" resource="placeholder/2011-11-25-electron.jpg">}}
{{< figure page="images" resource="portfolio/2011-11-04-crystal1.jpg">}}
{{< figure page="images" resource="placeholder/2011-11-03-feather2.jpg">}}
{{< figure page="images" resource="placeholder/2011-11-03-feather1.jpg">}}
{{< figure page="images" resource="portfolio/2011-09-09-conch.jpg">}}
{{< /gallery >}}
I've also played around in 3D graphics, particularly raytracing, since I've also played around in 3D graphics, particularly raytracing, since
about 1999 in PolyRay and POV-Ray. POV-Ray is probably what led me to about 1999 in PolyRay and POV-Ray... though my [[../../images/portfolio/1999-12-22-table.jpg][few surviving]] [[../../images/portfolio/1999-12-21-moo.jpg][renders
from 1999]] are mostly garbage. POV-Ray is probably what led me to
learn about things like implicit surfaces, parametric surfaces, and learn about things like implicit surfaces, parametric surfaces, and
procedural geometry - its scene language is full of constructs for procedural geometry - its scene language is full of constructs for
that. Naturally, this led me to wonder how I might extend Context that. Naturally, this led me to wonder how I might extend Context
Free's model to work more generally with 3D geometry, and let me use Free's model to work more generally with 3D geometry, and let me use
it to produce procedural geometry. it to produce procedural geometry.
# TODO: Link to some POV-Ray scenes here with implicit & parametric
# surfaces?
[[http://structuresynth.sourceforge.net/index.php][Structure Synth]] of course already exists, and is a straightforward [[http://structuresynth.sourceforge.net/index.php][Structure Synth]] of course already exists, and is a straightforward
generalization of Context Free's model to 3D (thank you to Mikael generalization of Context Free's model to 3D (thank you to Mikael
Hvidtfeldt Christensen's blog [[http://blog.hvidtfeldts.net/][Syntopia]], another of my favorite things Hvidtfeldt Christensen's blog [[http://blog.hvidtfeldts.net/][Syntopia]], another of my favorite things
@ -50,16 +66,16 @@ these, but I quickly ran into a problem: they were made for actual
practical applications in CAD, not so much for my generative art, and practical applications in CAD, not so much for my generative art, and
they scaled quite poorly with the sort of recursion I was asking for. they scaled quite poorly with the sort of recursion I was asking for.
Implicit surfaces (or one of the many Implicit surfaces (or one of the many related-but-not-identical things
equivalent-except-for-when-it's-not names for this, e.g. F-Reps or around this, e.g. [[https://en.wikipedia.org/wiki/Function_representation][F-Reps]] or distance bounds or [[https://en.wikipedia.org/wiki/Signed_distance_function][SDFs]] or isosurfaces)
distance bounds or SDFs or isosurfaces) handle almost all of this handle almost all of this well! They express [[https://en.wikipedia.org/wiki/Constructive_solid_geometry][CSG]] operations, they can
well! They express CSG (TODO: link to CSG) operations, they can be be rendered directly on the GPU via shaders, operations like blending
rendered directly on the GPU via shaders, operations like blending
shapes or twisting them are easy... for more on this, see [[http://blog.hvidtfeldts.net/][Syntopia]] shapes or twisting them are easy... for more on this, see [[http://blog.hvidtfeldts.net/][Syntopia]]
again, or nearly anything by [[https://iquilezles.org/][Inigo Quilez]], or look up raymarching and again, or nearly anything by [[https://iquilezles.org/][Inigo Quilez]], or look up raymarching and
sphere tracing, or see [[https://ntopology.com/][nTopology]], or Matt Keeter's work with [[https://www.libfive.com/][libfive]] sphere tracing, or see [[https://ntopology.com/][nTopology]], or Matt Keeter's work with [[https://www.libfive.com/][libfive]]
and [[https://www.mattkeeter.com/research/mpr/][MPR]]. They're pure magic, they're wonderfully elegant, and I'll and [[https://www.mattkeeter.com/research/mpr/][MPR]]. They're pure magic, they're wonderfully elegant, and I'll
probably have many other posts on them. probably have many other posts on them. (TODO: Link to my CS6460
stuff)
However, there is one big issue: turning implicit surfaces to good However, there is one big issue: turning implicit surfaces to good
meshes for rendering /is a huge pain/, and while many renderers can meshes for rendering /is a huge pain/, and while many renderers can
@ -79,8 +95,8 @@ self-intersection, no high-degree vertices, no triangles of extreme
angles) - rather than attempting to patch up the mesh after its angles) - rather than attempting to patch up the mesh after its
creation, or subdividing it to the necessary detail level. For creation, or subdividing it to the necessary detail level. For
something similar to what I mean (though I didn't have this in mind at something similar to what I mean (though I didn't have this in mind at
the start), consider the [[https://en.wikipedia.org/wiki/Marching_squares][marching squares]] algorithm, which is the start), consider the [[https://en.wikipedia.org/wiki/Marching_cubes][marching cubes]] algorithm, which is guaranteed
guaranteed to produce closed, manifold meshes. to produce closed, manifold meshes.
(TODO: Illustrate this somehow) (TODO: Illustrate this somehow)
@ -90,29 +106,30 @@ them at least) by way of inductive steps.
My meandering path to implementing it went something like this: My meandering path to implementing it went something like this:
- Write some very ad-hoc Python to generate a mesh of a parametric - Wrote some very ad-hoc Python to generate a mesh of a parametric
conversion of my annoying spiral isosurface from 2005 by breaking it conversion of my annoying spiral isosurface from 2005 by breaking it
into planar "slices" or "frames", which move along the geometry and into planar "slices" or "frames", which move along the geometry and
then are connected together at corresponding vertices. (TODO: Add then are connected together at corresponding vertices. (TODO: Add
link to the automata_scratch repo, whatever it's renamed to) link to the automata_scratch repo, whatever it's renamed to)
- Explore [[https://github.com/thi-ng/geom][thi.ng/geom]] and pretty quickly give up - but in the process, - Explored [[https://github.com/thi-ng/geom][thi.ng/geom]] and pretty quickly gave up - but in the
discover [[https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.42.8103][Parallel Transport Approach to Curve Framing]]. process, discovered [[https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.42.8103][Parallel Transport Approach to Curve Framing]].
- Implement that paper in Python, reusing the basic model from my - Implemented that paper in Python, reusing the basic model from my
prior code. (See [[https://github.com/Hodapp87/parallel_transport][parallel_transport]]) prior code. (See [[https://github.com/Hodapp87/parallel_transport][parallel_transport]])
- Again continue with this model, allowing more arbitrary operations - Again continued with this model, allowing more arbitrary operations
than parallel frame transport, eventually integrating most of what I than parallel frame transport, eventually integrating most of what I
wanted with the recursive grammars. (See wanted with the recursive grammars. (See
[[https://github.com/Hodapp87/automata_scratch/tree/master/python_extrude_meshgen][automata_scratch/python_extrude_meshgen]]) [[https://github.com/Hodapp87/automata_scratch/tree/master/python_extrude_meshgen][automata_scratch/python_extrude_meshgen]])
- Keep running into limitations in python_extrude_meshgen, and start - Kept running into limitations in python_extrude_meshgen, and start
[[https://github.com/Hodapp87/prosha][Prosha]] in Rust - partly as a redesign/rewrite to avoid these [[https://github.com/Hodapp87/prosha][Prosha]] in Rust - partly as a redesign/rewrite to avoid these
limitations, and partly because I just wanted to learn Rust. limitations, and partly because I just wanted to learn Rust.
- Realize that Rust is the wrong tool for the job, and rewrite *again* - Realized that Rust is the wrong tool for the job, and rewrote
in Python but with a rather different design and mindset. *again* in Python but with a rather different design and mindset.
(this is, of course, ignoring many other tangents with things like (this is, of course, ignoring many other tangents with things like
shaders) shaders)
(TODO: Maybe split these off into sections for each one?) (TODO: Maybe split these off into sections for each one? That'd make
explanations/pictures easier.)
I put some serious effort into [[https://github.com/Hodapp87/prosha][Prosha]] and was conflicted on shelving I put some serious effort into [[https://github.com/Hodapp87/prosha][Prosha]] and was conflicted on shelving
the project indefinitely, but the issues didn't look easily solvable. the project indefinitely, but the issues didn't look easily solvable.