I want to implement a bilateral filter because I have read the it preserves the edges. The equation is given as:
$$ BF\left[I\right]_p = \frac{1}{W_p}\sum_{q\in S} G_{\sigma_s}\left( \left\Vert p-q \right\Vert \right) G_{\sigma_r}\left( \left\vert I_p-I_q \right\vert \right) I_q \\ $$ Where:
- \$\frac{1}{W_p}\$ is the normalization
- \$G_{\sigma_s}\left( \left\Vert p-q \right\Vert \right)\$ is the space
- \$G_{\sigma_r}\left( \left\vert I_p-I_q \right\vert \right)\$ is the range
But how would the above equation translate to shader code? Specifically I don't understand how to evaluate \$G_{\sigma_s}\$ and \$G_{\sigma_r}\$.
I have already implemented a renderer feature for the screen effect. If any one can walk me through the implementation for this that would greatly help.