Bismuth
BISMUTH grows a cluster of bismuth hopper crystals. Each crystal is a square spiral that is drawn bar by bar. New crystals start on the corners of older ones, so the cluster grows upward into a tower of right-angled frames. The metal is bare and silver while it grows. The colour comes later. It is calculated from the thickness of an oxide film, in nanometres, which is how real bismuth gets its colours, so there is no colour palette in the code.
BISMUTH 生长一簇铋的漏斗晶体。每个晶体是一条方形螺旋,一根杆接一根杆地画出来;新的晶体从旧晶体的角上长出,整簇因此向上长成一座直角框架的塔。生长的时候金属是裸露的银白色,颜色是之后才出现的:它由氧化膜的厚度(纳米)计算得出,真实的铋也是这样上色的,所以代码里没有调色板。
Continue with Stage 2: Applying Light and Shadow · 光影研究与制作记录
Live
Drag to orbit, scroll to zoom. Rest the pointer on the metal and it warms up. R melts it down and grows another, Space pauses, G opens the controls, H leaves only the sculpture. Click the frame first so the keys reach it. Best on a desktop with WebGL.
拖动环绕,滚轮缩放。把指针停在金属上,它会被加热。R 熔掉重长一件,空格 暂停,G 打开参数面板,H 只留雕塑。 先点一下画面让按键生效。建议在桌面浏览器观看。
One round takes about a minute and a half: grow, temper, hold, melt. After that a new seed is used and a different sculpture grows. The number at the bottom is the seed. Adding #7 to the address of the full-screen version grows No. 7 again, and it looks the same on every computer.
Overview
Project A asks us to choose a subject, study it, and imitate how it looks and behaves using objects made from a class. I chose bismuth. A bismuth crystal grows faster along its edges than on its faces, so the faces stay hollow and the crystal becomes a stepped square funnel, called a hopper crystal. The crystals grow into each other at right angles. The metal is silver when it solidifies. The gold, magenta and blue come from an oxide film a few hundred nanometres thick, which forms while the metal is still hot.
I turned these observations into three rules. A crystal only grows at its rim. A new crystal starts on a rim corner of an existing one and opens in one of the free directions. Every bar has a film thickness that increases with its age, and thin-film interference turns that thickness into a colour. The shapes are based on Sidney Gordin's welded steel sculptures: open rectangular frames, a few solid plates, bars that continue past their corners, and thin rods.
The piece runs in rounds. It grows as bare metal for about forty seconds. Then it tempers: over ten seconds the film gets thicker everywhere, and every bar goes through the colour sequence until it reaches its final colour. During the hold, heat pulses move up through the cluster and old crystals are replaced by new ones. At the end it melts from the top down, the colour goes back to silver, and the next round starts with a new seed.
The Spiral
Each crystal is built by a walker that moves along a square spiral. The sides are 1, 1, 2, 2, 3, 3 units long. It turns left after each side, and each full turn moves one step up along the axis of the funnel. Only the bar at the front of the spiral grows, and the next bar starts when it is finished. About a third of the crystals are sparse: they cover the same area with two to three times the spacing and fewer turns, which gives a few large frames next to the dense small ones. The spacing between turns is not constant. It gets larger towards the rim by a fixed ratio, and all crystals in a round use the same ratio.
Lips, Keys and Crowns
Every part is still the same unit box, but I wanted the crystals to look less like plain bars. Real bismuth has a raised edge on every step, square meander patterns along its sides, and corners that grow faster than the faces. Each crystal randomly gets some of these three details. A lip is a thin strip along the outer edge of a bar, slightly taller than the bar. Its film is a little thinner, so it shows as a line in a different colour. A key is a square meander: the spiral path moves sideways, continues for one or two steps, and moves back. It is grown bar by bar like the rest of the spiral. A crown is a set of short posts on the corners of the outer three rings. Crystals with thick sections do not get keys.
Overall Form
The crystals have very different sizes, like in a real bismuth cluster. Large crystals get satellites, which are crystals about a fifth of their size placed on any of their corners, including corners inside the funnel. Sometimes a child crystal is as large as its parent. Such a large crystal can also become a hopper cube, the shape bismuth is best known for: a cube where every face is a funnel. I built it from the same parts. Five normal spirals start around one centre point, open outward, and use the same proportions, so their rims meet at the edges of a cube. The sixth face would point back into the crystal the cube sits on, so it is left out. A round has at most one cube, and it grows somewhere up the tower. In an earlier version the cube was the starting point, but then the piece no longer felt like it was growing upward.
Each round also has one to three invisible boxes where nothing is allowed to grow, so the cluster has to grow around them and leaves some empty space. There are only a few thin rods. They grow on rims, more often higher up, and most are short with a few very long ones. They point along the axis of their crystal, so crystals that open sideways get horizontal rods.
Colour from Film Thickness
Light reflects from the surface of the oxide film and from the metal below it, and the two reflections interfere. Which wavelengths remain depends on how thick the film is. I calculate this for three wavelengths, one each for red, green and blue, and use the result as the colour of the bar. From 0 to 360 nanometres the colours go through silver, pale gold, a dark band, blue, cyan, yellow, orange and crimson, followed by the second-order colours that bismuth is known for: blue, green, gold and magenta.
The thickness of a bar is the value at the rim, plus an amount for every ring below the rim, because the bottom of a funnel stays hot longest. A noise field adds a difference between crystals, so crystals that are close together have similar colours. The light path through the film is shorter when seen at an angle, so the colours shift slightly when the camera moves. Tempering only changes the rim value, from 6 to 262 nanometres, and the colours change as a result.
Heating with the Pointer
Since heat is what colours the metal, I made the pointer a heat source. While the pointer rests on the sculpture, the bars inside its square frame glow, and they cool down in about a second after it leaves. The film under the pointer gets thicker and stays that way, so the spot keeps a different colour until the round melts. On bare metal the colours go from pale gold to brown, violet and blue, like the temper colours around a weld. The outline of the frame fills up to show how much film was added, and the number below shows the same amount in nanometres.
Hold and Melt
The cluster keeps changing during the hold. Every eight seconds a band of heat moves from the bottom to the top. Bars inside the band get taller and their film gets thicker for a moment. Every few seconds the oldest crystal that has no children melts, and a new crystal grows in the free space. At the end of the round the whole cluster melts from the top down. A melting bar shrinks, drops a little, and its colour goes back through the sequence to silver. Then its mesh is removed from the scene.
Seeds and Rounds
The seed controls more than the positions of the crystals. It also sets the parameters of the round: the spacing of the spirals, how steep the funnels are, how many crystals are sparse, how strongly the cluster grows upward, how many plates and rods there are, and which of four film thicknesses it tempers to. As a result some rounds are tall and open and others are low and dense. The simulation runs in fixed steps of one sixtieth of a second, independent of the display's frame rate. The random numbers are therefore always used in the same order, and a seed gives the same sculpture on every computer.
Sections and the Controls
Every crystal has its own bar section: thin lines, tall fins, flat ribbons or solid steps. Two sliders scale all sections together, so the same sculpture can change between an open structure of lines and solid stepped funnels that look more like the mineral. The other folders in the panel control the growth, the oxide film in nanometres, and the form of new crystals. The accent colour of the interface also comes from the film. The progress line, the outline of the pointer frame and the active buttons use three colours taken from the rim, the middle and the bottom of a funnel, so the interface changes colour together with the sculpture.
How It Is Built
The scene has a single BoxGeometry that is shared by about 2,200 meshes. The code follows the class we wrote in the course: each object has a position, a scale, a colour and a lifespan, updates them itself, and its mesh is removed from the scene when it is done.
pos · scale · color · lifespanupdateScale()updateScale()update()
updatePosition()
updateScale()updatePosition()
updateScale()Six classes
Crystal is the spiral walker. Bar is one box that grows from a start point along one axis, ages, sets its own colour and melts. Plate (the flat part of a step), Spire (a thin rod), Lip (the raised edge) and Post (a raised corner) extend Bar and only override how they are positioned and scaled.
Never rotated
All bars are axis-aligned, so I only use position and scale, and every face always points in the same world direction. Stage 1 has no lights. I store a fixed brightness per face in the vertex colours of the shared geometry, which works as a simple replacement for a light until Stage 2.
Growing upward
Only corners on the two outer rings of a crystal can hold a new crystal, and the highest free corner is chosen, with some noise. I first scored corners by their distance to the centre axis, which packed all crystals into the bottom of the first funnel. Scoring by height produced the tower.
Automatic framing
The camera target and distance follow the bounding box of everything that has not melted, while avoiding the title, the bottom panel and the open controls. The camera starts close to the first crystal, moves back as the cluster grows, and moves down during the melt.
Technical Notes
There are two main parts: the rule that converts a thickness into a colour, and the factors that determine the thickness. The physics is simplified, and one value is exaggerated on purpose. I point out both below.
From thickness to colour
For a film of thickness d and refractive index n = 2.5, the optical path difference between the two reflections, seen at an angle γ from the axis of the crystal, is
and each colour channel is the two-beam interference term at its own wavelength:
Using three wavelengths in place of a full spectrum is the simplification. It makes the higher-order colours more saturated than in reality. κ is the exaggerated value. With the real refractive index, the path length changes by less than ten percent at grazing angles, which is almost invisible, so I made κ a slider and set it to 0.12. At 0.25 the gold of the tempered state turned yellow-green, which is how I found this value. Finally the channels are scaled to the range 0.2 to 0.88 and tinted slightly pink, which is the colour of bare bismuth.
What sets the thickness
d0 is the film thickness at the rim, g the increase per ring, and k the number of rings below the rim. v is the variation between crystals and τ the tint of the bar, which comes from its crystal and from a noise field. a is the offset of the accent crystals, and p is the contribution of the heat pulse and the slow drift. t is the age of the bar in frames and σ the oxidation rate, so a new bar starts silver and goes through the colour sequence in its first seconds. h is the amount added by the pointer. ℓ is the lifespan, which goes from one to zero during the melt and brings the colour back to silver. Tempering only changes d0, g, v and a from one preset to another.
Spacing of the turns
The walker moves on a grid of whole turns. Grid line j is at the distance
from the centre of the spiral, in units. ρ is the ratio between the spacing of one turn and the next. It is between 0.96 and 1.18 and is the same for all crystals in a round. c rescales the grid so that a crystal with N turns covers the same area as it would with even spacing. The height uses the same function, so the slope of the funnel stays constant.
The pointer
I do not use a raycaster. Every frame, the position of each bar is projected to screen space and compared with the position of the pointer frame:
with r = 0.9 nm per frame, R = 48 pixels, and s the value of the touch slider. The distance is the larger of the horizontal and vertical offsets, so the heated area is a square. The glow uses the same falloff and fades by 3.5 percent per frame.
Depth
Where two bars meet, the end of one bar sits slightly inside the side of the other. The template camera has its near plane at 0.1. At a viewing distance of about a thousand units the depth buffer could not separate these faces, and the joints flickered. Setting the near plane to 20 fixed it. For the same view, moving the camera by a hundredth of a unit changed the colour of 2050 pixels before the fix and 19 pixels after it.
Process
- I considered three subjects: scaffolding around a building that does not exist, a figure that forms out of drifting blocks, and bismuth. I chose bismuth because its growth rule is simple and its colour has a physical explanation.
- The first version worked but did not look right. All hues appeared at once, the walls were solid, and the cluster was flat. I narrowed the range of the film thickness, changed the walls to open frames, and gave each face a fixed brightness so the form is readable without lights.
- The cluster did not grow upward. It did once I allowed new crystals only on rim corners and always picked the highest free corner.
- I gave the colour a time structure: grow bare, temper, hold, melt. In the same round of changes I added the large sparse crystals, the gradient background and the slow drift of the film thickness.
- It became monotonous when I watched it for a long time, so every crystal got its own proportions, depth and section, and every round got its own parameters and its own final palette.
- The same seed did not always give the same sculpture, because the simulation depended on the frame rate. It now runs in fixed steps. I also scramble the seed first, because p5's random generator returns similar numbers for seeds that are close together.
- I made the pointer a heat source. At first its effect was hard to see while the whole piece was changing colour, so I added a separate glow, and the thicker film is what remains afterwards.
- Then I worked on the interface: a square pointer with a gauge, buttons that show the current state, and an accent colour taken from the film.
- The crystals still looked like plain boxes. Lips, keys and crowns added detail to each crystal. Satellites, giants, empty boxes and a shared spacing ratio improved the overall form.
- In one version every round started from a cube. It was easy to recognise as bismuth, but the piece no longer felt like it was growing upward. The first crystal is a single funnel again, and the cube now appears higher up.
Reflections
As with APERTURE, starting from a physical rule helped me most with the design. After I decided that colour depends only on film thickness, the questions about palette, timing and interaction all came down to what changes the thickness. Growth, tempering, heat pulses, the pointer and melting all work through that one value.
Stage 2 is about light and shadow. I expect the open frames to cast more detailed shadows than the solid version. The fixed brightness per face will be replaced by real lights.