Part of #743 (Epic: Shaders — preset stylized shaders). Do this slice first — it de-risks the whole epic.
Goal
Author the custom GLSL programs + .material scripts for the stylized looks, and a headless compile harness that proves they compile on CI before any UI is built. The single riskiest part of the epic is "do these GLSL programs compile across platforms" — prove it here.
Shader assets
Add GLSL #version 150 programs under media/materials/programs/stylized/ (or reuse GLSL150/), using OgreUnifiedShader.h macros for cross-RS safety. A shared lighting/normal helper plus per-look vert/frag:
toon.frag — N·L → quantized ramp (band count uniform; optional ramp texture)
- outline — prefer the cheap, robust 2-pass inverted-hull (back-face pass, front culling, scale-along-normal or
depth_bias) per media/materials/scripts/QBuild.material BaseOutlined; no fragile geometry shader
rim.frag — Fresnel pow(1 - N·V, power)
matcap.frag — view-space normal → sphere-map UV lookup (needs a bundled matcap texture)
hologram.frag — Fresnel + scanline + additive blend
xray.frag — depth-tested additive Fresnel
gooch.frag — warm/cool interpolation
flat.vert/.frag — face normal via dFdx/dFdy (faceted)
vcolor.frag — unlit vertex color
Declare them in media/materials/programs/stylized/Stylized.program (mirror media/Main/ShadowVolumeExtude.program syntax: vertex_program … glsl { source … }). Author base .material scripts in media/materials/scripts/Stylized.material with vertex_program_ref/fragment_program_ref, named so Slice B can look them up / clone().
If a new programs dir is used, register it in cfg/resources.cfg.in.
Compile harness (load-bearing)
New src/StylizedShaders_test.cpp: in a headless RTT (reuse ModelTurntableRenderer or a minimal RTT like MeshDepthRenderer), apply each stylized material to a primitive and render one frame — a GLSL compile failure surfaces as an Ogre exception / blank frame. Skip gracefully when tryInitOgre() can't get a context (macOS local); runs for real on Linux CI (Xvfb + Mesa, MESA_GL_VERSION_OVERRIDE=3.3). Wire the test file into CMakeLists.txt.
Fallback
If a specific shader misbehaves on Mesa, fall that one look back to FFP/multipass — the preset surface (Slice B+) is identical either way.
Acceptance
Part of #743 (Epic: Shaders — preset stylized shaders). Do this slice first — it de-risks the whole epic.
Goal
Author the custom GLSL programs +
.materialscripts for the stylized looks, and a headless compile harness that proves they compile on CI before any UI is built. The single riskiest part of the epic is "do these GLSL programs compile across platforms" — prove it here.Shader assets
Add GLSL
#version 150programs undermedia/materials/programs/stylized/(or reuseGLSL150/), usingOgreUnifiedShader.hmacros for cross-RS safety. A shared lighting/normal helper plus per-look vert/frag:toon.frag— N·L → quantized ramp (band count uniform; optional ramp texture)depth_bias) permedia/materials/scripts/QBuild.materialBaseOutlined; no fragile geometry shaderrim.frag— Fresnelpow(1 - N·V, power)matcap.frag— view-space normal → sphere-map UV lookup (needs a bundled matcap texture)hologram.frag— Fresnel + scanline + additive blendxray.frag— depth-tested additive Fresnelgooch.frag— warm/cool interpolationflat.vert/.frag— face normal viadFdx/dFdy(faceted)vcolor.frag— unlit vertex colorDeclare them in
media/materials/programs/stylized/Stylized.program(mirrormedia/Main/ShadowVolumeExtude.programsyntax:vertex_program … glsl { source … }). Author base.materialscripts inmedia/materials/scripts/Stylized.materialwithvertex_program_ref/fragment_program_ref, named so Slice B can look them up /clone().If a new programs dir is used, register it in
cfg/resources.cfg.in.Compile harness (load-bearing)
New
src/StylizedShaders_test.cpp: in a headless RTT (reuseModelTurntableRendereror a minimal RTT likeMeshDepthRenderer), apply each stylized material to a primitive and render one frame — a GLSL compile failure surfaces as an Ogre exception / blank frame. Skip gracefully whentryInitOgre()can't get a context (macOS local); runs for real on Linux CI (Xvfb + Mesa,MESA_GL_VERSION_OVERRIDE=3.3). Wire the test file intoCMakeLists.txt.Fallback
If a specific shader misbehaves on Mesa, fall that one look back to FFP/multipass — the preset surface (Slice B+) is identical either way.
Acceptance