Gärtnerei-Simulator
Dev-Blog7 Min. Lesezeit

Die Geranie, die wachsen lernte

Wie aus schweren, starren Pflanzenmodellen eine Geranie wurde, die im Spiel Blatt für Blatt wächst.

Pflanztisch im Spiel mit pinken Geranien in verschiedenen Wachstumsständen, hinten blühend, vorne noch grün

Wer eine Gärtnerei führt, schaut seinen Pflanzen beim Wachsen zu. Im Gärtnerei-Simulator ging das lange nicht. Eine Geranie war entweder Jungpflanze, halb gewachsen oder ausgewachsen, und zwischen den Stufen wurde einfach das Modell ausgetauscht. Das hat mich schon länger gestört, und in diesem Beitrag erzähle ich, wie ich das geändert habe.

Der Besuch in der Versuchsgärtnerei

Angefangen hat es Anfang des Jahres mit einem Besuch in einer Versuchs- und Forschungsgärtnerei. Dort habe ich junge und schon etwas größere Geranien fotografiert, gefilmt und als Gaussian Splats aufgenommen. Das sind 3D-Aufnahmen aus vielen Einzelbildern, die man sich später am Rechner von allen Seiten anschauen kann.

Junge Geranie im schwarzen Topf auf gerastertem Tischvlies, dahinter ein langer Gewächshaustisch
Junge Geranie im schwarzen Topf, seitlich fotografiert, dahinter Reihen weiterer Töpfe
Junge Geranie im Topf vor einem langen Tisch mit Jungpflanzen
Junge Geranien in der Versuchs- und Forschungsgärtnerei.

Mich haben vor allem die Pflanzen auf halbem Weg interessiert, also nicht die fertige, blühende Geranie, sondern alles davor.

Junge Geranie von oben fotografiert, auf gerastertem Tischvlies
Blick in ein großes Gewächshaus mit Tischen voller Jungpflanzen
Anzuchtplatten mit frisch gekeimten Pflänzchen
Von oben fotografiert, ein Blick ins Gewächshaus und Anzuchtplatten mit frisch gekeimten Pflänzchen.

Die ersten Modelle

Aus diesen Aufnahmen sind meine ersten drei Geranien-Modelle entstanden, eins für jede Wachstumsstufe: eine Jungpflanze, eine halb gewachsene Pflanze nach etwa vier bis sechs Wochen und eine ausgewachsene, blühende Pflanze nach acht bis zwölf Wochen. Jedes Modell bestand aus einem einzigen Gitternetz mit einer Textur darüber, so ähnlich wie ein 3D-Scan. Blätter, Stiele und Blüten waren darin nicht voneinander getrennt.

Altes Modell der Jungpflanze mit wenigen Blättern
Altes Modell der halb gewachsenen Pflanze, ein dichter, grüner Blätterbusch ohne Blüten
Altes Modell der ausgewachsenen Pflanze, eine blühende Geranie mit korallroten Dolden
Die drei alten Modelle, Jungpflanze, halb gewachsen und ausgewachsen, hier in Korallrot.

Im Spiel stand dann je nach Wachstumsstufe eines dieser Modelle auf dem Tisch.

Pflanztisch im Spiel mit Geranien in drei festen Stufen: Jungpflanzen, halb gewachsene und blühende Pflanzen
So sah es bisher aus, mit einem festen Modell je Wachstumsstufe.

Das sah ordentlich aus, hatte aber zwei Nachteile. Die Modelle waren schwer. Die blühende zartrosa Geranie hatte 6.851 Eckpunkte, auf Englisch Vertices, aus denen die Grafikkarte die Form zusammensetzt. Weil die Textur in viele Stücke zerschnitten war und das Modell viele harte Kanten hatte, wurden im Spiel gut 24.000 daraus, denn an solchen Kanten muss die Grafikkarte Punkte doppelt anlegen. Bei einem vollen Pflanztisch kommt da einiges zusammen. Und wachsen konnten die Pflanzen auch nicht, sie sprangen einfach von einem Modell zum nächsten.

So lief das über Monate. Es hat funktioniert, aber richtig zufrieden war ich damit nie.

Wie ich auf VAT kam

