Nowhk
July 16, 2019, 4:45pm
1
I’m making this custom Slider (with Handle) for control some plugins param:
But when I move the handle “a bit”, the draw start “smoothing” the border (anti aliasing filter I think), creating a sort of shadow around it:
Any way to disable anti aliasing?
Or best practice for doing this kind of stuff?
Thanks
Vortico
(VCV - Andrew)
July 16, 2019, 4:52pm
2
Rack uses a vector graphics renderer, not bitmap. There is no concept of pixels, just paths.
Nowhk
July 16, 2019, 5:05pm
3
Which paths will “fills” some pixels, in the end…
I try to reformulate: wow would you “snap” (round) only to the nearest interger draw measure?
Even better: how would you fix this?
Vortico
(VCV - Andrew)
July 16, 2019, 5:17pm
4
When the OpenGL context is created, shaders that anti-alias are used and can not be swapped for other ones, even in separate framebuffers.
Nowhk
July 16, 2019, 5:25pm
5
So the only solution is to “increase” the slider size? With zoom 150% this doesn’t happens…
Vortico
(VCV - Andrew)
July 16, 2019, 5:35pm
6
Before talking about the solution, I’m not convinced this is a problem. If a 1px-wide path (with no local transformations) happens to land in the middle of a pixel grid cell, it will appear 1px wide. If it’s exactly between two cells, it will appear 2px wide. This is normal and expected for antialiased vector graphics, and nobody will complain.
Nowhk
July 16, 2019, 5:41pm
7
Vortico:
Before talking about the solution, I’m not convinced this is a problem. If a 1px-wide path (with no local transformations) happens to land in the middle of a pixel grid cell, it will appear 1px wide. If it’s exactly between two cells, it will appear 2px wide. This is normal and expected for antialiased vector graphics, and nobody will complain
Its simple crap to see.
When I move the handle, I can clearly see the border being added on top/bottom of the handle. Only if I increase the zoom its ok. But I suppose the plug shouldnt look ugly at 100%…
Vortico
(VCV - Andrew)
July 16, 2019, 5:47pm
8
I’d suggest moving on, this issue is too minor for anyone to worry about.
Nowhk
July 16, 2019, 6:49pm
9
Uhm, I think I’ve done it:
void MySlider::step() {
SVGSlider::step();
if (dirty) {
// simply round y
handle->box.pos = Vec(handle->box.pos.x, round(handle->box.pos.y));
}
}
1 Like
Vortico
(VCV - Andrew)
July 16, 2019, 7:22pm
10
That assumes no local transformations.
Nowhk
July 16, 2019, 7:34pm
11
What do you mean with Local transformations? Example?