Skip to content

Shaders: Slice B — Register stylized presets in MaterialPresetLibrary #745

Description

@fernandotonon

Part of #743 (Epic: Shaders). Depends on Slice A (shader assets must compile).

Goal

Register the stylized looks as presets in MaterialPresetLibrary so they flow into the existing preset → CLI → MCP → GUI surface automatically.

Work

  • Extend presetNames() (src/MaterialPresetLibrary.cpp ~line 140) with the grouped stylized set: "Toon", "Toon + Outline", "Outline", "Rim Light", "Matcap", "Hologram", "X-Ray", "Gooch", "Flat Shaded", "Vertex Color".
  • In applyPreset() (dispatch ~174–219), route stylized names to a new helper applyStylizedPreset(mat, look) that clones/instantiates the matching Stylized.material technique, sets tunables (toon band count, rim color/power, matcap texture, outline width/color, gooch warm/cool), then calls RTShaderHelper::finalizeShaderGenMaterial + mat->compile(/*autoManageTextureUnits=*/false).
  • Reuse the existing MaterialPresetCommand undo path and presetApplied signal unchanged.
  • Bundle a matcap texture in media/materials/textures/ for the Matcap preset.

Gotchas

  • compile(false) to preserve pass/slot layout (same as PBR presets).
  • Verify a stylized preset on a skinned mesh (Rumba Dancing.fbx) animates correctly — RTSS skinning via finalizeShaderGenMaterial/createShaderBasedTechnique.

Acceptance

  • Each stylized name applies without crashing and renders the expected look in the viewport.
  • Applies cleanly to skinned meshes; animation deformation correct.
  • Undo restores the prior material; reapply is idempotent.
  • --list-presets and the GUI grid show the new names (auto via presetNames()).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions