Cumulative pixel effect? [Resolved]

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
OmarShehata
Party member
Posts: 259
Joined: Tue May 29, 2012 6:46 pm
Location: Egypt
Contact:

Cumulative pixel effect? [Resolved]

Post by OmarShehata »

My second question on PixelEffects today, woohoo!

So I've got lights in my game, and the more lights I add the laggier it gets. So I thought about combining all my lights into one canvas/image before applying them on the game.

I do this by creating a blank canvas, then multiplying the colors of the light by the pixels of the canvas, and as you get further away from the light source the factor decreases. So if it works, it should give you all the lights on a black screen.

The problem however, is that since the arrays in PixelEffect code aren't dynamic, I thought about iterating through the lights, and redrawing the canvas every time. The problem is that every time I draw the canvas, the previous light that was on it goes away, so I only end up with the final light.

So my question is, how can I edit the pixels of one image/canvas over several iterations so my GPU doesn't explode? Like, I want to, after I apply the PIxelEffect, get the final image, and make it go through the PixelEffect again, and so on until all the lights have been placed.

Does this make any sense?

-------------------------------

I realized I could just draw all my lights to a canvas as circles or rectangles, with the color defining intensity. So no need for this!
Post Reply

Who is online

Users browsing this forum: No registered users and 66 guests