After using impixi's Pixmap Blur for a while, I decide to create my own bloom code based on his code, seeing it would be about half the same.
A short note for those who doesn't know how to bloom. You take a picture, remove all non-bright areas, blur those remaining bright areas, and reapply that on top of the old picture.
Here is a good explanation with good pictures!
Long story short, I'm stuck on something simple. I've written a code that is supposed to detect all non bright pixels and delete them, leaving only the bright area which I am to blur later.
However, when I use WritePixel to make a pixel diffrent, there is simply no effect. I have no idea what I wrong.
it's pretty simple. Loop though all the pixels in the pixmap, and if they are anything other than -1 in color value, then write their value to -16777216.
I've tested printing ReadPixel(pm, x, z) before and after the WritePixel line, and it DOES work, the value is changed.
But, when I'm drawing the pixmap, expecting only pure white to be left in it, there is no change. My picture is exactly like it was before.
Am I missing something with how pixmaps works here? I got the blur (first link) which works almost the exact same way, to work without problems. If I erase my "bloomPixmap(pixmap)" function call and replace it with a "blurPixmap(pixmap)" then the picture is blurred, so I'm sure no other part of my code is wrong, such as a typo (I'm using superstrict anyway)
A short note for those who doesn't know how to bloom. You take a picture, remove all non-bright areas, blur those remaining bright areas, and reapply that on top of the old picture.
Here is a good explanation with good pictures!
Long story short, I'm stuck on something simple. I've written a code that is supposed to detect all non bright pixels and delete them, leaving only the bright area which I am to blur later.
However, when I use WritePixel to make a pixel diffrent, there is simply no effect. I have no idea what I wrong.
Function bloomPixmap(pm:TPixmap) pm = ConvertPixmap(pm, PF_RGBA8888) For Local x:Int = 0 To (pm.Width-1) For Local z:Int = 0 To (pm.Height-1) If ReadPixel(pm, x, z) <> -1 Then WritePixel(pm,x,z,-16777216) End If Next Next End Function
it's pretty simple. Loop though all the pixels in the pixmap, and if they are anything other than -1 in color value, then write their value to -16777216.
I've tested printing ReadPixel(pm, x, z) before and after the WritePixel line, and it DOES work, the value is changed.
But, when I'm drawing the pixmap, expecting only pure white to be left in it, there is no change. My picture is exactly like it was before.
Am I missing something with how pixmaps works here? I got the blur (first link) which works almost the exact same way, to work without problems. If I erase my "bloomPixmap(pixmap)" function call and replace it with a "blurPixmap(pixmap)" then the picture is blurred, so I'm sure no other part of my code is wrong, such as a typo (I'm using superstrict anyway)