Deferred Rendering?

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:

Deferred Rendering?

Post by OmarShehata »

I'm really stuck on this.

I have my lighting system, and in the normal, forward rendering way, if you have 100 lights, you're going to loop through every pixel of every object 100 times...which is A LOT, this is so that you can calculate the combined effects of lights.

Instead, I want to group those 100 lights into a canvas, multiplying their colors, effectively combining their effects, and taking this final canvas, and multiplying the colors of the pixels by the pixels of my object. So you can effectively have hundreds and hundreds of lights, but it will be treated almost as one light!

So what I'm stuck on is somehow grouping my lights into a canvas. Any ideas?

=====What I've tried=========
-Drawing the lights as circles on a canvas, but since I'm just drawing them, they get added onto each other, so their colors don't blend


...that's about it. Any help or ideas would be appreciated!
User avatar
Dola
Prole
Posts: 14
Joined: Sat Aug 11, 2012 2:45 am
Location: Brasil

Re: Deferred Rendering?

Post by Dola »

Take a look at love.graphics.setBlendMode.
User avatar
Inny
Party member
Posts: 652
Joined: Fri Jan 30, 2009 3:41 am
Location: New York

Re: Deferred Rendering?

Post by Inny »

I put together a short demo of what the different transparency modes do. Maybe this can help you figure out what you want to do with your lighting engine.

up/down/left/right: change scaling, use this to overlap the color swatches
pageup/pagedown/home/end: shear the color swatches, I was testing something unrelated with this
A/Z: change the alpha channel for all colors
space/shift-space: cycle though the blending modes
w: change background color to white (for subtractive/multiplicative modes)

alpha may be enough, in the sense that you can just have white/yellow circles that are overlapped on the light sources.
Attachments
alphatest.love
(1.08 KiB) Downloaded 173 times
User avatar
OmarShehata
Party member
Posts: 259
Joined: Tue May 29, 2012 6:46 pm
Location: Egypt
Contact:

Re: Deferred Rendering?

Post by OmarShehata »

This is exactly what I need! Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests