RunMat
GitHub

shading — Control flat, interpolated, or faceted surface shading with MATLAB shading workflows.

shading controls how surfaces and related scalar-field plots interpolate or facet their color/geometry presentation. In RunMat it is most relevant for the surface family (surf, mesh, surfc, meshc) and complements colormap-driven visualization workflows with the standard MATLAB shading flat, shading interp, and shading faceted styles.

How shading works in RunMat

  • shading flat uses flat shading across faces.
  • shading interp enables interpolated/smooth shading across the rendered surface.
  • shading faceted restores faceted surface presentation.
  • Shading state is subplot-local through the shared plotting metadata model.

Examples

Apply interpolated shading to a surface

[X, Y] = meshgrid(linspace(-3, 3, 50), linspace(-3, 3, 50));
Z = sin(X) .* cos(Y);
surf(X, Y, Z);
shading interp;

Compare flat and faceted shading across subplots

[X, Y] = meshgrid(linspace(-3, 3, 40), linspace(-3, 3, 40));
Z = sin(X) .* cos(Y);
subplot(1, 2, 1);
surf(X, Y, Z);
shading flat;
subplot(1, 2, 2);
surf(X, Y, Z);
shading faceted;

These functions work well alongside shading. Each page has runnable examples you can try in the browser.

surf, mesh, colormap, colorbar

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how shading works, line by line, in Rust.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code — faster, on any GPU, with no license required.

  • Simulations that took hours now take minutes. RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed.
  • Start running code in seconds. Open the browser sandbox or download a single binary. No license server, no IT ticket, no setup.
  • A full development environment. GPU-accelerated 2D and 3D plotting, automatic versioning on every save, and a browser IDE you can share with a link.

Getting started · Benchmarks · Pricing

Try RunMat — free, no sign-up

Start running MATLAB code immediately in your browser.