Just published a <deeper dive> into the shader-bas...
# compose-desktop
k
Just published a deeper dive into the shader-based render effects in Compose Desktop / Skiko, looking at each step one at a time and detailing all the moving parts.
🙌🏻 1
jetpack compose 5
💙 4
😮 4
🙌 9
🙌🏼 1
r
You can try to get syntax highlighting by installing the GLSL plugin and using the @Language annotation
Other note: Skia shaders work in linear space, you should take the luminance of the noise instead of the luma (just different coefficients)
Also if you wanted to just kill banding without adding a strong visible noise you can dither the content by adding +/-1/255 using a procedural noise pattern. For instance: https://github.com/google/filament/blob/main/shaders/src/dithering.fs
For desktop the RGB triangle noise would work great
In your case you wouldn't use the temporal component though
k
Thanks. Updated to use luminance. Also installed https://plugins.jetbrains.com/plugin/6993-glsl-support and added
@Language("GLSL")
to the snippets. Looks pretty decent.
r
I just realized something else. I should write a blog post on shader tips and tricks because SkSL/AGSL makes it too easy to mix type precisions if you are not aware, which is not ideal.
k
It's a bit confusing since it allows you to mix
half4
and
vec4
with no warnings
r
vec4 will be like half4, at least on Android
but float won’t be, so you should use half