at 16:57 instead of multiplying bby light.power, I found that: float distance = length(norm_pos - norm_screen) * screen.x / light.power; made the power value the pixel radius of the light. Multiplying just by power would mean a value of 1 lights up the whole screen.
@stanosipenko73053 жыл бұрын
For anyone wondering why there's max_num_lights and num_lights, the array size of lights has to be defined in advance, i.e. cannot change over time, so we pick an upper value (max_num_lights). The reason we also have num_lights is that we don't want to cycle through all of the array, if not all of the array is being used (e.g. we have 12 lights out of a maximum 16), because trying to get a light (lights[i]) that doesn't exist could either A. cause an error, or B. be slow.
@eduardomezencio40576 жыл бұрын
Great! But at the end, I would say the reason why the red light looks darker is that the underlying image is mostly green, having very little of the red component. In a mostly red image, the green light would look darker.
@Xenthera5 жыл бұрын
Hey this is really helpful, can you do the third tutorial?
@lonochka9634 Жыл бұрын
Up!
@flamendless6 жыл бұрын
You could do this to automatically send stuffs to the shader! local n = 0 function addLight(t) --t = { --position = {x,y}, --diffuse = {1,1,1}, --power = 128, --} n = n + 1 for key, value in pairs(t) do shader:send(("lights[%i].%s"):format(n, key), value) end end
@SkyVaultGames6 жыл бұрын
I really like that solution, ill be doing something very similar in the next episode, thanks!
@thomaszito30196 жыл бұрын
when i copied this there was an invisible character that broke the code. you're also sending a shader into lights[1] before lights[0]. Some changes to your function, and in love.draw, and the shader. In the glsl use vec2 screen = vec2(love_ScreenSize), so you don't need to send tthat in draw anymore // glsl change vec2 screen = vec2(love_ScreenSize); n = 0 function addLight(t) local shader = t.shader t.shader=nil for key, value in pairs(t) do shader:send(("lights[%i].%s"):format(n, key), value) end n = n + 1 end
@dill__pickles6 жыл бұрын
Was really looking forward to this! Thanks!
@dontrobthemachina37745 жыл бұрын
Love the video, really looking forward to part 3!
@ccgb925 жыл бұрын
i'm learning love2d (from godot), your tutorials are awesome man! appreciate it so much
@shekhawat59176 жыл бұрын
Part 3 ???
@flamendless4 жыл бұрын
This would be cooler if it's possible to use different shapes like cone from texture instead of just circular one
@thomaszito30196 жыл бұрын
Neat. Part 3?
@speakki5 жыл бұрын
I could be mistaken, but I believe the power here works in inverse? The power you add, the darker it gets in the scene. I'm not sure how to fix it.
@leeroynewman6 жыл бұрын
Pretty good video, thanks for making it.
@DjSapsan5 жыл бұрын
What ELO in AoE do you have?
@yimoawanardo6 жыл бұрын
Nice KDE desktop icon there ^^
@johnpayne7916 жыл бұрын
Thank you for the tutorial, it helps a lot. Also what operating system are you using, it looks amazing.
@SkyVaultGames6 жыл бұрын
John Payne glad it helped! Im on manjaro Linux using kde plasma :)
@eliaswenner78476 жыл бұрын
Linuxpower !!!
@d33talion6 жыл бұрын
Thanks! Very helpful video
@flamendless6 жыл бұрын
Just send the love screen size at load, because it doesnt change it value
@SkyVaultGames6 жыл бұрын
brbl thats a good idea! If you do that you also want to send it each time the screen size changes.