Add 7 shaders to the stylize module, exposed through the existing
Style* runtime and Squirrel API (no new module or bindings):
- Mesh materials (reuse mesh3d_toon.vert): rim light, dissolve,
hologram, snow accumulation.
- Post passes: vignette, chromatic aberration, film grain.
Original GLSL implementations of common techniques, not verbatim
copies (see docs/dev/ported-material-shaders.md for licensing).
Adds EffectShaders.{h,cpp} with param tables + uniform binding +
shader creation, wired via delegation from StyleShaders.cpp, plus
SPIR-V embeds and per-module tests (test/stylize_effects.cpp).
2.8 KiB
Ported material & post shaders (Unity / Godot style)
A curated set of "mature" game-engine shaders, exposed through the existing
stylize module so they share its StyleInstance / StylePass / StyleRecipe
runtime and the same Squirrel API as cartoon, ink, xray, etc. No new
module, manifest entry, or binding is required.
What was added
Mesh material shaders (reuse graphics/mesh3d_toon.vert; params arrive as
push constants; albedo at binding 1):
| style | technique | inspiration |
|---|---|---|
rim |
fresnel rim light + lambert | Unity built-in Rim Lighting shader |
dissolve |
noise dissolve with burn edge | Unity Dissolve / URP community shaders |
hologram |
fresnel + scanlines + glitch | Godot community Hologram shaders |
snow |
snow accumulation on normals | Godot community Snow / Ice shaders |
Post-process shaders (full-screen passes over the scene color):
| style | technique | inspiration |
|---|---|---|
vignette |
edge darkening | ubiquitous engine vignette |
chromatic |
radial + per-channel dispersion | Unity Standard Chromatic Aberration |
grain |
luminance-adaptive film grain | filmic grain / dither techniques |
Licensing note
These are original GLSL implementations of widely-used, technique-level effects — not verbatim copies of Unity or Godot shader source. The Unity built-in shaders and many community shaders carry restrictive or mixed licenses, so nothing here was copied wholesale. The underlying math (value-noise / fbm, fresnel, smoothstep blending, film-grain dither) is standard public-domain technique. Godot's engine is MIT-licensed, but the specific ports above were written fresh against EVEngine's push-constant / binding layout.
If a specific commercial look is required, replace the GLSL in
src/modules/stylize/shaders/ and recompile via
scripts/compile_stylize_shaders.py.
Adding a shader (in 4 steps)
- Drop a
*.fraginsrc/modules/stylize/shaders/following the push-constant convention in the header comment (layout(push_constant) uniform Externals { float data[32]; } u;, index =declareFloatorder). - Append it to
FRAGSinscripts/compile_stylize_shaders.pyand run it to produce the embedded*_frag_spv.inc. - In
src/modules/stylize/EffectShaders.cppadd aStyleDefinition, a param table, and branches in the count / at / bind / create dispatchers. - Optionally add a test case in
test/stylize_effects.cpp.