Den Anstoß gab mir das Spiel Leafy Corner. Zu der Zeit hatte ich die meisten meiner Pflanzenmodelle schon, aber als ich die Pflanzen dort gesehen habe, wollte ich es bei mir auch so schön haben. Meine Pflanzen sollten wachsen wie echte, mit neuen Blättern, die klein und gefaltet erscheinen und sich nach und nach öffnen. Und das sollte auch mit vielen Pflanzen auf einmal noch flüssig laufen.

Bei meinen Recherchen bin ich dann auf Vertex Animation Textures gestoßen, kurz VAT. Ich vermute, dass es bei Leafy Corner so ähnlich gelöst sein könnte, und habe diesen Weg eingeschlagen.

Bei VAT berechnet man das Wachstum einmal vorab in Blender und legt es in einer Textur ab. Darin steht für jeden Eckpunkt der Pflanze, wo er zu welchem Zeitpunkt sitzt, und die Grafikkarte liest im Spiel die passende Form heraus. So können sich Hunderte Geranien ein Modell teilen und trotzdem unterschiedlich weit gewachsen sein.

Der erste Versuch

Mitte September habe ich die ersten Versuche in Blender gemacht. Technisch lief der erste Prototyp erstaunlich schnell. Er hatte 33 Zwischenstufen, lief in Unity und kam im Test auch mit 1.000 Geranien gleichzeitig zurecht. Nur sah er leider nicht nach Geranie aus.

Links die alte blühende Geranie, rechts der erste Prototyp mit flachem Blattkranz und sehr langen Blütenstielen
Links das alte Modell, rechts mein erster Versuch mit der neuen Technik.

Die Blätter lagen wie ein flacher, gleichmäßiger Kranz übereinander, und die Blütenstiele standen viel zu weit heraus.

Blatt für Blatt

Also habe ich mir zuerst das einzelne Blatt vorgenommen. Zur Wahl standen drei Formen: weich, gewellt und gefaltet. Ich habe mich für das gewellte entschieden und ein paar gefaltete dazwischengesetzt, weil echtes Geranienlaub nicht glatt ist, sondern Wellen und kleine Falten hat.

Drei Geranienblätter nebeneinander: weich, gewellt und gefaltet
Drei Blattformen zur Auswahl: weich, gewellt und gefaltet.

Daraus ist eine neue ausgewachsene Geranie mit 26 Blättern entstanden. Die älteren und größeren sitzen außen und hängen leicht, die jungen oben. Dazu kommen zwei kompakte Blütendolden und ein nickender Knospenstand. In einer zweiten Runde haben die Blätter feine Adern, etwas Farbspiel und das dunklere Band bekommen, nach dem die Zonal-Geranie benannt ist. Die Einzelblüten wurden runder und die Knospen praller.

Drei Geranien nebeneinander: das alte Modell, die neue Form und die neue Form mit Blattadern und runderen Blüten
Links die alte Geranie, in der Mitte die neue Form, rechts dieselbe Form nach der zweiten Runde.
Nahaufnahme der Blütendolden: altes Modell, kantige erste Einzelblüten und rundere Einzelblüten der zweiten Runde
Die Blüten aus der Nähe. Die ersten Einzelblüten waren noch kantig, später wurden sie runder.

Im Spiel kommt die neue Geranie mit rund 4.500 Vertices aus, die alte blühende hatte gut 24.000.

Wachsen lernen

Beim Wachstum habe ich es mir bewusst einfach gemacht. Gebaut wird nur die fertige, blühende Pflanze. Alles davor entsteht, indem genau diese Pflanze kleiner wird und sich zusammenfaltet, ein bisschen wie ein Film, den man rückwärts abspielt. Ein junges Blatt ist also dasselbe Blatt wie später, nur winzig und an der Mittelrippe zusammengeklappt. Mit der Zeit wächst es aus seinem Stiel heraus und faltet sich auf. Die Blüten fangen als geschlossene Knospen an und gehen von außen nach innen auf.

Ein Geranienblatt in fünf Stufen, von klein und gefaltet bis groß und offen
Ein Blatt entfaltet sich.
Ein Blütenstiel in fünf Stufen, vom kleinen Knospenball bis zur offenen pinken Dolde
Eine Dolde vom Knospenball bis zur offenen Blüte.

Bis das natürlich aussah, hat es vier Anläufe gebraucht. Im ersten begann die Pflanze als flache Rosette statt als Jungpflanze, und die geschlossenen Blüten standen auf langen Stielchen ab. Das Ganze sah aus wie eine Pusteblume.

