Page 1 of 1

how to draw a fuzzy point(using in particle system)?

Posted: Sat Mar 26, 2011 11:22 am
by gbstack
Hi,everyone!

I want to draw fuzzy points(just like LOVE particle system),anyone could tell me the methods or what should I search?

Any suggestion is appreciated.:)

Re: how to draw a fuzzy point(using in particle system)?

Posted: Sat Mar 26, 2011 1:34 pm
by Robin
The simplest way to go about that would be to use an image of a fuzzy point, and drawing that or giving it to a particle system.

Re: how to draw a fuzzy point(using in particle system)?

Posted: Sun Mar 27, 2011 8:26 am
by gbstack
Thanks for your suggestion!:)
it's a good method but I want to change the color of particles as time passing by.Can I achieve this by using the image as the particle?

I don't know whether an algorithm which is used to create fuzzy particles exists...:(

Re: how to draw a fuzzy point(using in particle system)?

Posted: Sun Mar 27, 2011 8:41 am
by vrld
  1. Create a white fuzzy dot.
  2. Use love.graphics.setColor
  3. ?????
  4. Profit
You can create the fuzzy point by setting the pixels-alpha values of an ImageData depending on how far they are away from the image's center, e.g.:

Code: Select all

id:mapPixel(function(x,y) -- assuming a square imagedata
    local dx,dy = x - WIDTH/2, y - WIDTH/2
    local d = math.sqrt(dx*dx + dy*dy) / (WIDTH/2)
    return 255,255,255, math.max(0, 1 - d) * 255
end)

Re: how to draw a fuzzy point(using in particle system)?

Posted: Wed May 04, 2011 9:37 am
by gbstack
vrld wrote:
  1. Create a white fuzzy dot.
  2. Use love.graphics.setColor
  3. ?????
  4. Profit
You can create the fuzzy point by setting the pixels-alpha values of an ImageData depending on how far they are away from the image's center, e.g.:

Code: Select all

id:mapPixel(function(x,y) -- assuming a square imagedata
    local dx,dy = x - WIDTH/2, y - WIDTH/2
    local d = math.sqrt(dx*dx + dy*dy) / (WIDTH/2)
    return 255,255,255, math.max(0, 1 - d) * 255
end)


thanks very much!
It has been solved by using your method.(sorry for my late reply...)