Magical gene / magical coat genes

Dorsal Wing

A butterfly lies along the horse's back with its wings spread either side of the spine and the wingtips folded down over the barrel - dark, edged in teal, with rust squiggles across the wings and hot pink cells inside them. Both halves are identical.

What it can come out as

OutcomeCarrying
Dorsal WingWb/Wb · Wb/Wc · Wb/n
Coloured dorsal wingWc/Wc
Wild typeWc/n · n/n

How each one is actually drawn - region by region, and the layers it is built from - is on the coding tab.

Crossing two of them

Finding one

About 1 in 3,571 wild horses is born showing this. That is the whole of the supply: catch one, or make one with the carrot below. Breeds set their own pools and a breed built around this gene will carry it far more often than the wild population does.

Wild pairShows asHow often
Wb/WbDorsal Wing0.001% — 1 in 100,000
Wb/WcDorsal Wing0.004% — 1 in 25,000
Wb/nDorsal Wing0.019% — 1 in 5,263
Wc/WcColoured dorsal wing0.004% — 1 in 25,000
n/nWild type99.972%

Its gene carrot

The file

common/src/main/resources/horsegenetics/genes/dorsal_wing.json — a data-driven gene, not a Java class. It is listed in the index.json beside it and registered by Genes' class initialiser at startup.

Keyhorsegenetics.dorsal_wing
Phasemagical — it adds signed colour in phase 3, after the pigment has resolved
Priority121 — where it sits in the one (priority, key) paint order
AllelesWb · Wc · n
Varies per horse4 values drawn once off the expressing allele copy, so a foal that inherits the copy inherits the look
Built fromAXIS, NORMAL, SPOTS, SVG, TINT, TOWARD

Why it is built this way

The source was an SVG: four flat colours traced off a photograph of a butterfly - a near-black ground, rust patches across the wings, hot pink lobed cells inside those patches, and a teal band along the outer margin. About 60 KB of path data. The colours and the three-deep nesting come from it; the outline does not, for the reason below.

The source butterfly is photographed at an angle with its wings at different sweeps, so it is not symmetric and mirroring one half of it gives a lump rather than a butterfly - that was tried and thrown away. The silhouette here is drawn instead: a body spindle and four wings, with each wing mirrored across the centreline by construction, so the symmetry is exact rather than approximate.

plane: top is the whole reason this satisfies 'symmetric on the dorsal line'. It is the only plane whose mirror line IS the spine - a side-plane shape is duplicated onto both flanks, which makes the horse symmetric but puts the mirror line nowhere in particular, and a front-plane shape wraps the barrel. Drawn in (x, z) from above, the butterfly's body runs tail to nose and its wings spread over the two sides.

The NORMAL mask is the fix for how a top-plane extrusion behaves, and without it this gene looks broken. The shape is read at (x, z), and on a flank face z is CONSTANT - so every texel down that whole flank reads one value and the sides come out in vertical bands. NORMAL on Y keeps the upward-facing planes, where an (x, z) projection is the honest one. round: 0.6 rather than 0 because a Minecraft horse is boxes and a flat face normal takes exactly three values on an axis: at 0 the cut is three hard zones, and above 0 it blends toward the normal an ellipsoid of the same box would have, which is what lets the wing fade down over the shoulder of the barrel instead of stopping at a line. from: 0.15 rather than 0.5 is how far down the sides that fade is allowed to reach.

The trade-off to know: this marking lives on the back and the upper sides. It is at its best from any raised angle and it is modest from dead level. Drawing it in plane: side instead would put a whole butterfly on each flank, fully visible, at the cost of the mirror line no longer being the dorsal line - which is the thing that was asked for, so it is not what this file does.

fillRule is nonzero and every subpath is wound the same way, which is what makes the body and four wings union into one shape. They were opposite-wound at first and the overlaps CANCELLED, leaving white slivers between each wing and the body. If the butterfly comes out with gaps where the wings meet the body, that is what happened.

The squiggles are SPOTS with mirror: true, and that flag is doing the other half of the symmetry. Body space has a SIGNED z, so an ordinary scatter is independent on the two sides - correct for a paint marking, wrong for anything that reads as a design. mirror samples the lattice at |z|, so the far side of the spine gets the near side's marks in the same places. It is also why the squiggles are SPOTS stretched along X rather than STROKES: STROKES would squiggle better and has no mirror, and on a design that has to match across the spine that is not a trade worth making.