Im zweiten Anlauf startete sie endlich als Jungpflanze, mit kräftigen Trieben und fünf Blütenstielen, an denen schon in der Mitte des Wachstums die ersten Knospen saßen. Dafür wuchs der große Pflanzenkörper jetzt direkt aus der Erde statt aus der Jungpflanze.

Im dritten kam er dann aus der ersten Verzweigung der Jungpflanze. Nur schossen am Anfang zu viele Blätter auf einmal heraus.

Im vierten kam ein Blatt nach dem anderen, am Anfang langsamer. Am unteren Teil der Jungpflanze, der ja in der Erde steckt, treibt nichts aus. Und die Blattstiele wachsen im Bogen nach oben, so tauchen junge Blätter oben auf und senken sich erst später ab. Damit war ich zufrieden.

Sieben frühe Wachstumsstände: Aus einer Jungpflanze treiben nacheinander Blätter und Seitentriebe aus
Am Anfang treiben aus der Jungpflanze nacheinander neue Blätter und Seitentriebe aus.
Zartrosa Geranie in fünf Stufen von der Jungpflanze bis zur blühenden Pflanze
Die zartrosa Geranie von der Jungpflanze bis zur Blüte.

Im Spiel

Am 24. September stand die erste wachsende Geranie im Spiel auf dem Pflanztisch, eine zartrosa. Am Spielablauf ändert das nichts. Es gibt weiter drei Wachstumsstufen, und ihr müsst die Pflanzen mit Wasser und Dünger durchbringen. Zu sehen ist das Wachstum jetzt aber ohne Sprünge. Wenn ihr eure Geranien vernachlässigt, seht ihr ihnen das weiterhin an, und im Koop sehen alle am Tisch dieselbe Pflanze gleich weit gewachsen.

Ein Spieltag im Zeitraffer. Der Tisch mit den zartrosa Geranien blüht auf, rechts stehen die Pflegewerte.

Für die Grafikkarte ist die wachsende Geranie im Testaufbau kaum teurer als die alten Modelle. Messungen im fertigen Spiel auf verschiedenen Rechnern mache ich noch.

Mehr Sorten

Danach ging es schnell. In den Tagen darauf kamen Korallrot, Pink, Weiß, Weiß mit rosa Auge und Hot Pink dazu. Jede Sorte hat ihre eigene Form mit eigenen Blütenstielen, eigener Laubfarbe und Größe, wächst aber nach denselben Regeln. Damit ein Tisch nicht wie kopiert aussieht, unterscheiden sich auch die Pflanzen einer Sorte. Mal ist eine etwas größer oder kleiner, mal sind die Stiele anders gedreht, mal hat sie einen Nebenstiel mehr oder weniger.

Blühende zartrosa Geranie
Blühende Geranie mit kräftig pinken Dolden
Blühende Geranie mit korallroten Dolden
Blühende Geranie mit weißen Dolden
Vier der sechs Sorten, von links Zartrosa, Pink, Korallrot und Weiß.
Die korallrote Geranie von der Jungpflanze bis zur Blüte.

Die korallrote gibt es außerdem in drei Laubformen, und jede Pflanze auf dem Tisch bekommt fest eine davon.

Vier blühende korallrote Geranien nebeneinander mit unterschiedlich angeordnetem Laub
Die korallrote Geranie in ihrer ersten Form und in drei weiteren Laubformen.

Nicht jede Sorte hat auf Anhieb gepasst. Bei der weißen habe ich Fassungen mit drei und mit vier offenen Dolden nebeneinandergestellt und mich für vier entschieden.

Drei weiße Geranien: das alte Modell, die neue Sorte mit drei und mit vier offenen Dolden
Links das alte Modell, daneben die neue weiße Geranie mit drei und mit vier offenen Dolden.

Wie es weitergeht

Nach dem Vorbild der Geranie wachsen inzwischen auch Petunien, Verbenen, Husarenknöpfchen, Studentenblumen, Fuchsien, Neuguinea-Impatiens und Rosen. Für die meisten gab es gar kein altes Modell mehr, sondern nur Fotos und Videos von echten Pflanzen. Beim Husarenknöpfchen habe ich zum Beispiel die Blütenblätter mehrmals versetzt, ihnen Tiefe gegeben und sie runder gemacht, bis die Form gepasst hat. Davon erzähle ich in einem der nächsten Beiträge.

