# reflow_components β Backlog
Tracks outstanding work for the GPU / shader-graph / lighting / post-processing stack in `reflow_components`. Formerly `docs/shader_graph_plan.md`; converted to a backlog once the foundational phases landed.
Legend:
- β
shipped
- π‘ partial (IR present but no actor / no codegen / limited use)
- β¬ not started
---
## Foundation β shader graph IR + compilation β
- β
`reflow_shader` crate (`ir.rs`, `codegen.rs`) with `ShaderNode` IR and `compile()` β WGSL vertex + fragment pair.
- β
`CompiledMaterial` output with `vertex_wgsl`, `fragment_wgsl`, `texture_slots`, `material_uniforms`, `pipeline_hash`.
- β
`PbrUniforms` packed to std140-friendly layout.
- β
`compile_sdf_shade` β SDF shade-function injection used by SDF ray march path.
## Scene render integration β
- β
`SceneRenderActor` gained `material` inport and parses `Message::Object` `CompiledMaterial`.
- β
Dynamic pipeline cache keyed by `pipeline_hash` (`HashMap<u64, CachedDynamicPipeline>` under `OnceLock<Mutex<_>>`).
- β
Fallback paths retained for objects without a shader-graph material (vertex-color, textured).
- β¬ LRU eviction on pipeline cache (currently unbounded β max 32 from plan not enforced).
- β¬ `wgsl_debug` outport on `ShaderCompilerActor` for editor-side inspection.
## Shader node actors β
All 29 planned templates are registered:
`tpl_shader_const_float`, `tpl_shader_const_color`, `tpl_shader_texcoord`, `tpl_shader_position`, `tpl_shader_normal`, `tpl_shader_time`, `tpl_shader_vertex_color`, `tpl_shader_image_texture`, `tpl_shader_noise_texture`, `tpl_shader_checker_texture`, `tpl_shader_voronoi_texture`, `tpl_shader_gradient_texture`, `tpl_shader_brick_texture`, `tpl_shader_musgrave_texture`, `tpl_shader_wave_texture`, `tpl_shader_math`, `tpl_shader_color_mix`, `tpl_shader_color_ramp`, `tpl_shader_separate_xyz`, `tpl_shader_combine_xyz`, `tpl_shader_fresnel`, `tpl_shader_bump_map`, `tpl_shader_normal_map`, `tpl_shader_mapping`, `tpl_shader_clamp`, `tpl_shader_map_range`, `tpl_shader_principled_bsdf`, `tpl_shader_material_output`, `tpl_shader_compiler`.
Missing actors for IR variants that exist:
- β¬ `tpl_shader_white_noise` (IR: `WhiteNoiseTexture`).
- β¬ `tpl_shader_tangent` (IR: `Tangent`).
- β¬ `tpl_shader_camera_vector` (IR: `CameraVector`).
- β¬ `tpl_shader_environment_texture` (IR: `EnvironmentTexture`).
- β¬ `tpl_shader_sky_texture` (IR: `SkyTexture`).
- β¬ `tpl_shader_displacement` (IR: `Displacement`).
## PBR lighting β
- β
CookβTorrance rasterized `pbr_shade` and `pbr_shade_multi` in WGSL.
- β
Multi-light loop: `u_scene.light_count` uniform, driven by `tpl_scene_light_collector`.
- β
SDF variant `pbr_shade_sdf` used by SDF ray march path.
- π‘ Point / spot light handling β only directional is exercised end-to-end in examples. Need a targeted test.
- β¬ Area lights (rectangular / disc) for studio-style lighting.
## Advanced BSDF β ArmorPaint parity
PrincipledBsdf IR carries every advanced parameter; codegen coverage is mixed.
| Feature | IR | Rasterized codegen | SDF codegen | Actor |
|---------|----|--------------------|-------------|-------|
| Clearcoat | β
| β
| β
| via `tpl_shader_principled_bsdf` |
| Sheen | β
| β
| β
| via `tpl_shader_principled_bsdf` |
| Subsurface | β
| π‘ color/radius fields compiled, no scattering approximation in rasterized path | β
used by SDF | via `tpl_shader_principled_bsdf` |
| Transmission / IOR | β
| β¬ ignored (`_` in destructure) | β
fully wired (refraction + dispersion in melting_ice) | via `tpl_shader_principled_bsdf` |
| Anisotropic | β
| β¬ ignored in rasterized path | β¬ | via `tpl_shader_principled_bsdf` |
| Iridescence / thin-film | β¬ | β | β | β |
Pending:
- β¬ Rasterized transmission (refraction through the backbuffer, chromatic dispersion toggle).
- β¬ Anisotropic GGX in both rasterized and SDF paths.
- β¬ Iridescence node.
## Lighting β environment / IBL
- β¬ `EnvironmentTexture` + `SkyTexture` IR variants have no actor and no codegen path.
- β¬ Prefiltered environment cubemap (specular split-sum).
- β¬ Irradiance map (diffuse convolution).
- β¬ BRDF LUT (split-sum integration).
- β¬ Light probe actor for local reflections.
## Shadow mapping
- β
`tpl_shadow_map` CPU depth rasterizer actor.
- β¬ Scene render samples the shadow map to modulate diffuse contribution (currently produces the map; nothing consumes it in the rasterized PBR path).
- β¬ Directional cascaded shadow maps (CSM).
- β¬ Point light cube maps.
- β¬ Variance shadow maps / percentage-closer filtering.
## Post-processing
- β
`tpl_tone_map` (ACES filmic, Reinhard, Uncharted2 + gamma).
- β
`tpl_bloom` (threshold β downsample β separable blur β composite).
- β
`tpl_ssao` (screen-space AO from luminance approximation).
- β¬ SSAO upgrade to HBAO/GTAO using real depth + normal buffers.
- β¬ FXAA / TAA actor.
- β¬ Depth-of-field / motion blur / chromatic aberration.
- β¬ Post-process pipeline descriptor so a DAG can express a full chain without per-pair wiring.
## Displacement & surface tricks
- π‘ `Displacement` IR variant exists; no actor, no codegen.
- β¬ Vertex-stage displacement (height map sampling in vertex shader, auto-LOD friendly).
- β¬ Parallax occlusion mapping in fragment shader.
- β¬ Triplanar mapping (UV-free texturing for terrain / organic surfaces).
- β¬ Decal projection (project texture onto surface via projector matrix).
## Bake actors
- β¬ `tpl_bake_ao` β ray-traced ambient occlusion β texture.
- β¬ `tpl_bake_curvature` β convexity / concavity map.
- β¬ `tpl_bake_position` β world / object-space position map.
- β¬ `tpl_bake_normal_transfer` β high-poly β low-poly normals.
- β¬ `tpl_bake_thickness` β for SSS approximation.
- β¬ All bake outputs stored in AssetDB as textures for reuse as shader inputs.
## Optimization
- β¬ Shader module cache: hash `fragment_wgsl` β reuse `wgpu::ShaderModule` across pipelines that differ only in bind-group layout.
- β¬ LRU eviction on `DYNAMIC_PIPELINE_CACHE` (cap around 32).
- β¬ Benchmark the pipeline-creation hot path under a large material library.
## Docs / developer experience
- β¬ Example graph JSON for each shader-node category in `docs/components/standard-library.md`.
- β¬ Quick-start tutorial: "Author your first PBR material as a DAG".
- β¬ Publish `reflow_shader` rustdoc to docs.rs (depends on the publishing work).
---
## Priority slate (next pass)
1. Fill the missing actors for existing IR variants (`WhiteNoiseTexture`, `Tangent`, `CameraVector`, `EnvironmentTexture`, `SkyTexture`, `Displacement`).
2. Wire the shadow map into the rasterized PBR path.
3. Rasterized transmission so the melting-ice quality generalises to mesh rendering.
4. Environment / IBL split-sum β the single biggest upgrade to surface realism.
5. LRU pipeline cache + shader-module dedupe before external users stress it.