Introduction

After loading a level, open Edit → Materials to launch the Material Editor. It edits the level's visual/render materials — texture samplers, ubershader features, and shader parameters stored under that level's RENDERABLE data (e.g. LEVEL_MODELS.MTL / LEVEL_MODELS.CST).

This is separate from Physical Materials (collision / Havok surface types under Configurations). The Material Editor is about how things look.

The same window can also open as a picker (with Use This Material) from places like renderable instances, the Material Mapping Editor, Model Editor import, and entity parameters that take a material — those used to be a plain text field.

Editing Materials

The left list shows materials for the loaded level, grouped by ubershader type. Use Search / Clear to filter, then select a material to edit it on the right. Edits apply in memory immediately (Viewport and other views that use the material can update without waiting for a disk save).

The footer shows the material's Ubershader Type (read-only).

Samplers

Each material can reference textures through sampler slots (up to 12). Tabs list the sampler names for that ubershader — a bold tab usually means a texture is assigned.

  • Edit Texture… / Pick Texture… — opens the Texture Editor so you can choose or change the texture. Global textures are imported into the level on load, so they're pickable here like any other.
  • Clear Texture — removes the assignment from that slot.

A preview and reference details (sampler index, texture name/format, and so on) appear below when a texture is set.

Features

Feature checkboxes toggle ubershader feature flags — dirt maps, detail normals, parallax, alpha blending, and so on, depending on the ubershader type.

A feature isn't just a switch inside one shader. Every combination of features is a separate compiled shader, and toggling one binds the material to a different one. That's why the checkboxes used to do nothing useful: the permutation you were asking for generally wasn't in the level.

They now work. Each checkbox tells you where the permutation it needs would come from:

  • Already in this level — the fastest case; the shader is sitting in the level's own pool.
  • Harvested from your game data — pulled from the permutation database OpenCAGE builds from your install (see below).
  • Reconstructed by CathodeLib — compiled from the available data in CathodeLib (usually instancing-related things like fog).

Features whose permutation can't be reached by any of those three routes stay hidden, so a checkbox you can see is one you can actually use. Switching a feature migrates the material's existing shader constants onto the new shader rather than resetting them.

Shader Permutations

The first time you launch OpenCAGE against a game install, it harvests a shader permutation database from your game data in the background — every (family, feature mask) combination the game actually ships, gathered from every level. You'll see progress in the status bar; nothing blocks while it runs, and if it fails you're simply left with the permutations each level already carries.

Beneath the feature list, the editor tells you how many combinations are currently reachable for the material's family, and Permutation mask: 0x… shows the material's current feature mask. Where more than one combination is available, you can pick from the full list directly rather than toggling features one at a time.

For some ubershader families — fog planes and spheres among them — permutations can be generated on demand rather than only found, this is due to the simplicity of their shaders. Support for this may expand over time.

Parameters

Parameters expose pixel-shader constants for the material (floats, vectors, colours). Colour-like parameters (names containing colour/tint, etc.) get a colour preview and Pick Color….

Only parameters that the shader maps into the material's constant buffer are listed.

Creating Materials

There are two ways to get a new material.

  • New Material… — builds one from nothing. You pick the shader family and a name, and that's all it asks: the family is the only thing that can't be changed later, and everything else the material needs is reachable from the editor once it exists.
  • Duplicate Selected — clones the selected material, named with a Clone suffix, so you can tune samplers, features and parameters independently of the original.

Only families that can actually be built on are offered when creating a material — if none are available for the level, the editor says so rather than producing something the game can't render.

Saving

The Material Editor has no separate Save button. Persist changes with File → Save Level (Ctrl+S). That writes the level's material (and related) files back to disk.

Saving closes the game if it's running so install files aren't locked.

Related Tools

  • Texture Editor — browse and assign textures used by material samplers
  • Material Mapping Editor — From→To remaps for materials in the level (separate from editing a material's look)
  • Model Editor — model preview/import can use material data and open the Material Editor as a picker
  • Physical Materials — collision/surface types (MATERIALS.BML), not visual MTL materials
  • Save and Build — resolves materials, remaps and alias overrides into the per-instance materials the game draws with