Tuesday, May 31, 2016

Roman Calculus

Ever get one of those crazy ideas in your head that just won't leave you alone until you let it out? Last week I got the exceedingly odd idea of doing calculus with Roman numerals, and couldn't get the idea out of my mind until writing this post.

There are plenty of good reasons why this is a poor idea and why Arabic-Hindu numerals superseded the Roman variants in general usage, which I appreciate a lot more after trying to use Roman numerals. I figured I could do some simple integrals using integers and fractions, so I looked up Roman numerals on Wikipedia to see if they had a system for doing fractions.

Turns out they did, and it is (if possible) even more complicated than their integer system, being a duodecimal (base-12) system instead of the decimal (base-10) system used for integers. (This was apparently in order to more easily handle the common fractions 1/3 and 1/4.) Basically, it used dots to represent 1/12, and the letter S to represent 1/2, and they would just add dots and S's as necessary. (Fractions smaller than 1/12 involved a whole collection of different symbols, many of which I've never seen before, and some that won't even display on my computer.)

The article didn't mention how to actually write fractions and integers, so I used a system where fractions to the left of an integer mean to multiply, while fractions to the right of an integer represent improper fractions. I decided to use y as the variable of integration rather than x, to avoid confusion with X, the numeral, but otherwise used modern conventions such as the integral symbol, the concept of exponents, and using dy for the differential (I considered DY, but that would conflict with D the numeral). The actual integrals used are fairly arbitrary, chosen to be simple but still complicated enough to be interesting.

Anyway, take a look at the madness that results, and feel free to check my work.

\int_\text{I}^\text{IV}y^\text{II}+y+\text{I}\,dy &=
\left[\therefore y^\text{IV}-::y^\text{III}\right]_\text{II}^\text{IV}\\

Friday, May 27, 2016

Inkscape Education

In the video in my post two weeks ago, I said that Inkscape didn't have a way to make a variable-width stroke. Last week I decided to double-check that, and it turns out it actually can, sort of!

Now, it's still technically true that you can't do a variable-width stroke because of how Inkscape handles things behind the scenes. But to understand, let's talk about strokes, fills, and paths with the help of a visual aid:

So because that's probably clear as mud, let me elaborate. Inkscape works with what are known as Scalable Vector Graphics, or SVG. Objects in SVG have attributes called fill and stroke. Fill is what, well, fills the object, while stroke is the outline around it. These attributes can be simple, solid colors, or gradients (linear or radial), or even patterns.

Lines in SVG can either have the ends connect or not. If they do, you get a 2D-shape called a path (the three objects at the top of the picture that have both fill and stroke are all paths). If not, the line's appearance is controlled by its stroke, where the width is a single number that controls the width at all points. (You can have a fill on an open line, but it will usually look rather strange. It can be used to good effect in some cases, though.) Technically, you still can't have a line with a stroke that varies in width from point to point.

What you can do, however, is use the Powerstroke path effect. (To activate it, go to Path→Path Effects… then click the '+' button to add a new effect.) This changes a line into a path, and adds some handles that can be dragged to vary the width of the path at arbitrary points.

Now, by making the line a path, what was once merely a 1D-stroke is now a 2D-fill, and the new path can have a completely new stroke set (like the purple-stroked path in the bottom-right corner of the picture). And unfortunately, because it's changing the width of 2D-object, the Powerstroke effect sometimes produces rough transitions, as can also be seen in the picture. If you vary the width too much from point to point you'll probably need to do some hand-smoothing of the result. However, it's still the closest thing to a truly variable-width stroke there is, and can be quite handy if used well.

I've actually learned quite a few new things about Inkscape over the weekend courtesy of the nifty website goInkscape, which has a whole bunch of tutorials showing how to things I never knew you could do. For instance, I found out you can create arrays of clones of an object similar to the way can do so in Blender in 3D, which I plan to make use of in the future. If you're using Inkscape at all, check it out! You'll probably learn something. A hui hou!

Friday, May 20, 2016

Flag Vectorization Timelapse

Hobbits, in J. R. R. Tolkien's legendarium, give gifts to others on their birthdays, so have a little something from me today! Well, alright, my birthday was Tuesday so it's a bit late, but that's just how it worked out.

After last's week's experiment with narrating a flag vectorization, I decided to try something different and record a timelapse version of another flag sans narration. I vectorized another flag (for the Navajo this time), then sped up the footage by five times (and added some music and annotations).

Making this video turned out to be surprisingly confidence-building. I've watched timelapses of people making art on YouTube and found them rather intimidating, because I wasn't really noticing all the times they rubbed out something they'd just drawn, or went back and tweaked something. I just saw this linear experience where the artist starts with a blank canvas (or whatever) and proceeds to crank out some amazing piece of artwork like an assembly line. When I recorded this video and watched it I realized I'd been missing all those little experimental excursions, all the stops and false starts that make up the finished product because I could see them in my own work, and that allowed me to see them in other peoples' work as well, and that's a surprisingly powerful observation. I've pointed out a few places I missed something or had to go back and fix something in the video, but there are a few more I didn't point out.