Vier gelbe Blütenkörbe des Husarenknöpfchens nebeneinander
Pflanztisch im Spiel mit blühenden Husarenknöpfchen in Töpfen
Husarenknöpfchen, links die Blütenkörbe in Arbeit, rechts auf dem Pflanztisch im Spiel.

Fragen oder Anmerkungen? Schreibt mir gern an info@gaertnerei-simulator.de.

Dev blog8 min read

The geranium that learned to grow

How heavy, rigid plant models turned into a geranium that grows leaf by leaf in the game.

Planting table in the game with pink geraniums at different growth stages, flowering at the back and still green at the front

If you run a nursery, you get to watch your plants grow. For a long time, that wasn't possible in Gärtnerei Simulator. A geranium was either a young plant, half-grown or fully grown, and between those stages the game simply swapped one model for another. That had been bugging me for a while, and in this post I'll tell you how I changed it.

Visiting a research nursery

It all started early this year with a visit to an experimental and research nursery. I photographed and filmed young and slightly older geraniums there and captured them as Gaussian splats. Those are 3D captures made from lots of individual images that you can later look at from every side on your computer.

Young geranium in a black pot on a gridded ground cover, with a long greenhouse bench behind it
Young geranium in a black pot, photographed from the side, with rows of other pots behind it
Young geranium in a pot in front of a long bench full of young plants
Young geraniums at the experimental and research nursery.

What interested me most were the plants halfway there. Not the finished geranium in full bloom, but everything that comes before it.

Young geranium photographed from above on a gridded ground cover
View into a large greenhouse with benches full of young plants
Seed trays with freshly sprouted seedlings
Photographed from above, a look into the greenhouse, and seed trays with freshly sprouted seedlings.

The first models

These captures became my first three geranium models, one for each growth stage: a young plant, a half-grown plant after about four to six weeks, and a fully grown, flowering plant after eight to twelve weeks. Each model was a single mesh with a texture on top, a bit like a 3D scan. Leaves, stems and flowers weren't separated from each other.

Old model of the young plant with just a few leaves
Old model of the half-grown plant, a dense green bush of leaves without flowers
Old model of the fully grown plant, a flowering geranium with coral flower clusters
The three old models, young plant, half-grown and fully grown, here in coral.

In the game, each plant on the table was shown as one of these models, depending on its growth stage.

Planting table in the game with geraniums in three fixed stages: young plants, half-grown and flowering plants
This is how it used to look, with one fixed model per growth stage.

It looked decent, but it had two drawbacks. The models were heavy. The flowering soft pink geranium had 6,851 vertices, the corner points the graphics card uses to build the shape. Because the texture was cut into many pieces and the model had lots of hard edges, that turned into a good 24,000 in the game, since the graphics card has to duplicate points along those edges. On a full planting table, that adds up quickly. And the plants couldn't grow either. They just jumped from one model to the next.

That's how it stayed for months. It worked, but I was never really happy with it.

How I found VAT

The spark came from the game Leafy Corner. By then I already had most of my plant models, but when I saw the plants there, I wanted mine to look that good too. My plants should grow like real ones, with new leaves that appear small and folded and open up bit by bit. And it had to run smoothly with lots of plants at once.

While researching, I came across Vertex Animation Textures, VAT for short. I suspect Leafy Corner might do something similar, and that's the path I took.

With VAT, you calculate the growth once in advance in Blender and store it in a texture. For every vertex of the plant, it records where that point sits at which moment, and in the game the graphics card reads the right shape from it. That way hundreds of geraniums can share one model and still each be at a different stage of growth.

The first attempt

In mid-September I started my first experiments in Blender. Technically, the first prototype came together surprisingly quickly. It had 33 intermediate stages, ran in Unity and handled 1,000 geraniums at once in a test. It just didn't look like a geranium.

On the left the old flowering geranium, on the right the first prototype with a flat ring of leaves and very long flower stalks
On the left the old model, on the right my first attempt with the new technique.

The leaves lay on top of each other like a flat, even wreath, and the flower stalks stuck out way too far.

Leaf by leaf

So I started with a single leaf. There were three shapes to choose from: soft, wavy and folded. I went with the wavy one and mixed in a few folded ones, because real geranium foliage isn't smooth. It has waves and little folds.

Three geranium leaves side by side: soft, wavy and folded
Three leaf shapes to choose from: soft, wavy and folded.

