2D drawing with fuzziness

doctorhandshake's icon

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.

Thanks,

N

doctorhandshake's icon

Hmmm that link didn't work ... attaching image here.

gradient_example.jpg
jpg
vade's icon

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.

doctorhandshake's icon

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