godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.55k stars 20.67k forks source link

light 2d z index occusion #31059

Closed tsrnc2 closed 4 years ago

tsrnc2 commented 5 years ago

"Version" current git

Issue description: I have a tileset of isometric buildings. Some buildings are taller then the cell they occupy. A player may go "behind" a building. The player is obscured by the building when the player is in front of the building they are "over" the tile and can be seen. A light 2d does not follow z index rules. This means that when a player with a "`flashlight" is behind a building but within the light occluder area the light comes through the building. Each tile has a collision shape with collision enabled ( so you cant walk through a building) and light occluder shape (so light behaves sanely on the front of the building. My first thought was a collision shape that could signal when a body entered but its all or nothing with collision enabled and only one light occluder per tile. My second thought was to deduct the drawing order. server/visual/visual_server_canvas.cpp was responsible for draw order but I have been informed retrieving information from here has performance limitations. I had considered adding area 2D nodes on top of everything. The tiles will be used for procedural generation and so must be reproducible in code. I have hundreds of buildings and I hope to add considerably more,manualy maintaing a database of area2d shapes to autotile locations seems a last resort. goodexample badexample

KoBeWi commented 4 years ago

Feature and improvement proposals for the Godot Engine are now being discussed and reviewed in a dedicated Godot Improvement Proposals (GIP) (godotengine/godot-proposals) issue tracker. The GIP tracker has a detailed issue template designed so that proposals include all the relevant information to start a productive discussion and help the community assess the validity of the proposal for the engine.

The main (godotengine/godot) tracker is now solely dedicated to bug reports and Pull Requests, enabling contributors to have a better focus on bug fixing work. Therefore, we are now closing all older feature proposals on the main issue tracker.

If you are interested in this feature proposal, please open a new proposal on the GIP tracker following the given issue template (after checking that it doesn't exist already). Be sure to reference this closed issue if it includes any relevant discussion (which you are also encouraged to summarize in the new proposal). Thanks in advance!

ghost commented 3 years ago

"Version" current git

Issue description: I have a tileset of isometric buildings. Some buildings are taller then the cell they occupy. A player may go "behind" a building. The player is obscured by the building when the player is in front of the building they are "over" the tile and can be seen. A light 2d does not follow z index rules. This means that when a player with a "`flashlight" is behind a building but within the light occluder area the light comes through the building. Each tile has a collision shape with collision enabled ( so you cant walk through a building) and light occluder shape (so light behaves sanely on the front of the building. My first thought was a collision shape that could signal when a body entered but its all or nothing with collision enabled and only one light occluder per tile. My second thought was to deduct the drawing order. server/visual/visual_server_canvas.cpp was responsible for draw order but I have been informed retrieving information from here has performance limitations. I had considered adding area 2D nodes on top of everything. The tiles will be used for procedural generation and so must be reproducible in code. I have hundreds of buildings and I hope to add considerably more,manualy maintaing a database of area2d shapes to autotile locations seems a last resort. goodexample badexample

Hi ! I'm also finding a solution about this. I want a light / shadow with z axis in 2d game , just like the direction light in 3d space. Do you have any answer now?