Repository navigation
This release adds a pen and lines drawn by hand, soft bodies that touch what is around them, a layer a sketch can read back, and a sketch that floats over the desktop. Small dots and thin lines now lay exactly their own ink, and lit 3D that traces nothing is about ten times faster on an M1 or M2. A few looks and defaults moved, so read Changed before you update.
Added
Drawing
- A pen.
strokeMedium(.ink(feather:pooling:amount:speed:seed:))draws ink from a nib. It feathers into the paper where the hand slows, pools at each end, skips when the pen hurries, and darkens where strokes cross. A recorded mark keeps each point's pace inStrokeMark.Sample.speed. Marks - Lines drawn by hand.
handDrawn(wobble:bow:overshoot:seed:)on aContour, aShape, or aStrokeMarkreturns the same line with a hand's wobble, bow, and uneven ends. It is seeded, so a line that moves keeps its character. Marks - A layer read back.
RenderTarget.snapshot()returns a layer's pixels as anImage, one frame late. Anything that reads a picture can now read what the sketch draws. Effects - A slit scan on the GPU.
makeLayerHistory(capacity:)keeps a layer's last frames, andFilter.slitScan(_:delay:)builds each pixel from the frame its delay names. Effects - A glyph mosaic of a layer.
drawGlyphMosaicandglyphMosaic(of:)take a layer'simage, so a moving drawing can be set as text. Glyph mosaic - An accumulator in single precision.
makeAccumulator(precision: .float32)keeps the very faint marks a half-float pass drops, at twice the memory. Accumulation
3D
- A camera for each layer. A camera set inside a layer's
withTargetblock belongs to that layer, so one frame can show a 3D world from several places. 3D - Finishes keep their look in a path-traced export.
--path-tracednow draws the stylized finishes as the window does:.toon,.gooch,.iridescent,.glitter,.jade,.velvet,.hologram, and the standard highlights. The clearcoat, the fabric sheen, the brushed streak, and scattering under the surface still trace as their base. Path-traced export - Maps show in a traced reflection. With
rayTracedReflections()on, a mirror shows a surface's normal, roughness, and occlusion maps, and a fine picture seen small in a mirror no longer shimmers. 3D - Light that bounces inside a volume.
Medium.bounce, from 0 to 1, lets a thick cloud glow from inside and shine through at its thin edges. Volumes - Fog veils volumes. Under
fogoraerialPerspective, a volume is fogged like the solids around it. Volumes - A flat field stood up.
extruded(depth:)turns any 2DSDFcomposition into anSDF3Dslab that joins other 3D fields, casts shadows, and voxelizes. Combinators - Gesture marks in space.
GestureMark.tube(sides:wobble:wavelength:)turns a drawn gesture into a mesh, andGestureMark.solids(spacing:seed:)strings instances along it. Gesture marks - A layer as an environment. A
RenderTargetis aVideoFeed, soenvironment(.feed(layer))lights a scene with the sketch's own drawing. 3D - A sample 3D model.
import OllinSampleModels, andSampleModel.duck.load()gives a sketch a model to try materials, lights, and camera moves on. Sample models
Geometry and simulation
- Finding boxes.
BoundsIndexanswers which of thousands of rectangles hold a point, overlap a rectangle, or overlap each other.Rectanglegainsintersects(_:),intersection(_:), andunion(_:), andBox3gainsintersects(_:). Bounds index - Neighbors in space.
SpatialIndex3DisSpatialIndexforVector3: the nearest point, the k nearest, everything within a radius, and everything inside aBox3. Spatial index - Matching two sets at the least total cost.
Matching.optimal(_:_:cost:)pairs two sets so the costs add up to the least possible. A cloud of dots gathers into letters along paths that never cross.Matching.greedyis the quick comparison. Matching - Soft bodies that rub, meet rigid bodies, and fold. A 2D
SoftBodyhasfriction, and it pushes and is pushed by a rigidBody. WithcollidesWithItself: true, a long outline folds onto itself and no longer passes through. Physics
Sound
- An echo long enough to be a loop.
Delay.timeruns to sixty seconds (Delay.maxTime). Each repeat lands on its exact sample, and turningtimewhile the echo sounds no longer clicks. Synthesis - The sketch's sound as a file of its own.
--export-sequencewritessoundtrack.wavbeside its frames, and--export-audio FILE(OllinApp.exportAudio) writes the sound alone. A--skipstretch is now dropped from the sound too. Synthesis
Windows
- A sketch over the desktop.
--overlay, orOllinApp.runAsOverlay { MySketch() }, floats a sketch above every window. Where the canvas is clear (background(.clear)) the desktop shows through, and a click there goes to whatever is underneath. Overlay - A second window for a layer.
makeWindow(showing:title:)gives a layer a window of its own: the piece on the projector and the controls on the laptop. The returnedSketchWindowreports its own pointer. Windows
Parameters and the live window
- Undo in the inspector. ⌘Z puts back a parameter you turned by hand and ⇧⌘Z brings it forward, in every host. One gesture is one step, and a reset is one step. Parameters
- Long menus fold into submenus. A
ParamChoicestype that declaresparamChoiceGroupsgets a submenu for each group.Easingdeclares its families, so a curve's menu is twelve rows instead of thirty-two. Parameters - A description on a parameter.
help:on any@Paramis a sentence about it. The inspector shows it on hover and--list-paramsprints it. Parameters - The rest of a package in the live window. A sketch that imports a library target of its own package, or another Swift package, now runs under
ollin, OllinLive, and OllinLiveCoding. Saving the library rebuilds it and reloads the sketch. A target with C code, a macro, or a binary is refused by name. Single-file sketches - A failed frame names its pass. When the GPU throws a frame away, the error now ends with the pass the failure began in.
- Traced shadows can be switched off on one Mac. With
OLLIN_NO_TRACED_SHADOWS=1in the environment, point lights and panels cast through shadow maps. It is for a Mac whose GPU misbehaves on traced shadows. 3D
Connections
- A listener says why its port would not open.
lastErroronOSCReceiver,TUIOReceiver,DMXReceiver, andEtherDreamFindernames the port another program holds.isRunningturns false, where such a receiver used to read as running, andstart()tries again. - A publisher says where it is in its life.
phaseonSyphonServer,VirtualCameraServer, andPhoneScreenis onePublisherPhase:.waiting,.publishing,.unavailable, or.stopped.SessionRecorder.lastErrorsays why a take's file could not be finished.
Examples
- Carlos Cruz-Diez joins the recreations.
Examples/Recreations/CarlosCruzDiezhasPhysichromie, a panel of blades whose picture depends on where the pointer stands, andChromosaturation, three rooms of colored light the eye adapts to. - Eduardo Terrazas joins the recreations.
Examples/Recreations/EduardoTerrazashasCosmos, his structure laid as a tabla of wool yarn, andPosibilidades, a sheet of small drawings that each change the same diagram one way. - A second visit to Hiroshi Kawano.
Examples/Recreations/HiroshiKawanogainsSimulatedColorMosaicandFlow. Both follow the procedure he described: a chain counts how the cells of a few hand-drawn pictures sit together, then writes more like them. - Ten examples for the features above.
Shapes/InkPen,Effects/ScannedByItself,Patterns/GatherIntoLetters,Physics/SoftBodiesMeet,3D/Raymarching/StandingField,3D/Geometry/GestureMarks3D,Audio/Loop,Audio/Drive,Installation/OverDesktop, andInstallation/SecondView.
Changed
Each of these can change what a sketch draws, sounds like, or accepts.
- Small dots and thin lines are a little lighter. A dot a few pixels across or a line under a pixel wide used to lay more ink than its size, and now lays exactly its own. If a sketch looks thinner, raise the size or the
strokeWeightslightly. Such marks take 7 to 18% more GPU time. Drawing - A simulation seeded by drawing runs to a different picture. A shape drawn into a field covers its edge a little differently now, so a rule that amplifies its start (Lenia, reaction-diffusion, a sandpile) ends up somewhere else. The same sketch still repeats from run to run.
- Blend modes keep alpha as coverage.
.addno longer pushes a layer's alpha past 1, so added lights drawn back over a picture do not turn it black..multiply,.darkest, and.subtractadd no coverage, so in an empty layer they leave nothing. To darken the canvas with a layer, set the mode when drawing it back. Drawing - A see-through
backgroundis weighted by its alpha. A window shows a clear canvas over black, so such a background is darker there than it was. For trails, keep the canvas withnoClear()and paint a see-through rectangle each frame. - The five distortion characters do what their names say.
.softClip,.overdrive,.bitCrush,.ring, and.squeezewere presets of the system's unit, and none matched its name. Each is now a curve of Ollin's own and sounds different. If you used.softClipfor its echo, add aDelay(time: 0.357)beside it. Synthesis - A camera set inside a layer stays in the layer.
camera(_:)insidewithTargetused to replace the canvas's camera too. If a sketch relied on that, set the camera on the canvas as well. - Volumes glow from inside by default.
bounceis on, so every medium is brighter in its depths. Setbounce: 0for the old picture. - The ground under a sun-lit sky is lit by the sun. Below the horizon of a
.skywhose sun lights the scene, faces turned down are brighter, and the scene reads a little darker overall because the exposure counts that ground. 3D - The sun's light follows the clouds. Under a cloudscape the scene gets the whole beam while the sun stands in a gap and next to nothing behind a thick cloud. 3D
- A 2D soft body rubs and stops rigid bodies by default.
frictionis 0.3 unless you give one, so passfriction: 0for the old slide. Rigid bodies no longer pass through. --paramrefuses a value the parameter cannot hold. A value past the range or off the step used to land silently on the nearest one. The run now stops and names the nearest value. Export- The live hosts' status chip says what stopped the sketch. It reads "Compile error", "setup() failed", or "Shader error", and "Plain build" when the optimized build failed behind the plain one. Live coding
ollin api <Type>prints each case's comment. The members of an enum now carry their documentation in the list. The reference offline- Molnár's Interruptions is redrawn from a plate. The recreation's numbers are now measured off the plotter drawing the Victoria and Albert Museum holds (E.269-2011): 56 lines a side, a lean toward the vertical, and small patches of missing lines.
Examples/Recreations/VeraMolnar/Interruptions
Fixed
Drawing
- Tiny moving dots no longer flicker. A dot under a few pixels across laid ink that depended on where it fell on the pixel grid, and none at all near a pixel's corner. Its ink is now its area wherever it lands, for GPU particles too. Drawing
- A diagonal hatch reads one even tone. A line's ink changed with its angle and its place on the grid, which showed as bands. It is now the line's width everywhere. The outline of a built-in shape (the
strokeon adrawCircleor adrawRect) is unchanged for now. - A line drawn into a coarse layer keeps its ink. A hatch of thin lines drawn into a half-scale layer or a simulation field came out as broken dashes.
- See-through shapes blend by their alpha under
.multiply,.screen,.lightest, and.darkest. These four took a shape's color whole, so a half-clear multiply read too bright and a soft edge left a ring. - A transparent PNG of added light matches the window. A pile of
.addmarks over a clear canvas stored one mark's color. An EXR still keeps light and coverage apart. - A folded outline never takes the window down. A closed
curveThroughring that crossed itself hundreds of times hit an assertion in the fill and ended the window. It now returns a fill. - A chamfer, stairs, or columns scope holds a negative radius at zero.
chamferUnion(radius:)and its eight siblings now draw what the same operators on anSDFvalue draw. SlitScannames its own method. The note it prints for a skipped frame saidpush, and the method isappend.
3D
- Lit 3D is about ten times faster on an M1 or M2. Every lit shader carried the ray tracer, whether the frame traced or not. A lit mesh filling the frame took 43 ms on an M2 and takes 3.9. A frame that does trace is as slow as before. Combinators
- A traced shadow or a field of blocks could restart the GPU. On a Mac that traces rays in software, a shadow from a point light or a panel, or a
voxelizedfield, could freeze the screen. Both causes are fixed, though a heavy field under a traced shadow can still fail there. - The live window carries on after a GPU hang. It used to show its last finished frame for good. The frame loop also holds while the Mac sleeps.
- A glowing surface glows in a traced reflection. A mirror showed a surface with an
emissiveColororMesh.glowing(_:)as its unlit body. - A marched field drawn in a layer showed on the canvas too. It happened when the canvas marched its own
drawSDF3Dfields at reduced resolution. The canvas now draws its own fields alone. - A mesh field in a layer is culled through the layer's own view. A
MeshFieldin a layer of another shape lost copies at its sides. Instancing - A textured OBJ drew its texture upside down. The reader now flips
vtas it reads, as the USD reader already did. 3D
Sound and simulation
- A blown tube holds its pitch however hard it is blown. Near the top of its range the breath pulled the pitch up to 36 cents sharp. Every preset now stays within five cents from A2 to C7, and the highest notes are a little purer. Synthesis
- A simulation takes a negative seed.
makeEvolution,makeParticleLife, andmakeParticleLeniacrashed on any seed below zero. - A face's strongest expressions come in one order in every run.
PhoneFace.strongestBlendShapes()listed two shapes at the same value in a different order from run to run.
Parameters and the live hosts
- A stepped parameter holds the decimal its step names. Declared
0.1...2, step: 0.01, a parameter showing 1.5 held 1.5000000000000002, so--param zoom=1.5was refused. A sketch that amplifies tiny differences can draw a different picture for the same seed. --list-paramssays the step of a whole-number parameter.8...128, step: 8now prints8...128, by 8.- The Colors panel no longer opens over the inspector. When it comes up over the parameters list it is moved beside the window.
- A reset under a held clock shows. With the timeline holding the clock, putting a parameter back changed the value and drew nothing.
- A package's sketch compiles every file of its target in the live window. A manifest that excluded one file made the live compile skip the files after it. A target that uses the
packageaccess level compiles there too. - OllinLive keeps a shader error up until the shader is fixed. Saving a
.metalfile with the same mistake cleared the error and never brought it back. - A recovery offer in OllinLiveCoding could be lost, or restored into the wrong sketch. The offer now survives the launch, and opening another document withdraws it. Live coding
- Letting go of Command during a drag on the stage left the editor ignoring clicks. The drag now stands down when it ends.
Connections and installations
- A piece with opening hours kept the display awake all night. Two holds on the display were taken and only one released. There is one hold now, and the dark hours release it. Installation
- A take started right after
stop()can be stopped. A second take begun before the last file closed ran on withisRecordingtrue. Each take is its own file now. Recording - A stopped Syphon server or virtual camera stays stopped.
stop()released the server and the next frame stood it back up. - An MQTT client with
reconnects: falsecan connect again. After a drop,connect()returned without dialing. MQTT - A laser whose interlock tripped can be armed again. It used to stay dark until a restart.
hasStopConditionandlastErrorsay the DAC is stopped. Nothing restarts by itself:arm()clears the stop, throughEtherDreamDAC.clearStopCondition(). Laser - A web socket a server closes says so.
PushFeed.problemnow reads the close code and the server's reason. Live data - A rebuilt Ollin Camera replaces the installed one. The app's version lives in one place now, and its README says when to raise it. Virtual camera