Page 3 of 4
Re: Lighting Dynamics Demo
Posted: Tue May 07, 2013 3:09 am
by spynaz
xXxMoNkEyMaNxXx wrote:Here, I made a pixel effect version completely from scratch:
spynazPE.love
I couldn't bear your insisting to index tables with strings, why not just use Lua? Instead of
simply do
Thanks bro!
Re: Lighting Dynamics Demo
Posted: Tue May 07, 2013 8:46 am
by T-Bone
Just wanted to point out that you can absolutely use shaders to get a pixely lighting. Just write your shader so that all pixels within a certain square size always get lit by the same amount. Or, perhaps even better, render everything in low-res with the shader (where every square is simply a pixel) and then scale it up.
Re: Lighting Dynamics Demo
Posted: Tue May 07, 2013 8:41 pm
by timmeh42
T-Bone wrote:row-les
I don't even what is that.
Ontopic, this would also increase the speed dramatically - depending on the size of your squares, 2x2 squares would be a 4 times increase - compared to per-pixel.
Re: Lighting Dynamics Demo
Posted: Tue May 07, 2013 9:05 pm
by spynaz
How would I change the color of the light?
Re: Lighting Dynamics Demo
Posted: Wed May 08, 2013 10:52 am
by T-Bone
timmeh42 wrote:T-Bone wrote:row-les
I don't even what is that.
Ontopic, this would also increase the speed dramatically - depending on the size of your squares, 2x2 squares would be a 4 times increase - compared to per-pixel.
Strange typo. Maybe I'm turning japanese?
Re: Lighting Dynamics Demo
Posted: Wed May 08, 2013 3:08 pm
by spynaz
How would I change the color of the light in the pixel effect one?
Re: Lighting Dynamics Demo
Posted: Thu Jun 13, 2013 6:21 pm
by bramblez
spynaz wrote:How would I change the color of the light in the pixel effect one?
Code: Select all
canvas:renderTo(function()
love.graphics.setColor(125, 125, 125, 125) -- color of light
...
end)
----
Ref wrote:Thanks!
Didn't appreciate the difference!
Docs say:
"os.clock() Return CPU time since Lua started in seconds."
Thought seconds were seconds - that CPU seconds were then same as Universal seconds.
Good catch!
Really appreciate input.
Edit:
Turns out on my computer that the os.clock() and os.time() happen to give the same elapsed time for this demo.
Demo actually is terminated by bee.buzz:isStopped( ) - when music is over.
hey, Ref. Can you explain me how to use dynamic lights from this .love to make it work for each bullet in this bullet lib?
Code: Select all
function bullets_load()
bulletspeed = 100
bullets = {
x = 0,
y = 0,
dx = 0,
dy = 0,
bullr = 2
}
end
function bullets_update(dt)
for i,v in ipairs(bullets) do
v.x = v.x + (v.dx * dt)
v.y = v.y + (v.dy * dt)
if checkCircularCollision(v.x,v.y,cx1,cy1,2,cr1) then
print("HIT!")
end
end
end
function bullets_draw()
love.graphics.setColor(0,0,0)
if shooting == 1 then
for i,v in ipairs(bullets) do
love.graphics.circle("fill",v.x,v.y,2)
end
end
end
function checkCircularCollision(ax, ay, bx, by, ar, br)
local dx = bx - ax
local dy = by - ay
local dist = math.sqrt(dx * dx + dy * dy)
return dist < ar + br
end
Re: Lighting Dynamics Demo
Posted: Sat Jun 15, 2013 11:21 pm
by bohdan77
Re: Lighting Dynamics Demo
Posted: Mon Jun 17, 2013 12:15 pm
by raidho36
Yeah, it's pretty good. Once I did almost exactly the same thing with GameMaker, but due to it's exceptional performance my demo was nowhere close to what's seen on that video regardless vast efforts to keep it fastest possible. Oh well. I think I'd rewrote it for löve once I get used to it. Was considering switching long ago, but baby duckling syndrome is a powerful thing.
I assume it can be done easily with löve, since it only requires offscreen buffers and blending modes (and maybe graphical primitives):
0) render your scene lit white
1) for each light source perform the following
2) set target shadow render buffer, clear to black
3) render light source texture onto it
4) then for each shadow casting object
5) render shadow, particular algorighm depends on particular object type, obviously
6) after that, merge (with addition blend mode) shadow render buffer to shadow accumulator buffer
7) after all light sources done, place composed shadow buffer onto scene with multiply blend mode.
And make sure you cull what's not visible, this is kinda tricky task. I'm not entirely sure how do I acheive this effect only using stencil buffers (probably just render-your-shadows-to-stencil -> render your light -> repeat over), so I just post how
I did it.
Re: Lighting Dynamics Demo
Posted: Tue Jun 18, 2013 6:57 pm
by jjmafiae
2 words:
FUCKING COOL!