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
@mrgodfather93325 күн бұрын
I now have the problem of sprites being lit eventhough they are behind an object and should be affected by their shadow
@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 Жыл бұрын
You gotta change cull mode of Light Occluder node
@naiko17447 ай бұрын
Did you find a fix? t.t
@mincraft7523 күн бұрын
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.
@H0lley3 күн бұрын
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.
@mincraft7523 күн бұрын
@@H0lley ill try to think of a solution
@mincraft7523 күн бұрын
@@H0lley is there a way we can detect if the object is in shadows or light
@Zindex3o928 күн бұрын
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 ?
@H0lley28 күн бұрын
you can bind scenes to tiles, then everything should work the same.
@-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.
@Dragynn9996 ай бұрын
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.
@H0lley6 ай бұрын
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 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@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 Жыл бұрын
@@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 Жыл бұрын
@@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 Жыл бұрын
@@erik-sandberg i figured it out, but i am in bed right now :) i can write you tomorrow how i avhieved this :)
@rybotekk Жыл бұрын
Wow. Vreat and enjoyable. Thankyou.
@dexlovesgames_dlg3 ай бұрын
can this work if the sprite i rotating? I was hoping to use it with moving lights and rotating objects.
@H0lley3 ай бұрын
yes. the normal map will still work when rotated. this is exactly what I did in ROIDERS. kzbin.info/www/bejne/j6rdZYJneZdjgNE
@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 Жыл бұрын
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 Жыл бұрын
@@H0lleythankyou
@Timito-yh9vb10 ай бұрын
Can you make same thing with Directional Light ?? I tried but didn't succeed 😥😥
@H0lley10 ай бұрын
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-yh9vb10 ай бұрын
@@H0lley thanks
@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 Жыл бұрын
feel free
@jakes-dev13375 ай бұрын
This is isometric not topdown but nice
@H0lley5 ай бұрын
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 Жыл бұрын
Great video, but either get a drink of water or edit the lip smacking out of your recording. I'm begging you.
@richardbutt82585 ай бұрын
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.
@H0lley5 ай бұрын
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.
@akiponki4 ай бұрын
@@H0lley In this particular case, where i just switched to godot it is nice to see how to do these basic things :)