Page 2 of 2

Re: Canvas Light (WIP)

PostPosted: Fri Feb 20, 2015 4:34 pm
by digiot
Hblade wrote:IN fact, not using PNG's is probably more resource hungry haha :D

I've read somewhere here, that using larger pngs with transparency costs massive fps !
Hblade wrote:Unlimited sizing without pixelation,...

That has come into my mind, too ! So you can change the size of the light more smoothly,
than using a bunch of premade sizes of pngs. Scaling and rotating functions are not
my thing...


Cheers !

Re: Canvas Light (WIP)

PostPosted: Fri Feb 20, 2015 4:44 pm
by Hblade
I'm working on a release version as we speak =D Also, made something cool... now you can define smoothness based on the size, so can make it barely soft, and super soft :D Lookie:
soft 1.png

soft 2.png

Re: Canvas Light (WIP)

PostPosted: Fri Feb 20, 2015 5:31 pm
by Jagmaster
I remember experimenting with stuff like this.

I had a draw actor function with a sprite that had a soft ring for the light, and it looked like like the image you have above.

however, when I added 2 lights it looked like this ->

Image

I wanted to do this ->

Image

I tried an algorithm with my own sine/cosine circle drawing function (similar to yours) which checked the current pixel, and added the transparency of the previous pixel.
And it tanked the frame rate...


so, I gave up and just went with hard lights for my setup :P

So do you think it's even possible? It was a couple years ago, perhaps I did something completely wrong?

Re: Canvas Light (WIP)

PostPosted: Fri Feb 20, 2015 5:44 pm
by Hblade
I actually have a way to fix that just havent gotten around to it yet O: Basically using structs and checking if a pixel is in the spot before it places the pixel =D And if the pixel has a darker opacity value, it places the new one, if not, it does nothing =D This will cause the light to blend together like that, but it's a bit difficult lol O:

EDIT: I see what you're talking about by the performance drop lol O: It seriously does impact it big time haha O:

Re: Canvas Light (WIP)

PostPosted: Fri Feb 20, 2015 8:15 pm
by bat78
Actually "Hblade's" elipse algorithm looks very similar to Novice's. Not saying the same.

PNG isn't hard for me to implement in my project.
It requires less resource than the bitmap. Currently bitfox supports 3 channeled bmp (RGB).
I could easily make it support 4 channels (RGBA) But why, since gE doesn't understad of bitmap's transparancy?

On the other hand, in v2 I will create x32bit (4 channels) PNG. It consists of a simple header with system-specific information, RLE compression that is very similar to the one I created by myself and the chunks respectively. In bitfox v3 I can also include animated pngs both for reading and writing.

Re: Canvas Light (WIP)

PostPosted: Fri Feb 20, 2015 8:24 pm
by Hblade
Cool, bat =D

Re: Canvas Light (WIP)

PostPosted: Fri Feb 20, 2015 9:35 pm
by bat78
Hblade wrote:Cool, bat =D

No it's not. Certainly not for you Hblade. I know you are only interested in games/game development.

Re: Canvas Light (WIP)

PostPosted: Fri Feb 20, 2015 9:57 pm
by Hblade
I dont know lol. Also, omg I developed a way to do it that doesn't cause lag! O:

(filling circle I mean..)

1280x720:
fast.png

Re: Canvas Light (WIP)

PostPosted: Fri Feb 20, 2015 10:34 pm
by bat78
The previous one didn't cause any lag?

Re: Canvas Light (WIP)

PostPosted: Fri Feb 20, 2015 10:37 pm
by Hblade
It did when they got large. But this new method makes it super fast.