Thanks bro!xXxMoNkEyMaNxXx wrote:Here, I made a pixel effect version completely from scratch:I couldn't bear your insisting to index tables with strings, why not just use Lua? Instead ofsimply doCode: Select all
table["index"]
Code: Select all
table.index
Lighting Dynamics Demo
Re: Lighting Dynamics Demo
Check out my latest game: http://love2d.org/forums/viewtopic.php?f=5&t=33349
Re: Lighting Dynamics Demo
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.
Last edited by T-Bone on Wed May 08, 2013 10:52 am, edited 1 time in total.
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Re: Lighting Dynamics Demo
I don't even what is that.T-Bone wrote:row-les
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
How would I change the color of the light?
Check out my latest game: http://love2d.org/forums/viewtopic.php?f=5&t=33349
Re: Lighting Dynamics Demo
Strange typo. Maybe I'm turning japanese?timmeh42 wrote:I don't even what is that.T-Bone wrote:row-les
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.
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Re: Lighting Dynamics Demo
How would I change the color of the light in the pixel effect one?
Check out my latest game: http://love2d.org/forums/viewtopic.php?f=5&t=33349
Re: Lighting Dynamics Demo
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)
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?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.
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
- Attachments
-
- white-snow.love
- (45.03 KiB) Downloaded 276 times
Last edited by bramblez on Thu Jun 13, 2013 6:26 pm, edited 1 time in total.
Re: Lighting Dynamics Demo
Someone made this video.
http://youtu.be/Gy9tvA9AlSg
http://youtu.be/Gy9tvA9AlSg
Re: Lighting Dynamics Demo
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.
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
2 words:
FUCKING COOL!
FUCKING COOL!
Who is online
Users browsing this forum: Bing [Bot] and 8 guests