A deep dive into the code and features
Fjäll is a limited series of 999 unique generative artworks (1/1 of 999), released on gen.art. Each piece depicts a natural landscape scene generated by code.
Gen.art is a platform and DAO for artists and collectors of generative art. They curate artists for releases to their members (you can pick up a membership here). Fjäll was released on December 15 2021 to the members and is now available on the secondary market here.
Fjäll is inspired by my experiences in nature and my memories of the Swedish mountainside. In my life I have been blessed with the opportunity to travel to many parts of the world and something that always brings a smile to my face is thinking about how different nature is across the globe.
With Fjäll I have tried to capture the beauty of natural topographic formations without being too constrained by making the results look realistic - I want the viewer to have the opportunity to take away whatever they see in the piece and not be limited by what I had in mind when creating.
I would also like to take the opportunity here to publicly acknowledge the artists who have inspired me on my journey.
Matt DesLauriers for being a huge inspiration both as a person, coder and artist. Meridian is probably my favourite series of all time and inspired me to dare to take steps away from realistic topography renderings towards a more abstract feel.
Rich Poole is a through and through amazing human. He inspired me to go deeper into details and explore scale in a way I would not have thought of myself.
Nadieh Bremer , you make me remember that there is a world outside of NFTs and crypto and that we are all part of a much larger community.
Jeff, without your tweets on colour spaces Fjäll would be a lot less colourful.
The final script is about 15kb of minified JS code. It is built on top of the shoulders of giants and utilises parts of the following open-source, MIT licensed libraries.
The following sections dive deeper into specific aspects of the code and how they impact the final output.
Generative topographies can be created in many ways, from stacking noise signals of increasing frequencies (read more here), to using polygons (see here) or by recursive subdivision (from Kai Junge here) as some examples. Fjäll uses fractional brownian motion, or stacked noise, to generate topographies. Let’s dive into some of the intricacies.
In the most basic form, fbm can be written as
fbm = const(x, z) => {
let y = 0;
let w = 1;
let g = 0.5;
let f_d = 2.0;
for (let i = 0; i < octaves; i++){
y += w * noise(x*f, z*f);
f *= f_d;
w *= g;
}
return y;
}
Where g is usually a number close to 0.5 and f_d around 2. This gives very nice natural results with great self-similarity properties, meaning the patterns look similar at different scales.
However with Fjäll I didn’t just want mountains, I wanted to convey the feeling of whole mountain areas or seabeds. They consist of mountains, but more importantly also of valleys. In order to achieve this (and other effects), we can transform the output of the pure fbm.
The first transformation we can apply is a simple power operation.
fbm = const(x, z) => {
...
return Math.pow(y, a);
}
Higher values of a will push down the lower values towards 0, while a < 1 will pull those values up towards 1 (note that the output of the fbm is normalised to give values between 0 and 1). For even more control of the peakiness of the resulting topography, we can add a “fudge factor” like this
fbm = const(x, z) => {
...
return Math.pow(y*fudge, a);
}
With a fudge factor > 1, we get more peaky mountains since values close to 1 will become greater than 1 before the power operation, pushing them further up in accordance to the value of a. A smaller fudge factor instead shrinks the range of the fbm and turns the topography into a more hilly, rounded feel.
Fjäll #544 with peaky mountains.
Fjäll 609 with rounded mountain peaks.
We can also play with the frequency increase between the steps in the fbm. The natural value of 2 has great properties, but we can tune it to achieve slightly less natural and more alien topographies. For example by setting it to a value less than 2, we achieve more rounded hills and a smoother texture overall.
Fjäll 470 displays the rounded hills topography.
Once we have a topography in 3D, we need to turn it into 2D to be able to represent it on a screen or in print. This is done using projection, there is a great Wikipedia article on it here.
In Fjäll, there are 4 different perspectives used, corresponding to different scenarios. They are Satellite, Helicopter, Outlook and Window. The difference between these in code is the angle used to view the scene from. A lower angle, as in the window perspective, causes the mountains to take front stage and tower up over the viewer, while a large angle as in satellite or helicopter accentuates the composition of mountains and valleys.
Fjäll 651 - helicopter perspective.
Fjäll 402 - satellite perspective
Fjäll 539 - outlook perspective
Fjäll 157 - window perspective
4 different shapes are used to render the final view. They all invoke somewhat different feels while still staying true to focusing on the feel of the topography rather than a picture perfect rendering. What is common for all shapes is that the size and colour are decided by light reflecting off the topography at that point. The math behind this part is quite straightforward but gives very nice visual results, you can learn more here.
The dot shape is straightforward and renders each point as a dot on the canvas. The marker and brush use 2 points connected by an underlying flow field to render short lines, with the difference being that in the brush mode the lines are much longer than in the marker mode.
Finally, the cross-stitch mode is rendered by creating an X with 2 lines and letting it be distorted into following the shape of the topography. This creates a very interesting visual where up close it can look slightly cartoon-ish while from afar it invokes a feeling of fabric.
The colours used in Fjäll come from places and things closely connected to me and my past. For example, The Groke palette comes from the character in Moomin with the same name. Growing up, Moomin was a big part of my life and I wanted to bring that into the collection. It is a dark and brooding palette and like the character represents thunder.
All palettes have undergone several passes both by myself and my partner, who has been extremely supportive during this whole endeavour. Some of the more personal palettes include Oskar, Moored, Märta and Lysekil.
Oskar was the name of the Golden Retriever I grew up with, and the simple palette with a bright orange with black mountains is my tribute to him.
The colours in Moored come from countless photos taken of the ocean and lakes in Sweden. Mooring a boat, scuba diving or just swimming, the palette highlights the feel of Swedish waters.
Märta Måås-Fjetterström was a Swedish textile artist active in the early 20th century, famous for her carpets. The colours of the Märta and Måås-Fjetterström palettes are sampled from carpets by her in my parents’ house.
Finally Lysekil is a palette with close ties to the ocean and water, but looking out over the ocean rather than down into it as in the Moored palette.
Gradients and colour interpolation are computed in the LAB colour space, resulting in smooth colour transitions without strong variations in hue or lightness. David Johnstone has a great demo highlighting the differences here.
The development of Fjäll happened over the course of several months and went through a lot of experimental phases before reaching its final state. In this section I want to note a few key turning points that had a significant impact on the final series.
The blue waterfall, as depicted above, is one of the earliest outputs of the algorithm. It has unconstrained fbm outputs and the outlook perspective. It gave some very cool outputs, but it was also very difficult to tame with a large variance in the outputs. After fighting with it I decided to explore different perspectives instead, leading to the following output with an almost vertical projection.
I continued to explore different perspectives and as you can see below if you look at mountains from the side, they become very transparent. At this point the script was already quite heavy and rendered almost a million tiny dots. I took a decision at this point to explore different ways of rendering the scene with more “fill”, especially at the mountain peaks, as a substitute for raymarching. This resulted in the “marker”, “brush” and “cross-stich” styles.
I want to leave you with a few samples from the entire collection, highlighting certain features or combinations that were surprising or special to me.
Rich Poole minted this piece which is a great example of what I wanted to achieve with the Window perspective. Low hills, a field in the distance and feeling of looking out over a landscape.
Another great Window piece was minted by Apocalypse_Blooms, this one is very special in that there is plenty of negative space and the landscape seemingly disappears into the distance.
The sunrise palette became a real hit with the community after launch and this piece captures the beauty of it. Applied in another dimension, it evokes memories of seeing the first rays of sunshine hit the peaks of mountains, as in this next piece.
The natural hills occur when the frequency increase between iterations is smaller than 2, this particular piece, Fjäll 762, also employs the Jupiter palette but only a few colours, becoming monochrome without the label.
The cross stitch drawing mode, here together with the Uluwatu palette gives a sketched feel with plenty of detail up close.
The case with gradients in the horizontal dimension going to or from a darker to a lighter colour to me resembles a seabed, going off into the deep in one end. CaliKen minted this concrete seabed.
The patchy fill brings the final artwork back a few decades, all of them remind me of leafing through old photo albums. Jimbo3816 minted this particular piece with a large patch front and centre.
Perhaps the most serendipitous output of the entire collection so far is the “crocodile”. Rounded mountain peaks and forced valleys combine with a dark palette to create something that looks very much like a pair of crocodiles resting.
I want to round off with a huge thank you to Gen.Art and all of the collectors. I was completely blown away by the reception of Fjäll and cannot wait to see them printed and hung on your walls!
TΞNGIL