Godot 4.0: Proper lighting setup for topdown 2D

  Рет қаралды 14,326

Holly

Holly

Күн бұрын

Пікірлер: 39
@parthipans5819
@parthipans5819 Жыл бұрын
You have to set LightOccluder node's cull mode to counterclockwise/clockwise (depending on where the light should enter) to light faces right under the LightOccluder node. Note: Disabling cull mode turns the node into a closed polygon
@mrgodfather933
@mrgodfather933 25 күн бұрын
I now have the problem of sprites being lit eventhough they are behind an object and should be affected by their shadow
@Riazey
@Riazey Жыл бұрын
I literally just came to the EXACT same conclusion! The only downside is that the shadows will not fall on objects behind them :( so all the sprites will behave as if there is nothing between them and the player at any time aaaa-!! I Seriously wish they could fix this as lights for topdown are virtually unusable, just about cried seeing it has been removed from 4.1 roadmap NOOOO
@parthipans5819
@parthipans5819 Жыл бұрын
You gotta change cull mode of Light Occluder node
@naiko1744
@naiko1744 7 ай бұрын
Did you find a fix? t.t
@mincraft752
@mincraft752 3 күн бұрын
Very helpful video is there a way you can make the objects behind an object darker like light is not falling on it. Currently every object near player is lit eventho some of them are under shadow.
@H0lley
@H0lley 3 күн бұрын
ah, you are right, that seems to actually be a limitation of this setup. we are drawing the shadows on the ground texture so that they do not clip into the entities that cast them. but we cannot really differentiate between entities here, so they'll also be behind sprites of any other entities... unfortunately I don't think there is much we can do about this other than rendering 3D as 2D.
@mincraft752
@mincraft752 3 күн бұрын
@@H0lley ill try to think of a solution
@mincraft752
@mincraft752 3 күн бұрын
@@H0lley is there a way we can detect if the object is in shadows or light
@Zindex3o9
@Zindex3o9 28 күн бұрын
great video but is it possible to add this to tiles add through TileMapLayer ? for example shadow casting for walls so that when you reach a corner a shadow cast from that corner or how about props like a moveable box ?
@H0lley
@H0lley 28 күн бұрын
you can bind scenes to tiles, then everything should work the same.
@-Solenya
@-Solenya Жыл бұрын
Thanks so much for this ! i ve been trying to do it but couldnt find anything online! The texture scale and energy have to be the same for both lights to work as supposed, right? Do you know how to make things disappear behind the shadows maybe? I saw someone using the mask blend mode for the light but they removed it.
@Dragynn999
@Dragynn999 6 ай бұрын
Super helpful video. Currently trying to get it to work in a night scene where warm light comes out of the windows in the neighborhood. If anyone has advice or an idea how they would do it, please feel free to let me know.
@H0lley
@H0lley 6 ай бұрын
yeah, using Godot's 2D lighting with pseudo 3D objects like walls that obscure an interior is very tricky ... the real solution for people needing advanced lighting like that is rendering 3D assets in a way that makes them look 2D. ask yourself if that light coming of the windows really needs to be able to cast shadows though. if it doesn't, maybe Light2D is not the way to go but something like a glow sprite or even HDR glow.
@Filgaja
@Filgaja Жыл бұрын
Hey there, what about TileMap? I tried to use the Tilemap as you use the Ground Node... but somehow it dosnt cast any shadows atm: Tilemap - Occlusion Layer --Light Mask 2 (1 disabled) -- Put a Occlusion Layer on the tree texture I also have a SpriteLight and ShadowLight and used a Canvas Modulate to darken the map. Do you know if this is achieveable with TileMap atm? I want to create my Unity Project into Godot and the Lighting should look like this again watch?v=8VK7yadrKOE With kind regard, Fil
@Filgaja
@Filgaja Жыл бұрын
I Got it to work, but i needed 2 TileMaps now One Tilemap for the Ground with Light Mask 2 One TileMap Akt as "Sprite Tilemap" For object that get Y-Sorted with Light Mask 1 Now i am at the next point... i dont want the Object get Lit from above. So if the Light is above the three, it should not Lit the Tree. But when your Y is lower it should light the tree. Any idea if this is archiveable? I realy liked this in Smart Light 2D because it is more imersive then light an object from behind
@H0lley
@H0lley Жыл бұрын
@@Filgaja unfortunately I have zero experience with TileMap but in theory it should work the same way I use a Sprite2D as ground texture in the video as TileMap is a CanvasItem, too.
@Filgaja
@Filgaja Жыл бұрын
@@H0lley Thank you yes it worked :) I found out. Now i have to check if i can layer all this lighting again like i was able to oin Unity. My main Problem will be, how i change the light sorting by Y stuff. So if your Flashlight is above y (behind a tree) then the tree should not be lightened. But can be lit from a loyer y position :) thank you for your video. It was the only helpfull one because of the "shadow below sprite" stuff and also there are way to many tutorials for 3.* so they are not very helpfull for 4.* since there where so much changes ^^
@erik-sandberg
@erik-sandberg Жыл бұрын
@@Filgaja I'm having the exact same issue for a game jam I'm working on right now! Surprised there isn't an easy way to do this :( Hard to find info about it too. I think I'll just skip this feature for mine at the moment unfortunately
@Filgaja
@Filgaja Жыл бұрын
@@erik-sandberg i figured it out, but i am in bed right now :) i can write you tomorrow how i avhieved this :)
@rybotekk
@rybotekk Жыл бұрын
Wow. Vreat and enjoyable. Thankyou.
@dexlovesgames_dlg
@dexlovesgames_dlg 3 ай бұрын
can this work if the sprite i rotating? I was hoping to use it with moving lights and rotating objects.
@H0lley
@H0lley 3 ай бұрын
yes. the normal map will still work when rotated. this is exactly what I did in ROIDERS. kzbin.info/www/bejne/j6rdZYJneZdjgNE
@trenom
@trenom Жыл бұрын
hi, how can i invert the shadow brightness? so it seems like light is coming out of a building, not from the main player
@H0lley
@H0lley Жыл бұрын
you'd place the light sources (PointLight2D) within e.g. behind the walls of your building. but it might still be tricky (especially windows) since the lighting system is purely 2D.
@trenom
@trenom Жыл бұрын
​@@H0lleythankyou
@Timito-yh9vb
@Timito-yh9vb 10 ай бұрын
Can you make same thing with Directional Light ?? I tried but didn't succeed 😥😥
@H0lley
@H0lley 10 ай бұрын
the DirectionalLight2D ist just a light from outside the viewport basically. it casts all shadows in the entire scene into the same direction. is that really what you want, or do you actually rather want something like the cone from a flashlight? because of its the latter than DirectionalLight2D is the wrong node. instead you use a PointLight2D, give it a cone-like texture, and then rotate it as desired.
@Timito-yh9vb
@Timito-yh9vb 10 ай бұрын
@@H0lley thanks
@disposablediscard
@disposablediscard Жыл бұрын
Can you make a tutorial on 2D Zelda-like combat with shield and dashing for Godot 4? Would be cool
@十里画纱
@十里画纱 Жыл бұрын
Can I upload your video to bilibili? I will indicate the source
@H0lley
@H0lley Жыл бұрын
feel free
@jakes-dev1337
@jakes-dev1337 5 ай бұрын
This is isometric not topdown but nice
@H0lley
@H0lley 5 ай бұрын
in game dev we speak of isometric when the entire game world is rendered isometrically, including the way in which the player and other entities traverse it. the demo shows a topdown game world where it just so happens that a cube or box is rotated in a way that three of its faces are shown.
@joesmith5970
@joesmith5970 Жыл бұрын
Great video, but either get a drink of water or edit the lip smacking out of your recording. I'm begging you.
@richardbutt8258
@richardbutt8258 5 ай бұрын
I don't mean to pick on you in particular. Lot's of people do it, and it looks like you actually have the answer I want. So kudos for that. But why do so many tutorial videos start with setting up basic elements (i.e. player, level geometry, and enemy)? I mean, it's one step removed from beginning the tutorial by explaining how to install godot. And since I'm already complaining, I'm also tired of tutorial videos that only show basic stuff that I already figured out with five minutes of experimentation. Case in point, I had to watch 5 or 6 videos of the basics on occlusion before I finally got to one that explained how to make an object cast a shadow while not casting a shadow on the object itself. Argh... Sorry, I needed to vent.
@H0lley
@H0lley 5 ай бұрын
if I started with a project where a lot of things are already set up, then I would get comments saying the exact inverse of yours - that they cannot reconstruct the effect because they are missing steps not shown in the video. everybody is at different stages so there's not much I can do about that. starting with a clean project is a good way to ensure that everybody is on the same page. generally it's best to be beginner friendly. perhaps what I could have done is adding timestamps that allow you to jump to the relevant sections though.
@akiponki
@akiponki 4 ай бұрын
@@H0lley In this particular case, where i just switched to godot it is nice to see how to do these basic things :)
Every 2D Node Explained in 9 Minutes !
9:19
Lukky
Рет қаралды 345 М.
Это было очень близко...
00:10
Аришнев
Рет қаралды 1,3 МЛН
Kluster Duo #настольныеигры #boardgames #игры #games #настолки #настольные_игры
00:47
REAL 3D brush can draw grass Life Hack #shorts #lifehacks
00:42
MrMaximus
Рет қаралды 8 МЛН
«Кім тапқыр?» бағдарламасы
00:16
Balapan TV
Рет қаралды 284 М.
How Games Make VFX (Demonstrated in Godot 4)
5:46
PlayWithFurcifer
Рет қаралды 350 М.
The Internet Played My Game (and it did not go well)
9:27
advancenine
Рет қаралды 256 М.
Hand drawn is easier than pixel art | HD graphics vs low-bit vs Hi-bit
10:00
Godot: Setting up lighting for topdown 2D
21:22
Holly
Рет қаралды 14 М.
Dynamic Lighting For Pixel Art Tutorial - Now You Know Too
3:03
Bringing My Cozy Isometric Game to Life | Hooked DEVLOG #2
22:10
Lost Game Dev
Рет қаралды 152 М.
How to Use 2D Lights in Godot 4 ~ Tutorial for Beginners
9:36
Chris' Tutorials
Рет қаралды 47 М.
Это было очень близко...
00:10
Аришнев
Рет қаралды 1,3 МЛН