2D drawing with fuzziness

Jun 14, 2013 at 1:24pm

2D drawing with fuzziness

I’m trying to generate circular and linear color fields with parametrically-controlled fuzziness and I’m stuck on the best way to get this done.

I’ve made a mockup of what I have in mind here:

I’d be happy with the ability to draw circles and lines (horizontal or vertical) of arbitrary scale, position, color, alpha, and ‘fuzziness’ (edge feathering), at a decent (~40fps) frame rate. Ideally on the GPU.

I could see using jit.gradient in combination with jit.repos to get it done but I’m wondering if there is a GL or similar drawing environment that I’m missing that would be well-suited to the job.



Jun 14, 2013 at 1:25pm

Hmmm that link didn’t work … attaching image here.

  1. gradient_example
Jun 17, 2013 at 3:07pm

You should be able to use OpenGL / GLSL to generate the gradients directly.

I would say, do it in GLSL. Make a shader that takes in 2 colors, the inner and the outer. You can then convert to polar coordinates, and smoothstep from one color to the other. You inner would be, say, red. Outer, clear (all zero).

Then, attach the shader to a quad in space. Adjust the size of the quad, and that adjusts the size of your circle. You can get fancy and additionally adjust the softness of your gradients too.

If you need help with GLSL to draw a circular gradient, id suggest some GLSL tutorials, lots of examples.

Jun 19, 2013 at 10:48am

Thank you to the oracle … got my head in the GLSL books … GOOD STUFF VADE


You must be logged in to reply to this topic.