microsoft / microsoft/MixedReality-GraphicsTools-Unity
Add programmatic iridescence support
Nessuno ha ancora preso questa issue.
- Lingua principale
- C#
- Stelle
- 209
- Fork
- 49
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Describe the problem
Banding is present in our texture based iridescence feature:

Switching to programmatic iridescence gradient look ups would alleviate this issue.
Describe the solution you'd like
Add a new gradient mode to this list which is maybe called "Iridescence Procedural"?

Implemented like so from @maluoi -
The sharp edges on the gradient were kinda bothering me, and I finally realized smoothstep was the answer! 😄
Anyhow, I thought I'd share the HLSL shader code I use for the iridescence gradient in StereoKit, in case it's helpful.
Another note here, using an array of float3s for the gradient color is how I'm avoiding banding, that's the ir_gradient variable here.
static const int ir_gradient_count = 5; static const float3 ir_gradient[] = { float3(0,0,0), float3(0,0,0), float3(0.065,0.018,0.429), float3(0,0,0), float3(0.013, 0.117, 0.597), float3(0,0,0) }; float3 GetIridescence(uint view_id, float3 world_pos, float3 surface_normal) { float3 dir = normalize(sk_camera_pos[view_id].xyz - world_pos); float ir = saturate(dot(dir, surface_normal)); float pct = ir * ir_gradient_count; int g = pct; pct = smoothstep(0, 1, frac(pct)); float3 curr = ir_gradient[g]; float3 next = ir_gradient[g+1]; return lerp(curr, next, pct); }
Describe alternatives you've considered
Live with the banding or use HDR textures for iridescence.
Additional context
Related to: https://github.com/microsoft/MixedReality-GraphicsTools-Unity/issues/22
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia individuando l’implementazione esistente dell’iridescenza basata su texture e l’elenco delle modalità di gradiente negli strumenti grafici Unity. Confronta l’approccio HLSL fornito con il percorso shader attuale, quindi verifica che una modalità di iridescenza procedurale riduca il banding senza richiedere una texture HDR.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp, unity
- Ambito
- computer-graphics, game-dev
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100
