Extract common UI shader code from `ui.wgsl` for reuse in custom materials
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## What problem does this solve or what need does it fill?
The default shader to render UI, `ui.wgsl`, has quite a bit of useful logic around calculating the SDF shapes. In an ideal world that part (which relates to shape) would be independent from the appearance (mainly, color). But unfortunately they're both defined by the same fragment shader. This means (as far as I understand) that a shader for a custom UI material needs to replicate all the SDF logic if it only wants to _e.g._ change the color or texture sampling.
## What solution would you like?
Extract from `ui.wgsl` into a shader "library" all the code which is generic, including all the SDF calculation, and which can be reused as is from user shaders.
## What alternative(s) have you considered?
Copy/paste :(
Contributor guide
Research direction
Start by reading ui.wgsl and tracing the SDF shape calculations used by the default UI fragment shader. Identify the generic code that custom UI material shaders would need to reuse; done means that logic is available as a shader library without requiring those shaders to copy it.
Written by the indexing model from the issue text.
Assessment
- Domain
- computer-graphics, game-dev
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100