Any advice on how to use more than 3 channels? #161
-
I was thinking about using the alpha channel as another "color" channel? float median(float r, float g, float b) {
return max(min(r, g), min(max(r, g), b));
} I'm currently using MTSDF and this GPU code. I don't need soft effects, but would prefer to use the extra alpha channel to add even more fidelity. If I wanted to use even more than 4 what code would I use for both the library and GLSL? I wonder if this is the best way with MTSDF since the alpha is basically just and SDF: float median(float r, float g, float b, float a) {
return (max(min(r, g), min(max(r, g), b)) + a) / 2.0;
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I don't know of a way to add more fidelity by using 4 instead of 3 channels. I am not saying it's not possible, but my MSDF scheme requires an odd number of channels, so you'd probably have to come up with a completely different method. Or, for specific use cases, you can assign special meaning to some channels and perform a custom set operation - for example, I once used a 2-channel MSDF when I knew all of the corners were convex and I needed the other 2 channels for something else. However, I believe extending my method to 5, 7, 9, etc. channels (and always finding the median in the shader) should be straightforward, although I never attempted it. "Color" assignment would be probably the only thing that has to be seriously thought trough. As for your average of MSDF and SDF samples, I think that's actually the worst option because it combines the disadvantages of both while completely negating the benefits of MSDF. Also, from my experience, simply increasing the resolution is often the best option for fidelity. |
Beta Was this translation helpful? Give feedback.
I don't know of a way to add more fidelity by using 4 instead of 3 channels. I am not saying it's not possible, but my MSDF scheme requires an odd number of channels, so you'd probably have to come up with a completely different method. Or, for specific use cases, you can assign special meaning to some channels and perform a custom set operation - for example, I once used a 2-channel MSDF when I knew all of the corners were convex and I needed the other 2 channels for something else.
However, I believe extending my method to 5, 7, 9, etc. channels (and always finding the median in the shader) should be straightforward, although I never attempted it. "Color" assignment would be probably th…