Parametric shapes
Starting from the obvious…
SDF ray marching
open full size ↗Each shape above is defined by a signed distance function taken from Inigo Quilez’s website.
A signed distance function \(f(\mathbf{p})\) takes a point \(\mathbf{p}\) in space and returns how far it is from the nearest surface of a shape — positive outside, negative inside, zero exactly on the surface. That sign is what makes it “signed.”
A sphere of radius \(r\) centered at the origin is the cleanest example. The distance from any point \(\mathbf{p}\) to the sphere’s surface is simply how far \(\mathbf{p}\) is from the origin, minus the radius:
To render these shapes, the fragment shader uses ray marching: a ray is cast from the camera through each pixel. At each step along the ray, the SDF is evaluated to find the distance to the nearest surface. That distance is safe to advance — stepping that far in any direction can’t overshoot the surface. This continues until the distance is nearly zero (a hit) or the ray travels too far (a miss). No mesh, no rasterization — just a function queried repeatedly until the surface is found.
Or Platonic solids…
Platonic duals
open full size ↗The five Platonic solids are the only convex polyhedra where every face is the same regular polygon and every vertex joins the same number of faces. Each has a dual, formed by placing a new vertex at the centre of every face and connecting adjacent face-centres with new edges.
The swap is exact. The cube has 6 faces and 8 vertices; its dual, the octahedron, has 6 vertices and 8 faces. Both share 12 edges. The tetrahedron is its own dual — its four face-centres form a second tetrahedron pointing the opposite way. The dodecahedron and icosahedron are duals of each other, exchanging 12 and 20 throughout.
Or we can move beyond choosing from pre-defined shapes, toward geometry born function-first — defined entirely by continuous, differentiable equations — which feels more true to our rules.
Scalar fields
open full size ↗A scalar field assigns a single number to every point in space — temperature, pressure, elevation. The shapes above are level sets of scalar fields: the set of all points where the field equals a fixed value. Written as an equation, that is \(F(x, y, z) = 0\), where \(F\) is the field function.
Quadric surfaces. When one or two of the variables appear squared (or multiplied together), the resulting surfaces are called quadric surfaces — the 3D cousins of the conic sections you draw in 2D. The elliptic paraboloid \(y = x^2 + z^2\) is a bowl: horizontal cross-sections are circles, vertical ones are parabolas. Flip one sign and you get the hyperbolic paraboloid \(y = x^2 - z^2\) — a saddle that curves up in one direction and down in the other, popular in architecture because it can be built from straight beams. The cone \(y^2 = x^2 + z^2\) is the boundary case between them. 変数のうち1つまたは2つが2乗(あるいは積)の形で現れるとき、その式が定める曲面は二次曲面と呼ばれ、これは2Dで描く円錐曲線の3D版にあたります。楕円放物面 \(y = x^2 + z^2\) はボウル状で、水平断面は円、垂直断面は放物線になります。符号を1つ反転させると、双曲放物面 \(y = x^2 - z^2\) になります。一方向には上に、もう一方向には下に反るサドル状の曲面で、直線の梁から構成できるため建築でよく使われます。円錐 \(y^2 = x^2 + z^2\) は、その境界にあたります。
Higher-degree surfaces. Higher-degree polynomials produce richer geometry. The monkey saddle \(y = x^3 - 3xz^2\) has three valleys meeting at the origin — enough room for two legs and a tail. The torus and hyperboloid come from quadratics involving a square root, encoding the distance to a circle rather than a point. 次数の高い多項式は、より複雑な形状を生み出します。モンキーサドル \(y = x^3 - 3xz^2\) は、原点で3つの谷が交わる形をしており、脚2本と尻尾を置くのにちょうどよいスペースがあります。トーラスや双曲面は平方根を含む2次式から生まれ、点ではなく円までの距離を符号化しています。
These surfaces are rendered the same way as the SDF demo — a ray is cast per pixel and marched through space — but without a true distance field to guide the step size. Instead, the shader takes uniform small steps and watches for a sign change in \(F\), meaning the ray has crossed the surface. A short binary search then pins down the exact crossing point.
Moving scalar fields
open full size ↗Each surface below has one or more parameters that change continuously with time — a radius that breathes, a phase that advances, a threshold that slides. The shape is still the zero set of a function \(F(x,y,z,t) = 0\), but now \(t\) is part of the equation, not just the camera rotation. The marcher re-evaluates the full field every frame.
Shape index
\(y = e^{-r} \cos(5r - 2t)\), \(r = \sqrt{x^2+z^2}\). A damped standing wave whose phase \(2t\) advances with time, so the crests travel outward from the origin. The exponential envelope \(e^{-r}\) kills the oscillation at large radius, keeping the shape compact. 減衰する定在波で、位相 \(2t\) が時間とともに進むため、波の山が原点から外側へ移動していくように見えます。また、指数関数の包絡線 \(e^{-r}\) が半径の大きい領域で振動を抑えることで、シェイプ全体はコンパクトに保たれます。
\((\sqrt{x^2+z^2} - R(t))^2 + y^2 = r_t(\theta,t)^2\). The major radius \(R\) breathes with two beating frequencies. The tube radius \(r_t\) varies around the ring: two azimuthal waves — one with three lobes, one with seven — travel in opposite directions, creating a surface that writhes and shifts without any single repeating pattern. 主半径 \(R\) は、2つの周波数が重なり合うことで複雑に呼吸するように変化します。管の半径 \(r_t\) はリングに沿って変化し、3つの山を持つ波と7つの山を持つ波が互いに逆方向へ進むことで、単純な繰り返しパターンを持たない、うねり動く曲面が生まれます。
\(y = \sin(2x + t)\cos(2z + 0.7t)\). A product of two traveling sinusoids, one in \(x\) and one in \(z\), each with its own phase velocity. Their product creates a grid of crests that drift diagonally across the plane. Where one factor is near zero the surface flattens into a node line; where both peak the surface rises to a local maximum. \(x\)と\(z\)でそれぞれ独自の位相速度を持つ、2つの進行正弦波の積です。この積によって、平面を斜めに横切るように移動する山の格子模様が生まれます。片方の因子がゼロに近いところでは曲面は節に沿って平らになり、両方がピークを迎えるところでは局所的な最大値まで盛り上がります。
\(|p| = r_0 + A(t),P_2(\cos\theta)\). Rather than inflating uniformly, the radius varies with the second Legendre polynomial \(P_2\), which is positive at the poles and negative at the equator. The surface alternates between a prolate (tall) and oblate (flat) ellipsoid, with \(A(t)\) driven by two incommensurate frequencies so the oscillation never simply repeats. 半径は一様に膨らむのではなく、第2ルジャンドル多項式 \(P_2\) に従って変化します。これは極で正、赤道で負の値を取ります。曲面は長楕円体(縦長)と扁平楕円体(横長)の間を行き来し、\(A(t)\) は比が整数にならない2つの周波数で動くため、振動が同じパターンを繰り返すことはありません。
\(y = A(t)(x^2 - z^2)\), \(A(t) = 0.70 + 0.30\sin(0.75t)\). A hyperbolic paraboloid — the standard architectural saddle — whose curvature amplitude breathes. When \(A\) is large the surface curves sharply; when it nears zero the sheet flattens to the \(xz\)-plane before curving back the other way. 双曲放物面では、曲率の振幅 \(A\) が0.40から1.00の間で呼吸するように変化します。\(A\) が大きいとき曲面は鋭く反り、小さくなるほど反りがゆるやかになり、そしてまた鋭くなる、という変化を繰り返します。
\(\cos(kx)\sin(ky) + \cos(ky)\sin(kz) + \cos(kz)\sin(kx) = 0\), \(k(t) = 1.45 + 0.42\sin(0.5t)\). A triply periodic minimal surface: its mean curvature is zero everywhere, like a soap film. Scaling \(k\) stretches the repeating cell — a larger \(k\) packs the tunnels closer together, a smaller \(k\) opens them up. The gyroid has no straight lines and no mirror planes. 三重周期極小曲面で、シャボン膜のようにどの点でも平均曲率がゼロになります。\(k\) を変化させると繰り返しセルが伸縮します。\(k\) が大きいほどトンネルが密に詰まり、小さいほど広がります。ジャイロイドには直線も鏡映面も存在しません。
\(\cos 2x + \cos 2y + \cos 2z = c(t)\), \(c(t) = 0.88\sin(0.55t)\). Another triply periodic minimal surface at \(c = 0\). Moving the threshold \(c\) away from zero breaks the equal area balance between the two labyrinthine regions the surface divides space into — one inflates as the other shrinks. At \(c = \pm 3\) the surface degenerates to three sets of parallel planes. \(c = 0\) におけるもう1つの三重周期極小曲面です。閾値 \(c\) をゼロから動かすと、曲面が空間を分割する2つの迷路状の領域の面積バランスが崩れ、一方が膨らむと同時にもう一方が縮みます。\(c = \pm 3\) では曲面は3組の平行な平面へと退化します。
\((x^2+y^2+z^2)^2 = a(t)^2(x^2 - z^2)\). The 3D analogue of the figure-eight lemniscate of Bernoulli. The right side \(a^2(x^2-z^2)\) is positive in the \(x\)-dominant quadrants and negative in the \(z\)-dominant ones, so the surface has two lobes along \(x\) and a pinch at the origin. As \(a\) oscillates the lobes expand and contract. ベルヌーイのレムニスケート(8の字曲線)の3D版です。右辺 \(a^2(x^2-z^2)\) は、\(x\) が優勢な象限で正、\(z\) が優勢な象限で負になるため、曲面は \(x\) 方向に2つの葉を持ち、原点でくびれます。\(a\) が振動するにつれて、葉が伸縮します。
\(x’^2/a^2 + y’^2/b^2 + z’^2/c^2 = 1\), with \((x’, y’)\) rotated by \(\phi(t)\). The ellipsoid is elongated along its \(y\)-axis. That long axis slowly tilts back and forth by rotating the coordinate frame before computing the surface — so the shape sways as a whole while the three semi-axes continue to breathe. The tilt and the breathing run at incommensurate rates, so the motion never locks into a periodic cycle. \(y\)軸方向に伸びた楕円体です。曲面を計算する前に座標系を回転させることで、その長軸がゆっくりと前後に傾きます。シェイプ全体が揺れながら、3つの半軸も呼吸するように変化し続けます。傾きのリズムと呼吸のリズムが噛み合わないため、動きが周期的なサイクルに収束することはありません。
\(x^4 - 5x^2 + y^4 - 5y^2 + z^4 - 5z^2 + c(t) = 0\). A degree-4 algebraic surface named for the tangle of its topology. The function \(u^4 - 5u^2\) has two valleys (minima) at \(u = \pm\sqrt{5/2} \approx \pm 1.58\) separated by a local maximum at the origin. Sliding \(c\) controls which of the eight octant-centred lobes are present and whether they are connected. トポロジーの絡み合い(tangle)にちなんで名付けられた4次代数曲面です。関数 \(u^4 - 5u^2\) は \(u = \pm\sqrt{5/2} \approx \pm 1.58\) に2つの谷(極小値)を持ち、その間の原点に局所的な極大値があります。\(c\) をスライドさせると、8つの象限中心の葉のうちどれが現れるか、またそれらがつながっているかが変わります。
\(T_4(sx) + T_4(sy) + T_4(sz) = 0\), \(T_4(u) = 8u^4 - 8u^2 + 1\) (the 4th Chebyshev polynomial), \(s(t)\) oscillates. This degree-4 surface has exactly 12 ordinary double points — one at the midpoint of each edge of a cube — which is the maximum for a degree-4 surface (the Kummer-type bound). Scaling \(s\) morphs it between an angular multi-lobed form and a smoother rounder one. この4次曲面は、立方体の各辺の中点にあたる位置にちょうど12個の通常二重点を持ち、これは4次曲面として可能な最大数(クンマー型の上限)にあたります。\(s\) を変化させると、角ばった多葉の形と、より滑らかで丸みを帯びた形の間を変化します。
\(x^2 + z^2 = (y + A\sin(4y - t))^2\). A cone \(x^2+z^2 = y^2\) with the axial coordinate deformed by a sinusoidal ripple whose phase \(t\) advances upward. This compresses and expands alternating bands of the cone, creating travelling pinch-points that climb the axis. 円錐 \(x^2+z^2 = y^2\) の軸方向の座標を、位相 \(t\) が上向きに進む正弦波状のさざ波で変形させたものです。これにより円錐の帯が交互に圧縮・拡張され、軸に沿って上昇していくくびれが生まれます。
\(y = A(t),e^{-r^2/\sigma(t)^2}\), \(r = \sqrt{x^2+z^2}\). A radially symmetric bump whose height \(A\) and width \(\sigma\) oscillate at different rates. When \(\sigma\) is small the bump is a sharp spike; when large it is a broad shallow mound. Because \(A\) and \(\sigma\) beat against each other, the bump never simply repeats. 放射対称の盛り上がりで、高さ \(A\) と幅 \(\sigma\) が異なる速度で振動します。\(\sigma\) が小さいときは鋭いスパイク状になり、大きいときは緩やかで広い丘になります。\(A\) と \(\sigma\) がそれぞれ異なるリズムで揺れるため、盛り上がりの動きが単純に繰り返されることはありません。
\(\cos 2x,\cos 2y + \cos 2y,\cos 2z + \cos 2z,\cos 2x = c(t)\). Like the Schwartz P, this is a triply periodic surface — but from a different symmetry family. The I-WP surface divides space into two regions with different connectivities (one is simply connected, the other is multiply connected). Sliding \(c\) morphs between the balanced minimal surface and thickened or thinned versions of its two labyrinths. シュワルツP曲面と同様、三重周期曲面ですが、対称性の系統が異なります。I-WP曲面は空間を連結性の異なる2つの領域に分けます(一方は単連結、もう一方は多重連結)。\(c\) をスライドさせると、バランスの取れた極小曲面と、2つの迷路構造がそれぞれ太くなったり細くなったりしたバージョンの間を変化します。
\(y = x^2 - z^2 + A(t),xz\). The term \(x^2-z^2\) is a saddle with principal curvatures along \(x\) and \(z\). Adding \(A,xz\) rotates the curvature axes in the \(xz\)-plane — when \(A = \pm 2\) the axes have rotated \(45°\). As \(A\) oscillates the saddle continuously spins its principal directions. 項 \(x^2-z^2\) は、\(x\) と \(z\) 方向に主曲率を持つサドルです。\(A,xz\) を加えることで、\(xz\) 平面内で曲率軸が回転します。\(A\) が振動するにつれて、サドルの主方向が連続的に回転し続けます。
Tube radius \(r(\theta, t) = r_0 + \varepsilon\sin(4\theta - t)\). A standard torus has uniform tube radius. Here the tube is pinched and bulged four times as you go around the ring (\(n = 4\) in the sinusoid), and the pattern rotates with time. The resulting surface has four bulges chasing each other in a circle. 通常のトーラスは管の半径が一定ですが、ここではリングを一周する間に管が4回すぼまり膨らむ(正弦波の \(n = 4\))よう変形しており、このパターンが時間とともに回転します。結果として、4つの膨らみが円を描くように互いを追いかける曲面になります。
\(|p| = 1 + A\sin(3\lambda - t)\sin(2\varphi)\), where \(\lambda\) is longitude and \(\varphi\) is latitude. A sphere with a spherical-harmonic-like bump pattern that rotates about the polar axis. The \(\sin 2\varphi\) factor makes the bumps zero at the poles and maximum at mid-latitudes; the \(\sin 3\lambda\) gives three bumps per latitude circle. 球面調和関数のような盛り上がりパターンを持ち、極軸を中心に回転する球です。\(\sin 2\varphi\) の項により、極では盛り上がりがゼロ、中緯度で最大になります。\(\sin 3\lambda\) の項により、緯度円1周につき3つの盛り上がりが生まれます。
\(x^2(1 + A\sin(2.8y - t)) + z^2 - y^2 = 0.40\). A one-sheet hyperboloid \(x^2+z^2-y^2 = c\) has circular cross-sections. Here the \(x^2\) coefficient is modulated by a sinusoid that travels along \(y\), squeezing the cross-section alternately into an ellipse in \(x\) and a circle, producing a surface that looks like a hyperboloid with standing waves pressed into it. 一葉双曲面 \(x^2+z^2-y^2 = c\) は円形の断面を持ちます。ここでは \(x^2\) の係数が \(y\) 方向に進む正弦波で変調されており、断面が交互に \(x\) 方向の楕円と円に押しつぶされます。結果として、定在波が刻み込まれたような双曲面になります。
\(x^2 y + y^2 z + z^2 x = A(t)\). A cyclic cubic: the monomials \(x^2 y, y^2 z, z^2 x\) are related by the cyclic permutation \((x, y, z) \to (y, z, x)\). This gives the surface a 3-fold rotational symmetry about \((1,1,1)\). As \(A\) oscillates the surface swells and tightens around the symmetry axis. 巡回的な3次式:単項式 \(x^2 y, y^2 z, z^2 x\) は巡回置換 \((x, y, z) \to (y, z, x)\) によって互いに関係しています。これにより曲面は \((1,1,1)\) を軸とする3回対称性を持ちます。\(A\) が振動するにつれて、曲面は対称軸のまわりで膨らんだり締まったりします。
\(y = \sin(t),x^2 + \cos(t + \varphi),z^2\). As \(t\) advances, \(a = \sin(t)\) and \(b = \cos(t+\varphi)\) independently sweep through positive and negative values. The surface cycles through four qualitatively different states: elliptic paraboloid (bowl), hyperbolic paraboloid (saddle), inverted bowl, and saddle again — passing through a degenerate parabolic cylinder each time one coefficient crosses zero. \(t\) が進むにつれて、\(a = \sin(t)\) と \(b = \cos(t+\varphi)\) がそれぞれ正負の値を行き来します。曲面は4つの質的に異なる状態、楕円放物面(ボウル)、双曲放物面(サドル)、逆さのボウル、再びサドルを周期的に巡ります。係数のどちらかがゼロを横切るたびに、一瞬だけ平らな放物柱面を通り過ぎます。
Scalar field blend
open full size ↗Pick any two surfaces from the full catalogue — static or moving — and drag the slider between them. At every point in space the shader evaluates both field functions and linearly interpolates the result: \(F_{\text{blend}}(p) = (1-t)\,F_A(p) + t\,F_B(p)\). The zero set of this blended field is a new surface that continuously deforms from one to the other as \(t\) goes from 0 to 1.