Tuesday, January 19, 2021

Genuary 2021 Day 19: "Increase the randomness along the Y Axis"


This represents a compromise, a fallback, almost a cheat.

I discovered that my work had given me yesterday off as a holiday, and rather than spend it volunteering to help others, or reading a speech or a book by Martin Luther King, Jr., or even reading a book about Unreal Engine C++ code, instead, I spent the day working on my ray marcher, with the hopes of having an island with rolling polygonal hills, and obscure towers rising into the sky.

Which would have been a cheat, in itself, because that image, that I worked almost all of yesterday on, would have been my submission for today's prompt.

Fortunately(?) the polygonal mesh dragged my renderer's performance to its knees, so I couldn't meaningfully iterate on my intended image.

Instead, I give you less ornate, less random, but still vaguely tower-ish stacks of primitives. The bottom tier is uniformly medium gray and of identical size, the next tier up has more size variability, and is picked from red, green, or blue. The last cylinder has more size variability, and is picked from a set of 6 colors, and the spheres on top from a continuum of colors.

For a while, I was struggling to reconcile this idea with randomness increasing along Y, because in my renderer, in my mental model, up is +Z, and to pass this off as randomness increasing along Y meant that either I was fudging the prompt, or I was adopting a +Y up model, which I know some people prefer, but for me, the X-Y plane belongs on the horizontal.

But, if you consider that the screen projections of these colorful towers reach upwards along screen Y, then the previous paragraph's concerns mostly fade away. Except that, often, positive screen Y goes down. (Sigh) So, again, we do some gymnastics, and either say that the prompt doesn't specify that randomness increases along the positive Y axis, or we look to the drawing APIs that prefer to have the origin in the lower left corner, to better resemble the diagrams in 7th grade algebra books.

So, we have tower-like stacks of primitives, with their color, and some of their dimensions, increasing in randomness as one goes up. Good enough.

Still a compromise, because it's not the image I had in mind.

Still a cheat of the schedule, because I did my part of the work yesterday, and the rendering completed this morning around 3am.

I look at these towers, which I've been trying to get you to see as stacks of colorful blocks, and I see abstract people. I've kicked off a render of a variation of this inspired in that direction. Maybe that will be less of a cheat, since I'm doing it today.

Also, I don't know what's going on with the red tower in the background, missing a tier. Either a bug in my placement code or a bug in my octtree spatial partition code, which is what I was struggling with all day yesterday.

I did learn a few neat things, and applied them yesterday:

  • I applied scipy's Delaunay triangulator to my Bridson blue noise point grid, and got a nice triangular mesh that I could work with.
  • I tinkered with the way that my python code was organized so I could have my daily Genuary code in one directory, and still "reach up" into my ray tracer's directory, as well as a shared Genuary SVG codebase.
  • I explored cProfile as a way to figure out where all the time was going in my ray marcher
  • I added a flag to my ray marcher to disable the multithreading, which at this point duplicates a bunch of code. But the cProfile seems to not give useful information for code not happening on the main thread, so it's good to begin supporting turning of multithreading.
  • I added progressbar2 support to my ray marcher to give a pretty ASCII display of how much work is complete, and how much remains.

Tools Used: my ray marcher
Languages Used: Python
Development Time: ~1 hours
Drawing Time: ~5 hours
What's Generative Here: Each tower is positioned based on a random assignment within a square around the origin. As you go up the tower, the range of colors, and the dimensions are increasingly drawn from a wider set of options.

No comments:

Post a Comment