The rust and the pink share seed, spacing, stretch, vary and chance and differ only in radius, which is what keeps each pink cell inside its own rust patch. At radius 2.2 and 1.1 the rust surviving around the pink is 0.55 body units - a hair over a texel - and spacing 6.0 leaves 1.6 units of dark between neighbouring marks. Closing that spacing packs them until the wing reads as solid rust.

The four layers are DISJOINT and have to be. A magical gene's layers each measure their delta against the colour the gene started from, and the deltas are summed - so a TINT of -200 on every channel under a TOWARD teal does not give teal, it gives teal minus 200. As imported the ground was painted over the whole butterfly with the margin, the squiggles and the cells on top of it, and the horse came out solid near-black: 484 texels moved on a bay and not one of them teal, rust or pink. The ground now paints the inner shape MINUS the rust patches, and the rust paints its patches MINUS the pink cells, which is the nesting the notes above already describe - it just has to be written as subtraction rather than as stacking.

The wings are drawn HALF AGAIN as wide as the horse and centred on the spine - sizeV 1.5, originV -0.25 - so the outer part of each wing falls off the edge of the back and onto the flank instead of stopping at the top. The NORMAL mask was opened up to match, from 0.15 down to -0.75 at round 0.85, which carries it to about halfway down the barrel. Both numbers move together: widening the drawing without opening the NORMAL just clips more of the wing away, and opening the NORMAL without widening the drawing puts bare flank in the vertical bands the note above warns about.

What is on the FLANK is an extrusion and not a drawing, and it is worth knowing which is which. A top-plane shape is read at (x, z), and a flank face has one constant z - so the whole side shows a single vertical slice of the butterfly, stretched downward. On the back you are looking at the drawing; on the sides you are looking at its cross-section running down. That reads as wings folding over the barrel, which is what it is for, and it is the honest cost of the plane that makes the mirror line the spine.

The wing stops CLEAR OF THE UNDERLINE. Opening the NORMAL mask to -0.75 at round 0.85 is what carries the marking down the flank, but a rounded normal that far open also admits the belly - a downward-facing face reads well above the threshold once it is blended - so the wing ran right to the bottom of the barrel. An explicit AXIS on Y cuts it at 0.40 of the whole-horse box, which is y 13.5, about two and a half units above the underline. A height is the right tool for a height: raising the NORMAL instead would have pulled the marking back off the shoulder as well.

What it paints

Each outcome, described the way the gene file describes it, and then the layers that draw it in the order they are painted. The prose is the part a reader checks a bake against; the list underneath is what the engine actually did.

Dorsal Wing

A dark butterfly lies along the back with its wings spread either side of the spine, edged in teal, carrying rust squiggles with hot pink cells inside them - the same on both halves.

Layer order is ground, margin, squiggle, cell: each is drawn inside the one before it, so reversing any pair loses the inner colour entirely.

  1. the wing, dark — SVG × SPOTS × NORMAL × AXIS, painted with TINT
  2. the margin band — SVG × SVG inverted × NORMAL × AXIS, painted with TOWARD
  3. the squiggles inside the wing — SVG × SPOTS × SPOTS × NORMAL × AXIS, painted with TOWARD
  4. the bright cells inside the squiggles — SVG × SPOTS × NORMAL × AXIS, painted with TOWARD

Coloured dorsal wing

The same butterfly in two colours this line of horses runs to - one across the wing's markings, the other along its margin.

The recessive coloured half of the usual pair. Two hue knobs, because the source's margin is on the far side of the wheel from its wing markings and one hue driving both would lose the edge. The wing's own two - 0.3 and 0.68 lightness - stay on one hue, since there the pink genuinely is the rust lit brighter.

  1. the wing, dark — SVG × SPOTS × NORMAL × AXIS, painted with TINT
  2. the margin band — SVG × SVG inverted × NORMAL × AXIS, painted with TOWARD
  3. the squiggles inside the wing — SVG × SPOTS × SPOTS × NORMAL × AXIS, painted with TOWARD
  4. the bright cells inside the squiggles — SVG × SPOTS × NORMAL × AXIS, painted with TOWARD

Wild type

Unmarked.

Paints nothing.