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:

Clicking the sub-tab you are already on reloads its default surface: 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.

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

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.

Troubleshooting Visual Artifacts

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.

The Scale Factor Trick (0.1 Multiplier)

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 or its shading.

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 misses it far less often. 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. The 0.1 multiplier and a lower Step Relax (S) remain useful too.

 

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.

Precise costs roughly 70% more work on the surfaces that need it. Fast stays the default because on a few 3D surfaces Precise can nibble the odd pixel along grazing edges; Cross Section surfaces open on Precise.

The Ray Steps and Step Relax sliders still matter with Precise. Before the sign-change search begins, the ray approaches the surface with the same steps Fast uses, and that approach decides two things: where the search starts, and which rays are treated as background. If a long step jumps clean over a thin part of the surface, the search starts beyond it, or the ray is discarded as background, and that part shows up as a hole. If Precise leaves holes or missing pieces, try a lower Step Relax first.


← Geodesic Flow & Non-Euclidean Geometries  ·  Contents  ·  Rendering & Textures →