Script Dock & Advanced Scripting


← Animation & Video  ·  Contents  ·  Library, Presets & Saving Your Work →


For expert users, the Script dock provides a powerful GLSL code editor to bypass the standard equations and directly program the GPU for surfaces, textures, and sounds.

 

Script Buttons

The Script dock features several action buttons to compile and apply your code depending on your current goal:

 

One surface, one dock

A surface whose shape is defined by a script is defined either there or in the Equations dock — not by both at once. The two are alternative sources for the same geometry, and this holds in Ray Marching exactly as it does for parametric surfaces: an implicit surface can come from the Equation field or from a script returning a distance function, but only one of them is in force.

So if the surface on screen comes from one dock and you start typing in the other, the two do not combine: what you type may not take effect, or may mix with the state already loaded. The application says so with a message the first time you do it. To work from a clean state you have two options: click the tab of the current mode (Parametric or Implicit) to clear everything and get the default surface back, or press NEW, at the bottom of the Equations dock, to clear everything and leave the scene empty. Either way both docks are free again and you can write wherever you prefer.

Metric-tensor scripts are the exception, and an important one. A script ending in return mat3(...) does not describe a shape: it defines the metric gij, while the chart and the initial conditions of the geodesic flow live in the Equations dock. The two panels are not competing there — they describe one geometry together, which is why the presets in Black Hole and several Rotations records fill both. Loading one of them raises no warning. If you then write into either dock the message can still appear, because from a blank editor the application cannot tell whether you are extending the metric or starting an ordinary surface; it is only a reminder, and you can carry on. The rule deciding which panel wins when the two disagree is in Geodesic Flow.

 

Script Language Reference

Scripts are GLSL code pre-processed by the application's internal translator, which adds math shorthand (^ powers, % modulo, pi/tau constants), UI directives (u_min := -3.0;) and a few strict rules (such as automatic integer-to-float conversion). For the complete syntax, available variables, helper functions and examples, read the dedicated guide: GLSL Script Writing Guide.


← Animation & Video  ·  Contents  ·  Library, Presets & Saving Your Work →