Clarity shader in spark

I need to convert this clarity shader from shaderToy to sparksl
I tried to covert it but doesn’t work at all
I used sample function to convert line number 8
and sampleLod function to covert line number 9

I could never see a difference when using sampleLod on the camera texture, in terms of quality. Maybe it only works on non-live textures. You can try it with a texture that is compressed by spark (really anything except the camera texture), and it might work. I’m sure that defeats the purpose, but it will be interesting to see if that makes a difference.

Otherwise, you could try using shader derivatives to achieve something similar.

There might also be a difference in the camera and screen resolutions, so you could try using that as the two color inputs. Also just downsampling with render pass could work.

clarity_test2.arexport (20.5 KB)
Can you check it please ??

I don’t think sampleLod is going to work :confused:

But here is a kind of sharpening effect using derivatives.

clarity_test3.arprojpkg (74.2 KB)

1 Like