Implicit Surfaces (Ray Marching) |
← Geodesic Flow & Non-Euclidean Geometries · Contents · Rendering & Textures →
In addition to parametric surfaces, Surface Explorer 4D supports Implicit Surfaces defined by mathematical equations in the form of f(x, y, z) = 0 (e.g., x^2 + y^2 + z^2 = 1). These are rendered using an advanced graphics technique called Ray Marching.
The two sub-tabs: 3D and Cross Section |
The Implicit tab holds two sub-tabs, each with its own equation editor:
x, y, z. This is what the rest of this page describes.x, y, z, p. The surface it defines lives in 4D space, and what you see on screen is the three-dimensional slice the camera cuts through it.Switching sub-tab loads that sub-tab's default surface and resets the controls the two share — spatial limits, constants, Step Relax and Ray Steps — because they belong to the surface you were looking at, not to the new one. Clicking the sub-tab you are already on reloads its default surface, which is the quickest way back to a known state.
Cross Section: slicing a 4D surface |
Write an equation in x, y, z, p and the app renders the slice of it that lies in the observer's three-dimensional space. Two groups of controls decide which slice:
The 4D camera path works here too, so the slicing plane can be flown along a trajectory instead of moved by hand.
The surface that opens with the sub-tab is the 3-torus (a torus of tori), the 4D analogue of the ordinary torus. Sliders A, B and C are its outer, middle and tube radii; it needs A > B > C to stay non-degenerate.
Why the fourth variable is optional: the two sub-tabs keep separate equations on purpose. An equation in x, y, z alone behaves in Cross Section exactly as it does in 3D — no slicing happens because nothing depends on p. The variable p exists only in this sub-tab's editor, so an equation written for the 3D one can never accidentally refer to it.
How it Works |
Instead of generating a grid of polygons (vertices and faces) on the CPU, the Ray Marching engine shoots rays from the virtual camera into the 3D space to find the exact point where the mathematical formula equals zero. This allows for mathematically perfect curves, infinite repeating structures, and complex boolean operations (additions, subtractions, and intersections of shapes) that would be impossible with standard geometry.
Key Settings |
x, y, z. Example: x^2 + y^2 + z^2 - 1.0 = 0.0 (the = 0.0 part is handled automatically if you omit it).Slider F: relief density). Textures written in the Shadertoy form (mainImage()) are the one place the constants cannot be reached. The seven sliders are one set shared by the surface, its texture and the background, so a letter claimed here may already mean something else in the same scene; the app says so when it happens, and lets you apply anyway or pick a free letter — see the Scripting Guide.0.1 * (…)) used to get a wall tens of times thicker than the ones written at natural scale, and they now start out thinner than before — if one looks too delicate, raise this slider. The value travels with the surface when you save it.Where a cut surface gets its lid. When the spatial limits cut through the object, the flat disc that closes the cut is not part of your equation: it is the face of the cutting box, drawn where the box passes through the surface. What the marcher renders is the boundary of the intersection between the two, and that boundary has two pieces — the curved part of your surface inside the box, and the part of the box inside your surface. This is why a cut sphere looks capped rather than open, and why, if you move the camera inside it, you find the cap from behind and the shell hollow: there was never any material in between, only the skin and the lid.
When exploring arbitrary implicit equations, you might encounter visual artifacts such as infinite "blades", floating planes, or holes in the geometry. This happens because some mathematical functions grow too fast, causing the ray to "overshoot" and completely jump past the surface.
If your surface looks broken or has external artifacts, the standard mathematical practice is to multiply the entire equation by a small scale factor (Lipschitz bound).
Example: Change x^2 + y^2 + z^2 + 2*x*y*z - 1.0 to 0.1 * (x^2 + y^2 + z^2 + 2*x*y*z - 1.0).
This artificially reduces the steepness of the function, forcing the ray to take smaller, safer steps without altering the actual shape of your object.
Shell vs. Solid Stability: These artifacts are especially prominent in Shell mode. Because the shell is a thin wall, a fast-traveling ray can jump right through it without detecting a hit, which shows up as holes that open and close as the camera moves. The first thing to try is the Precise marcher (see below): it finds the wall by where the equation changes sign, so it cannot miss it. Raising Shell Thickness works too, by giving the ray a wider wall to land on. If you don't specifically need the hollow shell effect, Solid mode is more robust still. With the Fast marcher, the 0.1 multiplier and a lower Step Relax (S) remain useful; both are inert under Precise, where the step size no longer decides the hit.
The marcher: Fast and Precise |
These two radio buttons choose how the rays look for the surface. They matter most on equations of high degree — quartics, products of several factors, the 4D sections of Cross Section.
The symptom that calls for Precise is a false weld: a blob of surface joining parts that should be separate, or a thick spur growing out of the object. It appears because the distance estimate Fast relies on becomes unreliable where the equation's gradient nearly vanishes, and the ray stops short of the surface — in mid-air. A good way to confirm it is to lower the transparency slider a little: the weld disappears at once, because transparency uses a different method. If it does, Precise will remove it on the opaque surface too.
The cost is roughly 70% more work on the surfaces that need it, and a few percent elsewhere. On a handful of 3D surfaces Precise can also nibble the odd pixel along grazing edges, which is why Fast remains the default: surfaces saved before this choice existed keep the look they were saved with, and only the Cross Section ones open on Precise, where the welds were unmistakable. The choice is saved with the surface.
With Precise the Ray Steps and Step Relax sliders grey out: neither has any effect on what you see, because the hit is decided by the sign change and refined by bisection rather than by the size of the steps. Their values are kept, and come back into play the moment you return to Fast.
x, y, z), so 4D hyperspatial rotations (Omega, Phi, Psi) and the P coordinate do not apply there — for those, use the Cross Section sub-tab described below.
← Geodesic Flow & Non-Euclidean Geometries · Contents · Rendering & Textures →