From that came a new fully grown geranium with 26 leaves. The older, bigger ones sit on the outside and hang down a little, the young ones sit on top. Then there are two compact flower clusters and a nodding cluster of buds. In a second round the leaves got fine veins, a bit of color variation and the darker band that gives the zonal geranium its name. The individual flowers became rounder and the buds plumper.

Three geraniums side by side: the old model, the new shape and the new shape with leaf veins and rounder flowers
On the left the old geranium, in the middle the new shape, on the right the same shape after the second round.
Close-up of the flower clusters: old model, angular first flowers and rounder flowers from the second round
The flowers up close. The first individual flowers were still angular, later they became rounder.

In the game the new geranium gets by with around 4,500 vertices. The old flowering one had a good 24,000.

Learning to grow

For the growth I deliberately kept things simple. I only build the finished, flowering plant. Everything before that is created by making exactly this plant smaller and folding it up, a bit like a film played backwards. So a young leaf is the same leaf as later on, just tiny and folded along its midrib. Over time it grows out of its stalk and unfolds. The flowers start as closed buds and open from the outside in.

A geranium leaf in five stages, from small and folded to large and open
A leaf unfolding.
A flower stalk in five stages, from a small ball of buds to an open pink flower cluster
A flower cluster from a ball of buds to an open bloom.

It took four attempts before it looked natural. In the first, the plant started as a flat rosette instead of a young plant, and the closed flowers stuck out on long little stalks. The whole thing looked like a dandelion clock.

In the second attempt it finally started as a young plant, with sturdy shoots and five flower stalks that already carried their first buds halfway through growth. But now the big body of the plant grew straight out of the soil instead of out of the young plant.

In the third, it came out of the young plant's first fork. Only now too many leaves shot out at once at the beginning.

In the fourth, one leaf came after another, more slowly at first. Nothing sprouts from the lower part of the young plant, since that part sits in the soil. And the leaf stalks grow upwards in an arc, so young leaves appear at the top and only sink lower later. That's when I was happy with it.

Seven early growth stages: leaves and side shoots sprout from a young plant one after another
At the beginning, new leaves and side shoots sprout from the young plant one after another.
Soft pink geranium in five stages from young plant to flowering plant
The soft pink geranium from young plant to bloom.

In the game

On September 24 the first growing geranium stood on the planting table in the game, a soft pink one. It doesn't change how the game plays. There are still three growth stages, and you still have to keep your plants going with water and fertilizer. But now you see them grow without any jumps. If you neglect your geraniums, you'll still see it on them, and in co-op everyone at the table sees the same plant at the same stage.

A game day in time-lapse. The table of soft pink geraniums comes into bloom, with the plant's care values on the right.

For the graphics card, the growing geranium costs hardly more than the old models in my test setup. I still have to measure it in the finished game on different computers.

More varieties

After that, things moved fast. Over the next few days coral, pink, white, white pink and hot pink joined in. Each variety has its own shape with its own flower stalks, leaf color and size, but grows by the same rules. To keep a table from looking copy-pasted, plants of the same variety differ too. One is a little bigger or smaller, another has its stalks turned differently, another has one side stalk more or less.

Flowering soft pink geranium
Flowering geranium with bright pink flower clusters
Flowering geranium with coral flower clusters
Flowering geranium with white flower clusters
Four of the six varieties, from left soft pink, pink, coral and white.
The coral geranium from young plant to bloom.

The coral one also comes in three leaf variations, and each plant on the table is assigned one of them for good.

Four flowering coral geraniums side by side with differently arranged leaves
The coral geranium in its first shape and in three more leaf variations.

Not every variety worked out right away. For the white one I put versions with three and four open flower clusters side by side and went with four.

Three white geraniums: the old model and the new variety with three and with four open flower clusters
On the left the old model, next to it the new white geranium with three and with four open flower clusters.

What's next

Following the geranium's example, petunias, verbenas, creeping zinnias, French marigolds, fuchsias, New Guinea impatiens and roses now grow the same way. For most of them there wasn't even an old model, just photos and videos of real plants. With the creeping zinnia, for example, I offset the petals several times, gave them depth and made them rounder until the shape was right. I'll tell you about that in one of the next posts.

Four yellow flower heads of the creeping zinnia side by side
Planting table in the game with flowering creeping zinnias in pots
Creeping zinnia, on the left the flower heads in progress, on the right on the planting table in the game.

Questions or comments? Feel free to write to me at info@gaertnerei-simulator.de.

Weitere BeiträgeMore posts