Also, apparently the recording didn't pick up the options dialog I was clicking on near the very end of the video, so when it says I'm “fixing” things and apparently randomly waggling the mouse about I'm actually reverting an option I'd changed right before recording out of curiosity. Though watching this video, I feel like I do do a lot of random-mouse-waggling—I guess it's just the computer equivalent of talking with my hands.

Anyway, like with the last video, please let me know how you liked this one! I like this idea a bit more, as it has several advantages: shorter (and thus smaller) videos, and not needing to talk, think, and vectorize at the same time (which turned out to be more challenging than I'd expected!). And I personally prefer the dynamism and action in timelapses, so there may be more of these in the future. We'll see! A hui hou!

Thursday, May 12, 2016

More Flag Vectorizing

Since my last post on the subject I've vectorized some more flags, and thought I'd share some more of the interesting ones. They make for great Inkscape practice—kind of like an artist's quick sketches.

Hsenwi is a small nation in the Burma region with this cool script on their flag. I was able to copy it using almost entirely circles and circle arcs.

Inca are, well, the Inca; or Tawantinsuyu as they called the empire (literally, “The Four Regions”). I mentioned it in my first post, but it bears repeating that these flags are primarily for identification of different nations in Europa Universalis IV, as the very concept of a nation-state and a national flag were only really formulated and developed in the time period the game covers. The Inca, for instance, most likely never actually had a national flag.

Khorchin is a Mongolian nation north of Ming China in 1444, with cool script on their flag. This one took a long time to copy due to the varying widths of all those lines. I figured out a much better and faster way to copy them about half-way through, but it still took a while.

Theodoro is a tiny nation in the Crimean peninsula, the only one with Gothic culture still left in 1444. This flag involved a lot of work tweaking Bezier curves on the right side, then copying and flipping it to make the left side.

Tlapanec is a small nation in Mesoamerica, in modern-day Mexico. This flag involved a lot of playing about with color gradients on outlines (or ‘strokes’ in Inkscape parlance). Each of those toes has a separately-positioned gradient for both the stroke and fill (Inkscape-speak for the interior), for instance, plus another two for the foot and a few more for those shiny effects around the edges of the various circles. There's also some blur effects to create the fuzzy highlights.

Verden is Prince-Bishopric in the north-western part of the Holy Roman Empire in 1444, now part of Germany. I don't have much else to say about it, but those keys were fun to trace.

Vijayanagar, for a change, is a moderately large nation in 1444 in southern India, which historically lasted for around 300 years from the 14th to the 17th centuries. In EU IV it's in a prime position to go on to form an ahistorical early united India and dominate the trade between China and Europe. It's also the first nation I played where I felt I really had a grip on most of EU IV's mechanics and went on to actually do well and expand, leading to the giant green nation in and around India in the screenshot below (and a special place in my heart):

The name is anachronistic now, as Hindu nations now form “Bharat” rather than “Hindustan” as of a few patches ago.

Finally, I also have something completely new for this blog! While vectorizing some of these flags, I had an idea: why not record the screen and my thought process and post it here? I've never tried something like this before, so it's a bit rough around the edges. The flag I vectorized is the one below, for the tiny nation of Khodynt in eastern Siberia. (Calling them a state is a bit of a stretch, as they were more of a migratory tribe than an organized state.)

The video goes through the process of making a vector copy of a flag, accompanied by my rambling and semi-distracted commentary. I don't know how useful it is as a guide to Inkscape (which was part of my intent for it), but if you ever wanted to know what goes into making one of these vector copies it's a decent illustration of the process. I apologize in advance for talking half under my breath half the time. For fun, you can also count how many times I refer to ‘flags’ as ‘maps’ for some reason.

I'm interested to hear what people think of this experiment, and if you'd like to see more content like this. I'll probably make some more videos in the future, as it turned out to be a lot of fun. I'd like to try doing a sort of timelapse video where it shows the whole process of vectorizing a flag at an accelerated speed. Just let me know in the comments! A hui hou!

Thursday, May 5, 2016

Rendering the Earth

I recently came across a neat tutorial for Blender on how to create a realistic Earth image using real land and cloud images from NASA. Well, all right, we hit “realistic” about half way through the tutorial and went on to “slightly stylized,” but I like how it came out so I thought I'd share it here.

…and looking at it now, I realize you can't actually see any of the land textures because they're all on the dark side of the planet (except Hawaii, which should be visible, but I can't find it even in the full-size image). Huh. Not the greatest composition ever, is it? I do love the night lights effect though, that's pretty neat.

While I could have added a realistic starry backdrop, I was focused on finishing the rest of the tutorial and instead went for a simple random noise texture stretched to get stars. While playing around with different noise textures for the background I found the Voronoi noise texture and thought it was cool enough to save a picture of:

(Incidentally, in this picture you can actually see the land textures…)

Anyway, I now have a fairly simple (minus the stylized parts) way of rendering a pretty realistic Earth, and I bet NASA has similar textures for other Solar System bodies, so I may have to do something with that in the future…