Rendering and lighting
Matter separates authoritative cells from their appearance. Rendering, material maps, lighting, ripples and foam can change without editing the world or its simulation clock. Start with the renderers created by Tools > Matter > Quick Setup or the independent Basic Setup sample. Quick Setup also creates or reuses the scene camera and frames the complete grid for its aspect ratio.
Connect the renderers
A typical scene has an opaque and a transparent MatterRenderer, both assigned
to the same MatterSimManager. Use the render modes to choose their phases.
TerrainMaterialField reconstructs boundaries; MatterLightingField supplies
grid lighting. GridAtmosphereRenderer is optional sky/cave presentation.
MatterCellHeatmapRenderer displays diagnostics rather than surface materials.
Use URP 17 and Linear color space. Assign the database's baked render library before tuning surface maps. A missing library gives palette-colored matter, not the authored texture appearance. See Substance authoring for the separate simulation and rendering bake actions.
Terrain-based sky access
Grid Atmosphere > Atmosphere > Automatic Skylight Blockers starts disabled.
The backdrop stays open sky and needs no terrain readbacks while it is off.
Enable it to derive sky access and cave shading from solid terrain and deposited
powder. Falling powder remains nonblocking. Switching it off immediately clears
the generated field; switching it on rebuilds from the current terrain.
In C#, set GridAtmosphereRenderer.AutomaticSkylightBlockers.
In Feature Showcase, use Lighting > Skylight blockers to compare the two looks. This control affects sky access; the Lighting Field still controls lighting and shadows on the matter surfaces.
Enable Automatic Skylight Blockers here when your world needs terrain-based cave shading. Sky and cave colors are configured on the same component.
Rendering Profile ownership
The Rendering Profile inspector organizes appearance into Look, Fluid, and Lighting. The renderer inspector contains scene references, its required profile and effective smoothing status. Common controls appear first and technical controls remain in collapsed sections. These authoring groups are separate from the Showcase's four runtime settings tabs.
A Rendering Profile (MatterRenderingProfile in C#) is a reusable look
asset. It stores surface smoothing, texture rendering, fluid appearance and
lighting. The database defines the materials and their behavior; the saved world
contains the authored cells.
Quick Setup creates missing profiles from the current appearance and reuses assigned profiles. Matching looks share one new asset; different authored looks stay separate. You can instead choose a profile explicitly in Quick Setup to apply that look to both renderers. Assets are created in Matter Profiles beside an Assets-based database, or under Assets/Matter/Profiles for a package database.
- A profile is required to author appearance. On a renderer without an assignment, Create and Assign Profiles creates the required assets from the current appearance. Viewing the inspector never creates an asset. Unconfigured renderers use Matter defaults until a profile is assigned; there is no locally authored fallback.
- Select Profile opens the shared asset and its appearance controls. Editing that asset affects every renderer using it. Duplicate and Assign creates a separate asset before you author an independent look. World Settings displays smoothing status and opens the owning profiles.
- Runtime
ApplySettingschanges instance-owned values, not the profile asset.ResetToProfilereapplies the assigned profile. - Read
CaptureSettings(), change the required group, and apply the complete value once. Settings are value types: modifying a local copy alone does not update the renderer.
Surface smoothing
Surface Smoothing controls the visible terrain and liquid contours and the boundaries between terrain materials. It does not add simulation cells, change their contents, or alter the saved world. Choose a mode for the look you want:
| Mode | Appearance and use |
|---|---|
| Off | Keeps the stepped cell edges. Use it for a blocky look or to inspect the grid. |
| Marching Squares | Interpolates neighboring cell boundaries to soften the steps. Curves retain more angular detail than Topology Locked. |
| Topology Locked | Uses a computed terrain field to create smoother curves while preserving thin connections, holes, and material connectivity. It requires the terrain-field resources and adds rendering work. Measure the cost on your target hardware. |
Only the smoothing mode changes in these close-ups: the cells, camera, and other rendering settings are identical.
Set smoothing in your scene
- Select the GameObject containing a Matter Renderer.
- Click Select Profile to open its Rendering Profile. If the reference is empty, choose Create and Assign Profiles first.
- Set Surface Smoothing near the top of the profile Inspector to Off, Marching Squares, or Topology Locked.
- Check the opaque and transparent renderers. Assign the same profile, or choose the same smoothing mode in both profiles, to keep their contours consistent.
The Rendering Profile screenshot above shows Surface Smoothing directly below the search box.
Editing a shared profile changes every renderer that uses it. For a separate look, use Duplicate and Assign… on the renderer before editing its profile. The Matter World Settings overlay also displays smoothing status and offers actions to open the owning profiles.
Quick Setup and new Rendering Profiles start with Topology Locked. An explicitly selected profile supplies its own mode; repairing a scene preserves existing looks. Quick Setup displays the profile shared by both renderers, so you can open the assigned asset and adjust it directly.
Compare modes in Feature Showcase
Click Smoothing in the top toolbar to cycle Off → Marching Squares → Topology Locked → Off. The button changes both renderer passes. Pause the simulation and keep the camera fixed to compare the same contours. These are runtime changes to the demo's appearance; they do not edit the shared profile asset.
If Topology Locked looks like Marching Squares
The renderer uses Marching Squares while its terrain field is unavailable.
Select the renderer and read its smoothing status. Check that its
Terrain Material Field reference is assigned, enabled, uses
TerrainMaterialField.compute, and targets the same simulation. Initialize the
world by opening it in World Editor or entering Play Mode, then allow the field
to rebuild. Quick Setup connects these references for you.
Use separate Opaque Solids and Transparent Fluids render passes, as in Quick Setup. All render mode keeps cell detail rather than applying the same front-face smoothing. Compute-free presentation, including WebGL2, uses the reduced rendering path; choosing a CPU simulation on a compute-capable device can still retain the full renderer.
Set smoothing from C#
Call this helper on Unity's main thread with the scene's renderer references.
It changes each renderer's runtime settings without editing the profile asset
or changing its other settings. ResetToProfile() restores that renderer's
authored profile values.
using System;
using MasterTech.Matter.Rendering;
public static class MatterSmoothingExample
{
public static void SetMode(
TerrainMaterialBoundaryAlgorithm mode, params MatterRenderer[] renderers)
{
if (!Enum.IsDefined(typeof(TerrainMaterialBoundaryAlgorithm), mode))
throw new ArgumentOutOfRangeException(nameof(mode));
if (renderers == null) throw new ArgumentNullException(nameof(renderers));
foreach (MatterRenderer renderer in renderers)
if (renderer == null) throw new ArgumentException("Assign every renderer.", nameof(renderers));
foreach (MatterRenderer renderer in renderers)
{
MatterRendererSettings settings = renderer.CaptureSettings();
settings.Surface.TerrainBoundaryAlgorithm = mode;
renderer.ApplySettings(settings);
}
}
}
Use the value that matches the Inspector choice:
| Inspector choice | TerrainMaterialBoundaryAlgorithm value |
|---|---|
| Off | Off |
| Marching Squares | MultiLabelMarchingSquares |
| Topology Locked | TopologyLockedDistanceField |
For example, call MatterSmoothingExample.SetMode(TerrainMaterialBoundaryAlgorithm.Off, terrainRenderer, fluidRenderer)
from your gameplay code to turn contour smoothing off for both assigned renderers.
Liquid Stream Smoothing and quality presets
Liquid Stream Smoothing, under Advanced > Fluid in the profile, softens the visible shape of thin, falling liquid streams. Open the assigned profile, expand Advanced, and change Liquid Stream Smoothing in the Fluid details. You can also find the control by searching for its name in Find settings. Set 0 to disable this stream-shape smoothing; values toward 1 apply more smoothing to connected streams. Isolated droplets retain their rounded appearance. The value does not move cells or change the selected terrain-boundary mode.
In Feature Showcase, open Settings > Fluid > Motion Shaping > Stream Smoothing. The demo's slider changes the current session's appearance.
The profile's Low, Medium, and High buttons change surface features together. Surface Smoothing and Liquid Stream Smoothing remain separate profile controls; these buttons do not choose a terrain-boundary mode.
Runtime code edits settings.PhaseDetail.LiquidStreamSmoothing through the same
CaptureSettings() / ApplySettings() workflow. Calling
MatterRenderer.ApplySurfaceQualityPreset also sets the stream-smoothing defaults
to 0.45 (Low), 0.75 (Medium), or 1 (High). For custom runtime stream
tuning, apply the preset first so a later preset call does not replace that value.
Look and material detail
Choose a quality preset first, then tune individual features. Presets copy a configuration; subsequent changes form a custom look. Map resolution selects an available baked tier, not a new source texture resolution. The samples ship 2K sources; lower tiers reduce their memory and sampling cost.
The profile's Look section exposes stochastic patch blending, material variants, base normals and detail maps directly. Fluid exposes texture animation, visual ripples and foam. Their detailed strengths, scales and speeds are grouped under Advanced; presets do not change map resolution.
The editor's Map Resolution choices are 128, 256, 512, 1024, 2048 and 4096 pixels. A 4096 tier requires matching source textures and a bake; selecting it does not add detail to the supplied 2048-pixel sample textures.
Numeric choices request absolute pixel dimensions even when a library's base bake is not 2048 pixels. If the matching native tier is unavailable, rendering uses the corresponding mip of the available base payload; a request above the source size cannot create additional detail.
Base normal maps supply large surface detail. Detail maps add fine grain. Stochastic patches reduce obvious tiling; material variants choose among the substance's authored texture sets. Geological breakup introduces broader variation. Height and boundary blending control transitions between materials.
Terrain surface depth and liquid surface depth draw collision-free visual caps. Height/normal relief affects shading; it does not excavate cells or change a collider. Begin with the Natural defaults and inspect the result at the camera distance used by the application. A stronger relief value is not necessarily a more readable surface.
Source/importer changes require Bake Rendering Data and refreshed texture tiers. Simulation-property changes instead require Bake Simulation Data. Generated texture arrays are project caches; edit the definitions and source maps, not those arrays. Per-material Showcase overrides are session-only.
Fluid appearance
Depth-aware optics estimates optical thickness from the visible contour. It is a bounded shading signal in reference cells, not a simulated third dimension. Per-substance absorption, opacity and refraction combine with the renderer-wide liquid depth response.
Visual ripples change normals; foam concentrates around motion and impacts. Texture animation moves the sampled maps. Gas opacity and density response control transparent gas shading. Liquid stream smoothing and airborne-powder shape have their own phase-detail controls.
None of these controls generates physical water waves or displaces water. For forces, obstacles and impact waves, see Physics integration. Visual animation uses simulation time, so pausing the simulation freezes it.
This complete helper changes one renderer's ripples while preserving its other settings. Call it from gameplay on Unity's main thread after assigning a renderer.
using System;
using MasterTech.Matter.Rendering;
public static class MatterRippleExample
{
public static void SetRippleStrength(MatterRenderer renderer, float strength)
{
if (renderer == null) throw new ArgumentNullException(nameof(renderer));
MatterRendererSettings settings = renderer.CaptureSettings();
LiquidSurfaceDynamicsSettings dynamics =
settings.FluidPresentation.LiquidSurfaceDynamics;
dynamics.RippleStrength = UnityEngine.Mathf.Clamp01(strength);
settings.FluidPresentation.LiquidSurfaceDynamics = dynamics;
renderer.ApplySettings(settings);
}
}
Lighting
Natural/Toon selects the lighting response. Direct-light strength controls the key light; ambient strength and sky/ground colors fill surfaces that receive less direct light. Normal influence changes how authored normals respond to that light. Shadow, occlusion and grid-light settings have separate costs.
MatterGridLight supplies local lighting. Emissive substances contribute through
their rendering data; thermal simulation and emission are independent settings.
The Showcase Lighting and Day / night worlds demonstrate local and directional
lighting respectively. Its time slider and Auto control are sample behavior,
not a requirement for using MatterLightingField.
Cell overlays
Diagnostic cell overlays follow the rendered front faces and projected terrain tops. Temperature displays the simulation's 0–255 °C range; Fill, Density and Horizontal Flow inspect their corresponding cell values. These views do not change the simulation. A standalone cell overlay remains available when the standard terrain and fluid renderers are absent.
CPU and browser presentation
Selecting CPU simulation on compute-capable hardware can retain the full presentation path through a presentation buffer. Compute-free rendering, such as the WebGL2 fallback, uses a simpler palette and grid-lighting path without the full authored texture and optical effects. A CPU simulation backend and a compute-free rendering device are different configurations.
For headless CPU simulation, disable the presentation buffer and omit rendering components. Compare supported configurations in Requirements.
Custom rendering integrations
Borrow presentation resources through TryGetPresentationResources and
reacquire after PresentationResourcesChanged. Never dispose those buffers or
retain them across a backend replacement. A failed lookup means the required
presentation resources are unavailable; skip that draw.
If a custom renderer calls SubstanceRenderLibrary.TryBind, reuse its
MaterialPropertyBlock and call ReleaseBinding(block) when it stops consuming
the library or changes libraries. Each consumer retains its own texture tier.
MatterRenderer handles this ownership automatically. See the
API integration guide for the supported entry points.




