Forums > Jitter

2D drawing with fuzziness

June 14, 2013 | 1:24 pm

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


June 14, 2013 | 1:25 pm

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

Attachments:
  1. gradient_example

June 17, 2013 | 3:07 pm

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.


June 19, 2013 | 10:48 am

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


Viewing 4 posts - 1 through 4 (of 4 total)